tencent cloud

APIs

CreateDnsRecord

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-11-25 16:59:58

1. API Description

Domain name for API request: teo.intl.tencentcloudapi.com.

After a site is created and accessed in NS mode, you can create DNS records through this API.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateDnsRecord.
Version Yes String Common Params. The value used for this API: 2022-09-01.
Region No String Common Params. This parameter is not required.
ZoneId Yes String Zone ID.
Name Yes String DNS record name. If it is a Chinese, Korean, or Japanese domain name, it needs to be converted to punycode before input.
Type Yes String DNS record type. Valid values:
  • A: point the domain to an external IPv4 address, for example 8.8.8.8;
  • AAAA: point the domain to an external IPv6 address;
  • MX: for email servers. If multiple MX records exist, a lower priority value indicates a higher priority;
  • CNAME: point the domain to another domain, which is then resolved to the final IP address;
  • TXT: identify and describe the domain, commonly used for domain verification and SPF records (anti-spam);
  • NS: if you need to use another DNS service provider to resolve a subdomain, an NS record needs to be added. An NS record cannot be added for the root domain;
  • CAA: specify the CA that can issue certificates for this site;
  • SRV: identify that a server uses a service, commonly used for directory management in Microsoft systems.

  • Different record types, such as SRV and CAA records, have different requirements for the host record name and record value format. For detailed descriptions and format examples of each record type, see DNS Record Type Introduction.
    Content Yes String DNS record content. Fill in the corresponding content based on the Type value. If it is a Chinese, Korean, or Japanese domain name, convert it to punycode before input.
    Location No String DNS record resolution route. If not specified, it defaults to Default, which means the default parsing route and takes effect in all regions.

    -Resolution line configuration is applicable only when Type (DNS record type) is A, AAAA, or CNAME.
    - Route parsing line configuration is applicable only to the standard and enterprise plans. For values, see Resolution Routes and Corresponding Code Enumeration.
    TTL No Integer Cache time. You can specify a range of 60–86400. A smaller value means modification records take effect faster in each region. Default value: 300. Unit: seconds.
    Weight No Integer DNS record weight. Users can specify a value range of -1 to 100. When set to 0, it means no parsing. If not specified, it defaults to -1, indicating no weight is set. Weight configuration is applicable only when Type (DNS record type) is A, AAAA, or CNAME.
    Note: For different DNS records under the same subdomain and resolution route, set weight for all of them simultaneously or leave all of them unset.
    Priority No Integer MX record priority. This parameter is valid only when Type (DNS record type) is MX. A smaller value indicates higher priority. You can specify a value from 0 to 50. If not specified, the default is 0.

    3. Output Parameters

    Parameter Name Type Description
    RecordId String DNS record ID.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Creating a DNS Record

    Create a DNS record named www.example.com with the record type A, record content 1.2.3.4, and cache time 60 seconds for the site with ZoneId zone-225qgrnvbi9w.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateDnsRecord
    <Common request parameters>
    
    {
        "ZoneId": "zone-225qgrnvbi9w",
        "Name": "www.example.com",
        "Type": "A",
        "Content": "1.2.3.4",
        "TTL": 60
    }

    Output Example

    {
        "Response": {
            "RequestId": "5e0a2b4e-df6d-4d2a-ac39-1706cbf8a707",
            "RecordId": "record-225rcy8bw85g"
        }
    }

    Example2 Creating a DNS Record with Weight Assignment

    Create a DNS record named www.example.com with the record type A, record content 1.2.3.4, cache time 60 seconds, and record weight 100 for the site with ZoneId zone-225qgrnvbi9w.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateDnsRecord
    <Common request parameters>
    
    {
        "ZoneId": "zone-225qgrnvbi9w",
        "Name": "www.example.com",
        "Type": "A",
        "Content": "1.2.3.4",
        "TTL": 60,
        "Weight": 100
    }

    Output Example

    {
        "Response": {
            "RequestId": "5e0a2b4e-df6d-4d2a-ac39-1706cbf8a707",
            "RecordId": "record-225rcy8bw85g"
        }
    }

    Example3 Creating a DNS Record with Route Parsing Assignment

    Create a DNS record named www.example.com with the record type A, resolution route Beijing (CN.BJ), record content 1.2.3.4, and cache time 60 seconds for the selected site with ZoneId zone-225qgrnvbi9w.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateDnsRecord
    <Common request parameters>
    
    {
        "ZoneId": "zone-225qgrnvbi9w",
        "Name": "www.example.com",
        "Type": "A",
        "Location": "CN.BJ",
        "Content": "1.2.3.4",
        "TTL": 60
    }

    Output Example

    {
        "Response": {
            "RequestId": "5e0a2b4e-df6d-4d2a-ac39-1706cbf8a707",
            "RecordId": "record-225rcy8bw85g"
        }
    }

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    There is no error code related to the API business logic. For other error codes, please see Common Error Codes.

    도움말 및 지원

    문제 해결에 도움이 되었나요?

    피드백