API Documents

Add a Record

1. API Description

This API (Record.Create) is used to add DNS records.
Domain name for API request: https://api.dnspod.com/Record.Create
HTTP request method: POST

2. Request Parameters

The table below lists only the API request parameters. Common request parameters are required when the API is called. For more information, please see Common Request Parameters.

Parameter Required Description
domain_id Yes Domain ID.
sub_domain No Record name like www. Its default value is @.
record_type Yes Record type. You can get the list of all allowed types from the API. Use uppercase letters like A or CNAME.
record_line Yes Split zone. Its default value is default. You can get the list of split zones from the API.
value Yes Record value. For example: IP:, CNAME: cname.dnspod.com, MX: mail.dnspod.com.
mx {1-20} Yes This parameter needs to be set only when record_type is MX. Its value ranges from 1 to 20.
ttl {1-604800} Yes Time to live, which ranges from 1 to 604800. Every grade has its own minimum value.

3. Response Codes

Only the response codes related to this API are listed below. For other response codes, please see Common Return Codes.

Response Code Description
Common return code.
-15 The domain is banned.
-7 You need to upgrade the company account before this.
-8 You need to upgrade the domain you want to add.
6 A parameter is missing or a parameter error occurs.
7 You don’t have the permission.
21 The domain is locked.
22 Invalid sub_domain.
23 Exceeded the maximum number of subdomain levels allowed.
24 Invalid subdomain for general analysis.
25 Exceeded the maximum number of polls allowed.
26 Invalid split zone.
27 Invalid record type.
30 Invalid MX value.
31 Exceeded the maximum number of URL records allowed.
32 Exceeded the maximum number of NS records allowed.
33 Exceeded the maximum number of AAAA records allowed.
34 Invalid record value.
36 When sub_domain is @ and record_type is NS, record_line must be default.

4. Sample

curl -X POST https://api.dnspod.com/Record.Create -d 'login_token=730060,e1a8a$f14dc5dcbafd83680b3d2a553c4d553d&format=json&domain_id=2317346&sub_domain=@&record_type=A&record_line=default&value='

The following is a sample response:

  • JSON:
    "status": {
        "message":"Action completed successful",
        "created_at":"2012-11-23 22:17:47"
    "record": {
Last updated on 2022-03-11 02:57

DNS health check tool powered by DNSPod


Official WeChat group

Join WeChat group to chat and feedback

Scan using WeChat