namecheap-domains
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNamecheap Domains
Namecheap 域名管理
Skill for managing domains through the Namecheap API. Covers domain registration, DNS configuration, nameserver management, and domain transfers.
These methods work only for domains registered with Namecheap that are present in the user's account.
通过Namecheap API管理域名的Skill。涵盖域名注册、DNS配置、域名服务器管理以及域名转移。
这些方法仅适用于用户账户中已注册的Namecheap域名。
Prerequisites
前提条件
The user needs these credentials configured as environment variables:
| Variable | Description |
|---|---|
| API username |
| API key from Namecheap account |
| Namecheap account username (usually same as API user) |
| Whitelisted IP address for API access |
If any are missing, ask the user to set them. API access must be enabled in the Namecheap account dashboard and the client IP must be whitelisted.
用户需要将以下凭据配置为环境变量:
| 变量 | 描述 |
|---|---|
| API用户名 |
| 来自Namecheap账户的API密钥 |
| Namecheap账户用户名(通常与API用户相同) |
| 用于API访问的白名单IP地址 |
如果缺少任何一项,请要求用户进行设置。必须在Namecheap账户控制台中启用API访问权限,且客户端IP必须加入白名单。
API Basics
API基础信息
Base URL:
Sandbox URL:
https://api.namecheap.com/xml.responsehttps://api.sandbox.namecheap.com/xml.responseEvery request requires these global parameters:
| Parameter | Description |
|---|---|
| Username required to access the API |
| API key |
| Account username (use ApiUser if managing own account) |
| Whitelisted IP address |
| API command to run (e.g., |
基础URL:
沙箱URL:
https://api.namecheap.com/xml.responsehttps://api.sandbox.namecheap.com/xml.response每个请求都需要以下全局参数:
| 参数 | 描述 |
|---|---|
| 访问API所需的用户名 |
| API密钥 |
| 账户用户名(管理自己账户时使用ApiUser即可) |
| 白名单IP地址 |
| 要执行的API命令(例如: |
Making requests
发起请求
Use HTTP GET for read operations and HTTP POST for write operations (especially due to the large number of parameters).
domains.createbash
undefined读取操作使用HTTP GET,写入操作使用HTTP POST(尤其是,因为参数较多)。
domains.createbash
undefinedGET example — list domains
GET example — list domains
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&
ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&
ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.getList"
ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&
ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.getList"
```bashcurl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&
ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&
ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.getList"
ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&
ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.getList"
```bashPOST example — create domain
POST example — create domain
curl -s -X POST "https://api.namecheap.com/xml.response"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1" \
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1" \
... additional parameters
undefinedcurl -s -X POST "https://api.namecheap.com/xml.response"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1" \
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1" \
... additional parameters
undefinedParsing XML responses
解析XML响应
All responses are XML. Check the attribute on :
StatusApiResponsexml
<ApiResponse Status="OK"> <!-- Success -->
<ApiResponse Status="ERROR"> <!-- Failure — check <Errors> -->Use to extract values:
xmllintbash
undefined所有响应均为XML格式。检查的属性:
ApiResponseStatusxml
<ApiResponse Status="OK"> <!-- Success -->
<ApiResponse Status="ERROR"> <!-- Failure — check <Errors> -->使用提取值:
xmllintbash
undefinedCheck response status
Check response status
echo "$response" | xmllint --xpath "string(//ApiResponse/@Status)" -
echo "$response" | xmllint --xpath "string(//ApiResponse/@Status)" -
Extract error messages
Extract error messages
echo "$response" | xmllint --xpath "//Errors/Error/text()" - 2>/dev/null
echo "$response" | xmllint --xpath "//Errors/Error/text()" - 2>/dev/null
Extract specific attributes
Extract specific attributes
echo "$response" | xmllint --xpath "string(//DomainCreateResult/@Registered)" -
If `xmllint` is not available, use `grep` and `sed` for basic extraction, or Python's `xml.etree.ElementTree`.echo "$response" | xmllint --xpath "string(//DomainCreateResult/@Registered)" -
如果没有`xmllint`,可以使用`grep`和`sed`进行基础提取,或者使用Python的`xml.etree.ElementTree`。API Quick Reference
API快速参考
domains.*
domains.*
| Command | Description |
|---|---|
| List domains in the account |
| Get contact info for a domain |
| Register a new domain |
| List available TLDs |
| Update contact info for a domain |
| Check domain availability |
| Reactivate an expired domain |
| Renew an expiring domain |
| Get lock status |
| Set lock status |
| Get domain details |
See references/api-domains.md for full parameter details.
| Command | Description |
|---|---|
| List domains in the account |
| Get contact info for a domain |
| Register a new domain |
| List available TLDs |
| Update contact info for a domain |
| Check domain availability |
| Reactivate an expired domain |
| Renew an expiring domain |
| Get lock status |
| Set lock status |
| Get domain details |
See references/api-domains.md for full parameter details.
domains.dns.*
domains.dns.*
| Command | Description |
|---|---|
| Use Namecheap default DNS servers |
| Use custom DNS servers |
| Get DNS servers for a domain |
| Get DNS host records |
| Get email forwarding settings |
| Set email forwarding |
| Set DNS host records |
See references/api-dns.md for full parameter details.
| Command | Description |
|---|---|
| Use Namecheap default DNS servers |
| Use custom DNS servers |
| Get DNS servers for a domain |
| Get DNS host records |
| Get email forwarding settings |
| Set email forwarding |
| Set DNS host records |
See references/api-dns.md for full parameter details.
domains.ns.*
domains.ns.*
| Command | Description |
|---|---|
| Create a nameserver |
| Delete a nameserver |
| Get nameserver info |
| Update nameserver IP |
See references/api-nameservers.md for full parameter details.
| Command | Description |
|---|---|
| Create a nameserver |
| Delete a nameserver |
| Get nameserver info |
| Update nameserver IP |
See references/api-nameservers.md for full parameter details.
domains.transfer.*
domains.transfer.*
| Command | Description |
|---|---|
| Transfer domain to Namecheap |
| Check transfer status |
| Update/resubmit transfer |
| List domain transfers |
See references/api-transfers.md for full parameter details.
| Command | Description |
|---|---|
| Transfer domain to Namecheap |
| Check transfer status |
| Update/resubmit transfer |
| List domain transfers |
See references/api-transfers.md for full parameter details.
Common Workflows
Common Workflows
1. Check availability and register a domain
1. Check availability and register a domain
bash
undefinedbash
undefinedStep 1: Check availability
Step 1: Check availability
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.check&DomainList=example.com,example.net"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.check&DomainList=example.com,example.net"
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.check&DomainList=example.com,example.net"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.check&DomainList=example.com,example.net"
Look for: <DomainCheckResult Domain="example.com" Available="true" />
Look for: <DomainCheckResult Domain="example.com" Available="true" />
Step 2: Register (use POST)
Step 2: Register (use POST)
curl -s -X POST "https://api.namecheap.com/xml.response"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1"
-d "RegistrantFirstName=John"
-d "RegistrantLastName=Smith"
-d "RegistrantAddress1=123 Main St"
-d "RegistrantCity=San Francisco"
-d "RegistrantStateProvince=CA"
-d "RegistrantPostalCode=94102"
-d "RegistrantCountry=US"
-d "RegistrantPhone=+1.4155551234"
-d "RegistrantEmailAddress=john@example.com"
-d "TechFirstName=John"
-d "TechLastName=Smith"
-d "TechAddress1=123 Main St"
-d "TechCity=San Francisco"
-d "TechStateProvince=CA"
-d "TechPostalCode=94102"
-d "TechCountry=US"
-d "TechPhone=+1.4155551234"
-d "TechEmailAddress=john@example.com"
-d "AdminFirstName=John"
-d "AdminLastName=Smith"
-d "AdminAddress1=123 Main St"
-d "AdminCity=San Francisco"
-d "AdminStateProvince=CA"
-d "AdminPostalCode=94102"
-d "AdminCountry=US"
-d "AdminPhone=+1.4155551234"
-d "AdminEmailAddress=john@example.com"
-d "AuxBillingFirstName=John"
-d "AuxBillingLastName=Smith"
-d "AuxBillingAddress1=123 Main St"
-d "AuxBillingCity=San Francisco"
-d "AuxBillingStateProvince=CA"
-d "AuxBillingPostalCode=94102"
-d "AuxBillingCountry=US"
-d "AuxBillingPhone=+1.4155551234"
-d "AuxBillingEmailAddress=john@example.com"
-d "AddFreeWhoisguard=yes"
-d "WGEnabled=yes"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1"
-d "RegistrantFirstName=John"
-d "RegistrantLastName=Smith"
-d "RegistrantAddress1=123 Main St"
-d "RegistrantCity=San Francisco"
-d "RegistrantStateProvince=CA"
-d "RegistrantPostalCode=94102"
-d "RegistrantCountry=US"
-d "RegistrantPhone=+1.4155551234"
-d "RegistrantEmailAddress=john@example.com"
-d "TechFirstName=John"
-d "TechLastName=Smith"
-d "TechAddress1=123 Main St"
-d "TechCity=San Francisco"
-d "TechStateProvince=CA"
-d "TechPostalCode=94102"
-d "TechCountry=US"
-d "TechPhone=+1.4155551234"
-d "TechEmailAddress=john@example.com"
-d "AdminFirstName=John"
-d "AdminLastName=Smith"
-d "AdminAddress1=123 Main St"
-d "AdminCity=San Francisco"
-d "AdminStateProvince=CA"
-d "AdminPostalCode=94102"
-d "AdminCountry=US"
-d "AdminPhone=+1.4155551234"
-d "AdminEmailAddress=john@example.com"
-d "AuxBillingFirstName=John"
-d "AuxBillingLastName=Smith"
-d "AuxBillingAddress1=123 Main St"
-d "AuxBillingCity=San Francisco"
-d "AuxBillingStateProvince=CA"
-d "AuxBillingPostalCode=94102"
-d "AuxBillingCountry=US"
-d "AuxBillingPhone=+1.4155551234"
-d "AuxBillingEmailAddress=john@example.com"
-d "AddFreeWhoisguard=yes"
-d "WGEnabled=yes"
curl -s -X POST "https://api.namecheap.com/xml.response"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1"
-d "RegistrantFirstName=John"
-d "RegistrantLastName=Smith"
-d "RegistrantAddress1=123 Main St"
-d "RegistrantCity=San Francisco"
-d "RegistrantStateProvince=CA"
-d "RegistrantPostalCode=94102"
-d "RegistrantCountry=US"
-d "RegistrantPhone=+1.4155551234"
-d "RegistrantEmailAddress=john@example.com"
-d "TechFirstName=John"
-d "TechLastName=Smith"
-d "TechAddress1=123 Main St"
-d "TechCity=San Francisco"
-d "TechStateProvince=CA"
-d "TechPostalCode=94102"
-d "TechCountry=US"
-d "TechPhone=+1.4155551234"
-d "TechEmailAddress=john@example.com"
-d "AdminFirstName=John"
-d "AdminLastName=Smith"
-d "AdminAddress1=123 Main St"
-d "AdminCity=San Francisco"
-d "AdminStateProvince=CA"
-d "AdminPostalCode=94102"
-d "AdminCountry=US"
-d "AdminPhone=+1.4155551234"
-d "AdminEmailAddress=john@example.com"
-d "AuxBillingFirstName=John"
-d "AuxBillingLastName=Smith"
-d "AuxBillingAddress1=123 Main St"
-d "AuxBillingCity=San Francisco"
-d "AuxBillingStateProvince=CA"
-d "AuxBillingPostalCode=94102"
-d "AuxBillingCountry=US"
-d "AuxBillingPhone=+1.4155551234"
-d "AuxBillingEmailAddress=john@example.com"
-d "AddFreeWhoisguard=yes"
-d "WGEnabled=yes"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.create"
-d "DomainName=example.com"
-d "Years=1"
-d "RegistrantFirstName=John"
-d "RegistrantLastName=Smith"
-d "RegistrantAddress1=123 Main St"
-d "RegistrantCity=San Francisco"
-d "RegistrantStateProvince=CA"
-d "RegistrantPostalCode=94102"
-d "RegistrantCountry=US"
-d "RegistrantPhone=+1.4155551234"
-d "RegistrantEmailAddress=john@example.com"
-d "TechFirstName=John"
-d "TechLastName=Smith"
-d "TechAddress1=123 Main St"
-d "TechCity=San Francisco"
-d "TechStateProvince=CA"
-d "TechPostalCode=94102"
-d "TechCountry=US"
-d "TechPhone=+1.4155551234"
-d "TechEmailAddress=john@example.com"
-d "AdminFirstName=John"
-d "AdminLastName=Smith"
-d "AdminAddress1=123 Main St"
-d "AdminCity=San Francisco"
-d "AdminStateProvince=CA"
-d "AdminPostalCode=94102"
-d "AdminCountry=US"
-d "AdminPhone=+1.4155551234"
-d "AdminEmailAddress=john@example.com"
-d "AuxBillingFirstName=John"
-d "AuxBillingLastName=Smith"
-d "AuxBillingAddress1=123 Main St"
-d "AuxBillingCity=San Francisco"
-d "AuxBillingStateProvince=CA"
-d "AuxBillingPostalCode=94102"
-d "AuxBillingCountry=US"
-d "AuxBillingPhone=+1.4155551234"
-d "AuxBillingEmailAddress=john@example.com"
-d "AddFreeWhoisguard=yes"
-d "WGEnabled=yes"
Step 3: Verify
Step 3: Verify
Check response for: <DomainCreateResult Registered="true" />
Check response for: <DomainCreateResult Registered="true" />
When the user provides contact info once, reuse it for all four contact types (Registrant, Tech, Admin, AuxBilling) unless they specify different contacts.
When the user provides contact info once, reuse it for all four contact types (Registrant, Tech, Admin, AuxBilling) unless they specify different contacts.2. Configure DNS records
2. Configure DNS records
bash
undefinedbash
undefinedStep 1: Verify domain uses Namecheap DNS
Step 1: Verify domain uses Namecheap DNS
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getList&SLD=example&TLD=com"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getList&SLD=example&TLD=com"
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getList&SLD=example&TLD=com"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getList&SLD=example&TLD=com"
If using custom nameservers, switch to default first (required for host records)
If using custom nameservers, switch to default first (required for host records)
Command=namecheap.domains.dns.setDefault&SLD=example&TLD=com
Command=namecheap.domains.dns.setDefault&SLD=example&TLD=com
Step 2: Get current records
Step 2: Get current records
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getHosts&SLD=example&TLD=com"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getHosts&SLD=example&TLD=com"
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getHosts&SLD=example&TLD=com"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.dns.getHosts&SLD=example&TLD=com"
Step 3: Set all records (setHosts replaces ALL records — include existing ones)
Step 3: Set all records (setHosts replaces ALL records — include existing ones)
curl -s -X POST "https://api.namecheap.com/xml.response"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.dns.setHosts"
-d "SLD=example"
-d "TLD=com"
-d "HostName1=@"
-d "RecordType1=A"
-d "Address1=1.2.3.4"
-d "TTL1=1800"
-d "HostName2=www"
-d "RecordType2=CNAME"
-d "Address2=example.com"
-d "TTL2=1800"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.dns.setHosts"
-d "SLD=example"
-d "TLD=com"
-d "HostName1=@"
-d "RecordType1=A"
-d "Address1=1.2.3.4"
-d "TTL1=1800"
-d "HostName2=www"
-d "RecordType2=CNAME"
-d "Address2=example.com"
-d "TTL2=1800"
**Critical:** `setHosts` replaces ALL existing records. Always fetch current records first with `getHosts`, then include them alongside new records in the `setHosts` call. Omitting existing records will delete them.curl -s -X POST "https://api.namecheap.com/xml.response"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.dns.setHosts"
-d "SLD=example"
-d "TLD=com"
-d "HostName1=@"
-d "RecordType1=A"
-d "Address1=1.2.3.4"
-d "TTL1=1800"
-d "HostName2=www"
-d "RecordType2=CNAME"
-d "Address2=example.com"
-d "TTL2=1800"
-d "ApiUser=${NAMECHEAP_API_USER}"
-d "ApiKey=${NAMECHEAP_API_KEY}"
-d "UserName=${NAMECHEAP_USERNAME}"
-d "ClientIp=${NAMECHEAP_CLIENT_IP}"
-d "Command=namecheap.domains.dns.setHosts"
-d "SLD=example"
-d "TLD=com"
-d "HostName1=@"
-d "RecordType1=A"
-d "Address1=1.2.3.4"
-d "TTL1=1800"
-d "HostName2=www"
-d "RecordType2=CNAME"
-d "Address2=example.com"
-d "TTL2=1800"
**Critical:** `setHosts` replaces ALL existing records. Always fetch current records first with `getHosts`, then include them alongside new records in the `setHosts` call. Omitting existing records will delete them.3. Transfer a domain to Namecheap
3. Transfer a domain to Namecheap
bash
undefinedbash
undefinedStep 1: Initiate transfer
Step 1: Initiate transfer
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.create&
DomainName=example.com&Years=1&EPPCode=AUTH_CODE_HERE"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.create&
DomainName=example.com&Years=1&EPPCode=AUTH_CODE_HERE"
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.create&
DomainName=example.com&Years=1&EPPCode=AUTH_CODE_HERE"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.create&
DomainName=example.com&Years=1&EPPCode=AUTH_CODE_HERE"
Step 2: Monitor transfer status
Step 2: Monitor transfer status
curl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.getStatus&TransferID=TRANSFER_ID"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.getStatus&TransferID=TRANSFER_ID"
Transferable TLDs: .biz, .ca, .cc, .co, .co.uk, .com, .com.es, .com.pe, .es, .in, .info, .me, .me.uk, .mobi, .net, .net.pe, .nom.es, .org, .org.es, .org.pe, .org.uk, .pe, .tv, .uscurl -s "https://api.namecheap.com/xml.response?\
ApiUser=${NAMECHEAP_API_USER}&ApiKey=${NAMECHEAP_API_KEY}&
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.getStatus&TransferID=TRANSFER_ID"
UserName=${NAMECHEAP_USERNAME}&ClientIp=${NAMECHEAP_CLIENT_IP}&
Command=namecheap.domains.transfer.getStatus&TransferID=TRANSFER_ID"
Transferable TLDs: .biz, .ca, .cc, .co, .co.uk, .com, .com.es, .com.pe, .es, .in, .info, .me, .me.uk, .mobi, .net, .net.pe, .nom.es, .org, .org.es, .org.pe, .org.uk, .pe, .tv, .usImportant Notes
Important Notes
- SLD/TLD splitting: Many endpoints require and
SLDas separate parameters. ForTLD, SLD=example.comand TLD=example. Forcom, SLD=example.co.ukand TLD=example.co.uk - Phone format: Always use (e.g.,
+NNN.NNNNNNNNNN).+1.4155551234 - IDN domains: Send the domain name in Punycode format (e.g., ) and include the
xn--sdkhjsdhfkdh.comparameter.IdnCode - Premium domains: Set and provide
IsPremiumDomain=Trueand optionallyPremiumPrice.EapFee - Rate limiting: Namecheap may throttle requests. If you receive errors, wait before retrying.
- Sandbox: Use the sandbox URL for testing. Sandbox credentials are separate from production.
- SLD/TLD splitting: Many endpoints require and
SLDas separate parameters. ForTLD, SLD=example.comand TLD=example. Forcom, SLD=example.co.ukand TLD=example.co.uk - Phone format: Always use (e.g.,
+NNN.NNNNNNNNNN).+1.4155551234 - IDN domains: Send the domain name in Punycode format (e.g., ) and include the
xn--sdkhjsdhfkdh.comparameter.IdnCode - Premium domains: Set and provide
IsPremiumDomain=Trueand optionallyPremiumPrice.EapFee - Rate limiting: Namecheap may throttle requests. If you receive errors, wait before retrying.
- Sandbox: Use the sandbox URL for testing. Sandbox credentials are separate from production.
Error Handling
Error Handling
Common error patterns in the XML response:
xml
<ApiResponse Status="ERROR">
<Errors>
<Error Number="2016166">Domain is not associated with your account</Error>
</Errors>
</ApiResponse>Always check before processing results. If :
Status="OK"Status="ERROR"- Extract the error number and message
- Check the error codes listed in the relevant reference file
- Common issues:
- Authentication errors: Verify credentials and whitelisted IP
- Domain not found (2019166): Check domain name and account association
- Invalid phone (2015182): Use format
+NNN.NNNNNNNNNN - Domain not available (3019166/4019166): Domain already registered
- TLD not supported (2030280): Check supported TLDs
Common error patterns in the XML response:
xml
<ApiResponse Status="ERROR">
<Errors>
<Error Number="2016166">Domain is not associated with your account</Error>
</Errors>
</ApiResponse>Always check before processing results. If :
Status="OK"Status="ERROR"- Extract the error number and message
- Check the error codes listed in the relevant reference file
- Common issues:
- Authentication errors: Verify credentials and whitelisted IP
- Domain not found (2019166): Check domain name and account association
- Invalid phone (2015182): Use format
+NNN.NNNNNNNNNN - Domain not available (3019166/4019166): Domain already registered
- TLD not supported (2030280): Check supported TLDs
Troubleshooting
Troubleshooting
Error: Connection refused or timeout
Cause: Client IP not whitelisted or API access not enabled.
Solution: Check Namecheap dashboard → Profile → Tools → API Access. Verify the IP matches .
NAMECHEAP_CLIENT_IPError: Empty or malformed response
Cause: Missing required parameters.
Solution: Verify all global parameters are present. Check that value is spelled correctly.
CommandError: DNS changes not taking effect
Cause: Domain may be using custom nameservers instead of Namecheap default.
Solution: Call first, then set host records. URL forwarding, email forwarding, and dynamic DNS only work with Namecheap default nameservers.
domains.dns.setDefaultError: Connection refused or timeout
Cause: Client IP not whitelisted or API access not enabled.
Solution: Check Namecheap dashboard → Profile → Tools → API Access. Verify the IP matches .
NAMECHEAP_CLIENT_IPError: Empty or malformed response
Cause: Missing required parameters.
Solution: Verify all global parameters are present. Check that value is spelled correctly.
CommandError: DNS changes not taking effect
Cause: Domain may be using custom nameservers instead of Namecheap default.
Solution: Call first, then set host records. URL forwarding, email forwarding, and dynamic DNS only work with Namecheap default nameservers.
domains.dns.setDefault