Node.js library for the NameCheap API.
npm install namecheap
var Namecheap = require('namecheap'),
namecheap = new Namecheap('chadsmith', '28bc........................', '74.125.225.100');
namecheap.domains.check('github.com', function(err, res) {
console.log(res);
});
Checks the availability of domains
namecheap.domains.check('github.com', function(err, res) {
console.log(res);
});
namecheap.domains.check(['github.com', 'twitter.com'], function(err, res) {
console.log(res);
});
Registers a new domain name. Optionally include years
and params
to set additional required params. If params
fields are not set, values from namecheap.setDefaults
will be used.
namecheap.domains.create('smithfam.net' function(err, res) {
console.log(res);
});
namecheap.domains.create('smithfam.net', { RegistrantFirstName: 'Chad', ..... AuxBillingEmailAddress: 'chad@nospam.me' }, function(err, res) {
console.log(res);
});
Gets contact information of the requested domain.
namecheap.domains.getContacts('smithfam.net', function(err, res) {
console.log(res);
});
Returns information about the requested domain.
namecheap.domains.getInfo('smithfam.net', function(err, res) {
console.log(res);
});
Returns a list of domains for the particular user. Set optional params to filter results.
namecheap.domains.getList(function(err, res) {
console.log(res);
});
namecheap.domains.getList({ ListType: 'EXPIRED' }, function(err, res) {
console.log(res);
});
Gets the RegistrarLock status of the requested domain.
namecheap.domains.getRegistrarLock('nospam.me', function(err, res) {
console.log(res);
});
Returns a list of tlds.
namecheap.domains.getTldList(function(err, res) {
console.log(res);
});
Reactivates an expired domain.
namecheap.domains.reactivate('smithfam.net', function(err, res) {
console.log(res);
});
Renews an expiring domain. Use optional params years
and code
to set length of renewal or promo code.
namecheap.domains.renew('smithfam.net', function(err, res) {
console.log(res);
});
namecheap.domains.renew('nospam.me', 5, 'PRICEFALL', function(err, res) {
console.log(res);
});
Sets contact information for the domain. Optionally include params
to set additional required params. If params
fields are not set, values from namecheap.setDefaults
will be used.
namecheap.domains.setContacts('smithfam.net', function(err, res) {
console.log(res);
});
namecheap.domains.setContacts('smithfam.net', { RegistrantFirstName: 'Chad', ..... AuxBillingEmailAddress: 'chad@nospam.me' }, function(err, res) {
console.log(res);
});
Sets the RegistrarLock status for a domain. Defaults to true if lock
is not set.
namecheap.domains.setRegistrarLock('smithfam.net', function(err, res) {
console.log(res);
});
namecheap.domains.setRegistrarLock('smithfam.net', false, function(err, res) {
console.log(res);
});
Gets email forwarding settings for the requested domain.
namecheap.domains.dns.getEmailForwarding('smithfam.net', function(err, res) {
console.log(res);
});
Retrieves DNS host record settings for the requested domain.
namecheap.domains.dns.getHosts('smithfam.net', function(err, res) {
console.log(res);
});
Gets a list of DNS servers associated with the requested domain.
namecheap.domains.dns.getList('smithfam.net', function(err, res) {
console.log(res);
});
Sets domain to use custom DNS servers. nameservers
can be an array or comma separated list.
namecheap.domains.dns.setCustom('smithfam.net', ['dns1.stabletransit.com', 'dns2.stabletransit.com'], function(err, res) {
console.log(res);
});
Sets email forwarding for a domain name.
namecheap.domains.dns.setEmailForwarding('smithfam.net', { chad: 'chad@nospam.me', laura: 'laura@nospam.me' }, function(err, res) {
console.log(res);
});
Sets email forwarding for a domain name.
namecheap.domains.dns.setEmailForwarding('smithfam.net', { chad: 'chad@nospam.me', laura: 'laura@nospam.me' }, function(err, res) {
console.log(res);
});
Sets DNS host records settings for the requested domain. Optional EmailType can be set.
namecheap.domains.dns.setHosts('smithfam.net', [
{ HostName: '@', RecordType: 'A', Address: '74.125.225.100', TTL: 3600 },
{ HostName: 'www', RecordType: 'CNAME', Address: '@', TTL: 3600 },
{ HostName: '@', RecordType: 'MX', Address: 'aspmx.l.google.com', MXPref: 10, TTL: 300 }
], function(err, res) {
console.log(res);
});
Creates a new nameserver.
namecheap.domains.ns.create('smithfam.net', 'ns1.smithfam.net', '74.125.225.100', function(err, res) {
console.log(res);
});
Deletes a nameserver associated with the requested domain.
namecheap.domains.ns.delete('smithfam.net', 'ns1.smithfam.net', function(err, res) {
console.log(res);
});
Retrieves information about a registered nameserver.
namecheap.domains.ns.getInfo('smithfam.net', 'ns1.smithfam.net', function(err, res) {
console.log(res);
});
Updates the IP address of a registered nameserver.
namecheap.domains.ns.update('smithfam.net', 'ns1.smithfam.net', '74.125.225.100', '74.125.225.50', function(err, res) {
console.log(res);
});
Transfers a domain to NameCheap.
namecheap.domains.transfer.create('smithfam.net', 'nX^67##sDf', 'BYEBYEGD', function(err, res) {
console.log(res);
});
Gets the list of domain transfers. Include optional params to filter the result list.
namecheap.domains.transfer.getList(function(err, res) {
console.log(res);
});
namecheap.domains.transfer.getList({ ListType: 'COMPLETED', SortBy: 'TRANSFERDATE' }, function(err, res) {
console.log(res);
});
Gets the status of a particular transfer.
namecheap.domains.transfer.getStatus(1337, function(err, res) {
console.log(res);
});
Updates the status of a particular transfer. Allows you to re-submit the transfer after releasing the registry lock.
namecheap.domains.transfer.updateStatus(1337, true, function(err, res) {
console.log(res);
});
Activates a newly purchased SSL certificate. If optional params fields are not set, values from namecheap.setDefaults
will be used.
namecheap.ssl.activate(500393, fs.readFileSync(path.join(__dirname, './mydomain.com.csr')), 'Apache + OpenSSL', 'chad@nospam.me', function(err, res) {
console.log(res);
});
namecheap.ssl.activate(500393, fs.readFileSync(path.join(__dirname, './mydomain.com.csr')), 'Apache + OpenSSL', 'chad@nospam.me', { AdminFirstName: 'Chad', ... AdminEmailAddress: 'chad@nospam.me' }, function(err, res) {
console.log(res);
});
Creates a new SSL certificate. Optionally include a the number of years or a promo code.
namecheap.ssl.create('RapidSSL', function(err, res) {
console.log(res);
});
namecheap.ssl.create('QuickSSL', 4, 'PROMOCODE', function(err, res) {
console.log(res);
});
Gets approver email list for the requested certificate.
namecheap.ssl.getApproverEmailList('smithfam.net', 'RapidSSL', function(err, res) {
console.log(res);
});
Retrieves information about the requested SSL certificate.
namecheap.ssl.getInfo(500393, function(err, res) {
console.log(res);
});
Returns a list of SSL certificates for a particular user. Include optional params to filter the result list.
namecheap.ssl.getList(function(err, res) {
console.log(res);
});
namecheap.ssl.getList({ ListType: "InProgress" }, function(err, res) {
console.log(res);
});
Parses the CSR. Optionally include the certificate type.
namecheap.ssl.parseCSR(fs.readFileSync(path.join(__dirname, './mydomain.com.csr')), function(err, res) {
console.log(res);
});
namecheap.ssl.parseCSR(fs.readFileSync(path.join(__dirname, './mydomain.com.csr')), 'RapidSSL', function(err, res) {
console.log(res);
});
Reissues an SSL certificate. If optional params fields are not set, values from namecheap.setDefaults
will be used.
namecheap.ssl.reissue(500393, fs.readFileSync(path.join(__dirname, './mydomain.com.csr')), 'Apache + OpenSSL', 'chad@nospam.me', function(err, res) {
console.log(res);
});
namecheap.ssl.reissue(500393, fs.readFileSync(path.join(__dirname, './mydomain.com.csr')), 'Apache + OpenSSL', 'chad@nospam.me', { AdminFirstName: 'Chad', ... AdminEmailAddress: 'chad@nospam.me' }, function(err, res) {
console.log(res);
});
Renews an SSL certificate. Optionally include the number of years
and/or a promo code
namecheap.ssl.renew(500393, 'QuickSSL', function(err, res) {
console.log(res);
});
namecheap.ssl.renew(500393, 'QuickSSL', 5, 'PROMOCODE', function(err, res) {
console.log(res);
});
Resends the approver email.
namecheap.ssl.resendApproverEmail(500393, function(err, res) {
console.log(res);
});
Resends the fulfilment email containing the certificate.
namecheap.ssl.resendFulfillmentEmail(500393, function(err, res) {
console.log(res);
});
Changes password of the particular user's account.
namecheap.users.changePassword('12345', 'correcthorsebatterystaple', function(err, res) {
console.log(res);
});
Sets the password of a user's account after calling namecheap.users.resetPassword.
namecheap.users.setPassword('zd8e256727d1e4c8563e014a16c1054cc', 'correcthorsebatterystaple', function(err, res) {
console.log(res);
});
Creates a new user account at NameCheap under this ApiUser. Use params
to set required address params.
namecheap.users.create('testuser', 'correcthorsebatterystaple', 'chad@nospam.me', { FirstName: 'Test', ... Phone: '+13165555555' }, function(err, res) {
console.log(res);
});
Creates a request to add funds through a credit card. Be sure your application follows these steps.
namecheap.users.createAddFundsRequest(100, 'creditcard', 'http://yourdomain.com/payments', function(err, res) {
console.log(res);
});
Gets the status of an add funds request.
namecheap.users.getAddFundsStatus('42a0c4f484c74d09a2edaasa5cb0fe28', function(err, res) {
console.log(res);
});
Gets information about fund in the user's account.
namecheap.users.getBalances(function(err, res) {
console.log(res);
});
Returns pricing information for a requested product type. Optionally include a promo code
or product category by passing an object for type
namecheap.users.getPricing('DOMAIN', function(err, res) {
console.log(res);
});
namecheap.users.getPricing({ DOMAIN: 'TRANSFER' }, 'BYEBYEGD', function(err, res) {
console.log(res);
});
Validates the username and password of accounts you created using namecheap.users.create.
namecheap.users.login('correcthorsebatterystaple', function(err, res) {
console.log(res);
});
When you call this API, a link to reset password will be emailed to the end user's profile email id.The end user needs to click on the link to reset password. Send an object for the FindBy key-value pair. Optionally include other params to customize the reset email.
namecheap.users.resetPassword({ USERNAME: 'testuser' }, function(err, res) {
console.log(res);
});
namecheap.users.resetPassword({ DOMAINNAME: 'nospam.me' }, { EmailFromName: 'mycompany.com', EmailFrom: 'admin@mycompany.com', URLPattern: 'http://mycompany.com/reset/[RESETCODE]' }, function(err, res) {
console.log(res);
});
Updates user account information for the particular user. Use params
to set required address params.
namecheap.users.update({ FirstName: 'Test', ... Phone: '+13165555555' }, function(err, res) {
console.log(res);
});
Creates a new address for the user. Use params
to set required params. Optionally include default
if it is to be the user's default address.
namecheap.users.address.create('Personal Domains', { EmailAddress: 'chad@nospam.me', ... Phone: '+13165555555' }, function(err, res) {
console.log(res);
});
namecheap.users.address.create('Work Domains', { EmailAddress: 'chad@mktgdept.com', ... Phone: '+18775555555' }, true, function(err, res) {
console.log(res);
});
Deletes the particular address for the user.
namecheap.users.address.delete(5, function(err, res) {
console.log(res);
});
Gets information for the requested address ID.
namecheap.users.address.getInfo(5, function(err, res) {
console.log(res);
});
Gets a list of address IDs and address names associated with the user account.
namecheap.users.address.getInfo(function(err, res) {
console.log(res);
});
Sets default address for the user.
namecheap.users.address.setDefault(5, function(err, res) {
console.log(res);
});
Updates the particular address of the user. Use params
to set required params. Optionally include default
if it is to be the user's default address.
namecheap.users.address.update(2, 'Personal Domains', { EmailAddress: 'chad@nospam.me', ... Phone: '+13165555555' }, function(err, res) {
console.log(res);
});
namecheap.users.address.update(5, 'Work Domains, { EmailAddress: 'chad@mktgdept.com', ... Phone: '+18775555555' }, true, function(err, res) {
console.log(res);
});
Sets the default address parameters for domain and SSL certificate registrations.
namecheap.setDefaults({ RegistrantFirstName: 'Chad', ... AuxBillingPhone: '+13165555555' });
Changes the active API username. Note: Be sure to use this before signing in or using the API as another user.
namecheap.setUsername('testuser');
See the issue tracker for more.
This project is UNLICENSED and not endorsed by or affiliated with NameCheap.