Namecheap API: who gets access and why calls fail

Namecheap API access explained: the eligibility rule, the IPv4 allowlist, paying from balance, error codes, and pointing nameservers at Cloudflare.

Simon, Founder of Shipyard

By · Founder of Shipyard

7 minute read

Three gates stand before the first API call

The Namecheap API is not open to every account. Before a single call succeeds, the account must qualify for API access (the thresholds below are as of November 2026), the calling machine's IPv4 address must be on an allowlist, and, if you intend to buy anything, the account must hold enough balance to pay for it. Miss any one of the three and the API answers with an error, not a domain.

None of this applies to buying a domain by hand, which stays a quick job in the browser. It applies when a script or a tool is to register the name and point it at your DNS provider as one step in a larger launch.

GateNamecheap's ruleWhere to fix it
EligibilityAt least 20 domains in the account, or at least $50 account balance, or at least $50 spent within the last two yearsProfile, Billing, Add funds is the quickest route
IP allowlistAt least one whitelisted address, and only IPv4 is acceptedProfile, Tools, Namecheap API Access, Whitelisted IPs
PaymentEvery billing operation through the API is charged to account balance, never to a saved cardTop up before the purchase

Switching API access on

The last step needs the public IPv4 address of the machine that will make the calls. The command under the steps prints it when run on that machine. Its -4 flag matters: on a connection that prefers IPv6, a plain lookup returns an address Namecheap will not accept.

  1. Sign in and open Profile, then Tools.
  2. Scroll to Business & Dev Tools and press Manage next to Namecheap API Access.
  3. Flip the switch to on, accept the terms of service and enter your account password.
  4. Copy the API key that appears. Your Namecheap username doubles as the API username.
  5. On the same page press Edit next to Whitelisted IPs, then Add IP, and enter the public IPv4 address of the machine that will make the calls.
curl -4 ifconfig.me

What a request looks like

The API is one HTTPS endpoint that takes named parameters and returns XML. Five parameters accompany every call.

Terminal
curl https://api.namecheap.com/xml.response \
  --data-urlencode "ApiUser=$NC_USER" \
  --data-urlencode "ApiKey=$NC_KEY" \
  --data-urlencode "UserName=$NC_USER" \
  --data-urlencode "ClientIp=$MY_IPV4" \
  --data-urlencode "Command=namecheap.users.getBalances"
ParameterValueLimit
ApiUserYour Namecheap username20 characters
ApiKeyThe key from the API Access page50 characters
UserNameThe account the command acts on. Normally the same as ApiUser20 characters
ClientIpThe IPv4 address the call comes from15 characters, the length of an IPv4 address. Namecheap accepts IPv4 only
CommandThe method, for example namecheap.users.getBalances80 characters

Status lives in the XML

Judge a call by the XML it returns. The root ApiResponse element carries Status="OK" or Status="ERROR", and a failure contains an Error element with a number and a message. A good first call is the balance command above: it changes nothing, and it proves all three gates at once, because the reply includes your available balance.

The numbers below are the ones a new integration meets. For the first two rows go by the message text more than the number: the text is what Shipyard's adapter matches as well. The last three come straight from Namecheap's method reference for the nameserver command.

ErrorMeaningFix
1011150, message about an invalid request IPThe call arrived from an address that is not whitelisted, or ClientIp does not matchWhitelist the current IPv4 address and send the same one in ClientIp
1011102, message that the API key is invalid or API access has not been enabledThe switch is off, the key was regenerated, or the account never qualifiedCheck eligibility, then the API Access page
Message about insufficient fundsA purchase was attempted with too little balanceAdd funds, then repeat the call
2019166Domain not foundCheck spelling and the split into SLD and TLD
2016166Domain is not associated with your accountThe name lives in another account or at another registrar
2030166Edit permission for domain is not supportedThe domain cannot be modified through the API in its current state

The allowlist and a home connection

The IP rule is the part that keeps biting after setup. Most home and mobile connections change their public address from time to time, and from that moment every call fails with the invalid IP error although nothing in your configuration changed. A server with a fixed address does not have the problem. A laptop does, and the cure each time is to look up the new address, add it to the list, and update ClientIp wherever it is stored.

There is also a throughput ceiling, which a single launch never approaches but a bulk script can: Namecheap's FAQ gives 50 calls a minute, 700 an hour and 8,000 a day, counted across the whole key.

Buying a domain with domains.create

namecheap.domains.create is a long call because it wants a complete contact four times over: registrant, technical, administrative and billing-auxiliary, each with name, street address, city, state or province, postal code, country, phone and email. Sending the same person in all four roles is normal for a small company.

Three defaults in the method reference deserve attention, because each produces a result you probably did not intend if you leave the parameter out.

Pointing the domain at Cloudflare or another DNS host

A common arrangement is Namecheap as registrar with DNS at Cloudflare. By hand: Domain List, Manage next to the domain, and in the Nameservers section switch the dropdown from Namecheap BasicDNS to Custom DNS, enter the nameservers your DNS host assigned, and press the green checkmark.

Through the API it is one command with three parameters. The domain is passed in two pieces, so myapp.co.uk becomes SLD=myapp and TLD=co.uk, and the nameservers go in as one comma-separated string.

Two side effects are easy to overlook. Once a domain uses custom nameservers, Namecheap's own URL forwarding, email forwarding and dynamic DNS stop working for it, because they depend on Namecheap's DNS. And existing host records are not copied anywhere: whatever the domain needs must already exist at the new DNS host before you switch. Namecheap says a nameserver change may take up to 24 hours to be seen everywhere, sometimes longer. In practice a DNS host often reports the zone active much sooner, but plan the launch around the documented figure, not the lucky one.

Text
Command=namecheap.domains.dns.setCustom
SLD=myapp
TLD=com
Nameservers=ada.ns.cloudflare.com,bob.ns.cloudflare.com

<DomainDNSSetCustomResult Domain="myapp.com" Updated="true" />

Trying it without spending money

Namecheap runs a sandbox with its own sign-up, its own API key and its own IP allowlist; nothing carries over from your real account. Purchases there are simulated. Two quirks surprise people: domains that are taken in the real world show as available in the sandbox, and test registrations cannot be deleted or reset afterwards. Moving to production normally means changing the service URL, the username and the key, and nothing else.

How Shipyard uses the Namecheap API

With Namecheap chosen as registrar, Shipyard stores your username, API key and IPv4 address in the keychain on your computer and tests them with the balance call. It sends every request as a form-encoded POST to https://api.namecheap.com/xml.response, so the key never appears in a URL or a proxy log.

For a purchase it checks availability, reads the one-year registration and renewal prices for the ending, refuses premium names outright, compares the price with your balance and stops with a top-up instruction if the balance is short. Then it shows you the amount and waits for your confirmation. The registration copies your default saved address into all four contact roles, sets Years=1 and turns domain privacy on. Afterwards it calls setCustom with the nameservers of your DNS zone and waits up to 30 minutes for the zone to become active; if that takes longer, running the launch again continues from the same step.

Yours to do first: qualify for API access, whitelist your address, fund the balance and save a default address under Profile, Addresses. Shipyard cannot do any of the four, and it tells you which one is missing when a call fails: the first three rows of the error table above are the cases its adapter recognises and turns into an instruction.

Sources

Launch in an hour, not a weekend

Shipyard connects your accounts once, then sets up the domain, hosting, database, email and payments for every new product.

See how it works

Read next