namecheap.domains.dns.setHosts

Important: It is recommended to use HTTP POST method when setting more than 10 hostnames.

Sets DNS host records settings for the requested domain.

NOTE: The [ ] brackets are used to represent optional values (e.g.[1...n]).Do not include the [ ] brackets in your API requests.

Request Parameters

Global parameters are not shown here for clarity, but should be present in all requests

Name Type MaxLength Required? Default Description
SLD String 70 Yes SLD of the domain to setHosts
TLD String 10 Yes TLD of the domain to setHosts
HostName[1..n] String Yes   Sub-domain/hostname to create the record for
RecordType[1..n] String   Yes   Possible values A, AAAA, CNAME, MX, MXE, TXT, URL,URL301, FRAME
Address[1..n] String   Yes   Possible values are URL or IP address. The value for this parameter is based on RecordType.
MXPref[1..n] String   Yes   MX preference for host. Applicable for MX records only.
EmailType String   No
  Possible values are MXE, MX, FWD, OX
TTL[1..n]
Number   No 1800 Time to live for all record types.Possible values: any value between 60 to 60000
NOTE: For each HostName parameter, there should be up to 127 labels (parts separated by dots), each label up to 63 charaters. The whole domain name cannot exceed 255 characters.

Example Request

http://api.namecheap.com/xml.response?apiuser=demo&apikey=d41474b94e7d4536baabb074a09c96bd&
username=demo&Command=namecheap.domains.dns.setHosts&ClientIp=122.178.155.204&SLD=domain51&TLD=com&
HostName1=@&RecordType1=URL&Address1=http://www.namecheap.com&TTL1=100&HostName2=mynewcomp
&RecordType2=A&Address2=12.56.67.78&EmailType=mxe&TTL2=1000

Example Response

<?xml version="1.0" encoding="utf-8"?>
<ApiResponse Status="OK" xmlns="http://api.namecheap.com/xml.response">
  <Errors />
  <RequestedCommand>namecheap.domains.dns.setHosts</RequestedCommand>
  <CommandResponse Type="namecheap.domains.dns.setHosts">
    <DomainDNSSetHostsResult Domain="domain51.com" IsSuccess="true" />
  </CommandResponse>
  <Server>SERVER-NAME</Server>
  <GMTTimeDifference>+5</GMTTimeDifference>
  <ExecutionTime>32.76</ExecutionTime>
</ApiResponse>

Error Codes

Specifies the error codes that might be returned from this method

Number Description
2019166 Domain not found
2016166 Domain is not associated with your account
2030166 Edit Permission for domain is not supported
3013288, 4013288 Too many records
3031510 Error From Enom when Errorcount <> 0
3050900 Unknown error from Enom
4022288 Unable to get nameserver list

Comments

Comments

Support requests, bug reports, and off-topic comments will be deleted without warning.

Please do post corrections or additional information/ pointers for this article below. We aim to quickly move corrections into the documentation. Also, your comments may take some time to appear.

If you need specific help with your account, please contact Support

close
Left side occasional ads will now show here with an option to close and don't show again.

Need help? We're always here for you.

× Close