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.
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.
| Gate | Namecheap's rule | Where to fix it |
|---|---|---|
| Eligibility | At least 20 domains in the account, or at least $50 account balance, or at least $50 spent within the last two years | Profile, Billing, Add funds is the quickest route |
| IP allowlist | At least one whitelisted address, and only IPv4 is accepted | Profile, Tools, Namecheap API Access, Whitelisted IPs |
| Payment | Every billing operation through the API is charged to account balance, never to a saved card | Top 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.
- Sign in and open Profile, then Tools.
- Scroll to Business & Dev Tools and press Manage next to Namecheap API Access.
- Flip the switch to on, accept the terms of service and enter your account password.
- Copy the API key that appears. Your Namecheap username doubles as the API username.
- 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.meWhat a request looks like
The API is one HTTPS endpoint that takes named parameters and returns XML. Five parameters accompany every call.
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"| Parameter | Value | Limit |
|---|---|---|
ApiUser | Your Namecheap username | 20 characters |
ApiKey | The key from the API Access page | 50 characters |
UserName | The account the command acts on. Normally the same as ApiUser | 20 characters |
ClientIp | The IPv4 address the call comes from | 15 characters, the length of an IPv4 address. Namecheap accepts IPv4 only |
Command | The method, for example namecheap.users.getBalances | 80 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.
| Error | Meaning | Fix |
|---|---|---|
1011150, message about an invalid request IP | The call arrived from an address that is not whitelisted, or ClientIp does not match | Whitelist 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 enabled | The switch is off, the key was regenerated, or the account never qualified | Check eligibility, then the API Access page |
| Message about insufficient funds | A purchase was attempted with too little balance | Add funds, then repeat the call |
2019166 | Domain not found | Check spelling and the split into SLD and TLD |
2016166 | Domain is not associated with your account | The name lives in another account or at another registrar |
2030166 | Edit permission for domain is not supported | The 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.
Yearsdefaults to 2. PassYears=1if you mean one year.AddFreeWhoisguardandWGEnabledboth default tono. The first adds the free domain privacy service and the second enables it; the parameter names keep the old Whoisguard brand. Sendyesfor both, or your contact details are published in WHOIS.- Some endings need extended attributes on top of the contacts, among them
.us,.eu,.ca,.co.uk,.deand.fr. A.comdoes not.
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.
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
- Namecheap API introductionnamecheap.com
- Namecheap API FAQnamecheap.com
- API global parametersnamecheap.com
- namecheap.domains.dns.setCustomnamecheap.com
- namecheap.domains.createnamecheap.com
- How to change DNS for a domainnamecheap.com
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