Introduction
The NameCheap API allows you to build web and desktop applications that integrate with your
NameCheap account. It allows you to programmatically perform operations like domain search,
domain register, purchase SSL etc., from within your application.
Using NameCheap API you can:
(a) Sell domains, SSL certificates etc., on your website for any price of your choice
(b) Integrate domain registrations with billing applications like Modernbill and Ubersmith
(c) Create applications to monitor domains and send alerts
(d) Build custom applications to manage your domains
(e) And many more!
Namecheap Environments
We have a production as well as a test server environment. The test server environment is called
Sandbox. You are advised to
signup for a free account in sandbox, enable API access and test all your API calls on the sandbox environment before pointing your application to production.
To point an application to production, you only need to make minor changes. In most cases, you
barely need to change the service URL, APIusername and APIkey.
Sandbox Environment
The following is the API Service URL for our sandbox environment:
https://api.sandbox.namecheap.com/xml.response
Production Environment
We can't stress enough, but please test your APIs against our sandbox
environment before pointing it to production. We would like to avoid
service disruptions in production caused by untested code.
Following is the API Service URL for our production environment
https://api.namecheap.com/xml.response
Enabling API Access
There is no restriction for trying out our APIs in the sandbox environment. However, to enable API access on the production environment, you must meet our requirements.If you don’t meet any of our requirements but wish to use our APIs in production, contact our support team and we will get back to you.
The steps for enabling API access are similar in production and sandbox environments.To enable API access, follow the steps given below on the appropriate environment:
1. Login to your Namecheap account.
2. Go to My Account > Manage Profile page
3. From the left pane, select API Access option.
4. On the Manage Profile - API Access page, enter your account password.
5. Read our terms of service, and select the box indicating you agree.
6. Click Enable API Access.
After enabling API access, you will be allotted an APIUsername and APIKey. Your access to the
API is authenticated using these elements.
Making an API Call
You can easily access API be sending your parameters as a HTTP-GET request query string to the service URLs. The response is given in XML format. The HTTP-GET request URL is formed by adding query parameters and values to a service URL. The first parameter begins after a ? symbol. Successive parameters are included by adding an & symbol before each parameter.The format for adding queries is parameter=values. The following is the syntax of an API call:
https://<service url>/xml.response
?ApiUser=<api_username>
&ApiKey=<api_key>
&UserName=<nc_username>
&Command=<cmd_name>
&ClientIp=<clientIPaddress>
Sample API Call
https://api.sandbox.namecheap.com/xml.response
?ApiUser=ncuser
&ApiKey=apikey
&UserName=ncuser
&ClientIp=121.22.123.22
&Command=namecheap.domains.check
&DomainList=domain1.com,domain2.com
The above call returns a response in XML format. You can parse this XML file to obtain the
results and embed the data into the application you are creating. Please take a look at API
Reference for all available commands and required parameters.
Successful Call
You can find out if an API call was successful or not by checking the ApiResponse Status. The following is the syntax of a successful API call:
<ApiResponse Status="OK">
<Errors/>
[#Requested data in XML format...]
</ApiResponse>
Erroneous Call
The following is the syntax of an erroneous API call:
<ApiResponse Status="ERROR">
<Errors>
<Error Number="0">Error message</Error>
</Errors>
</ApiResponse>
Resetting the API key
After logging into the appropriate environment, Go to My Account > Manage Profile page and
select API Access option. Click on Reset API Key.
CAUTION: Any application using your existing API key will stop working immediately.
If you reset the API key, make sure you update the new API key on every API call.
Disabling API Access
To discontinue using NameCheap API, go to Manage Profile - API Access in the appropriate environment and choose Disable API Access option.
CAUTION: Any application using the API key will stop working immediately.
NOTE:
API is currently in public beta. During beta, API Support is available only from Monday - Friday 12:00 AM to 9:00 AM EST. Your support tickets will be replied only during that time.