DNS API
Read and change the DNS records of your domains from scripts, CI jobs, infrastructure as code, and certificate clients that prove domain control with DNS-01. The DNS API uses the same API keys as the domain search API.
Records can be changed only on domains whose DNS CertPing serves. A domain that uses DNS hosted elsewhere can be listed but not edited.
Getting started
- In the CertPing app, open Domains, then API keys, and select Create key.
- Under Permissions, tick DNS records: Read to read records, and Write to change them.
- Under Domains, choose the domains the key may use, or All domains, including ones added later. A key can hold up to 100 chosen domains.
- Optional: list the IP addresses or CIDR ranges your servers call from under Allowed IPs. Leave it empty for CI runners and hosted tools whose addresses change.
- Copy the key when it is shown: it starts with
cpk_live_and is shown only once.
You can later change a key's name, permissions, domains and allowed IPs with Edit, without changing its secret. The key's next request follows the new settings. If a key leaks, revoke it, or rotate it to get a new secret.
Permissions
| In the app | Permission | Allows |
|---|---|---|
| DNS records: Read | dns:read | List and read records |
| DNS records: Write | dns:edit | Create, replace and delete records |
| Sent with any DNS access | domains:read | List the domains the key covers |
| Domain search and prices | domains:search | The domain search API |
A key without the permission an endpoint needs is refused with 403 and the code PERMISSION_MISSING.
Authentication
Send the key in the Authorization header of every request. Keep it on your servers and in your secrets store: anyone holding it can do everything its permissions allow on its domains.
Authorization: Bearer cpk_live_...
Every endpoint is under https://dns-api.certping.com/api/v1/domains/token-api.
BASE=https://dns-api.certping.com/api/v1/domains/token-api
AUTH="Authorization: Bearer $CERTPING_API_KEY"
curl -X POST "$BASE/dns/zones/example.com/records" -H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"recordType": "TXT", "host": "_acme-challenge", "value": "token-from-your-acme-client", "ttl": 60}'
curl "$BASE/dns/zones/example.com/records?type=TXT&name=_acme-challenge" -H "$AUTH"
curl -X DELETE "$BASE/dns/zones/example.com/records/1001" -H "$AUTH"
GET /dns/zones
Needs domains:read. Lists the domains the key covers, ordered by name.
{
"items": [
{
"id": 42,
"name": "example.com",
"status": "ACTIVE",
"dnsProvider": "POWERDNS",
"expiresAt": "2027-03-01T00:00:00Z"
}
],
"nextCursor": null
}
dnsProviderisPOWERDNSwhen CertPing serves the domain's DNS andEXTERNALwhen it does not. Records can be changed only onPOWERDNSdomains.expiresAtisnullfor a domain registered elsewhere.- In a path,
{zone}is the domain name, with or without a trailing dot, in any case. - Your organization's domain outside the key is 403 with
ZONE_NOT_COVERED. A domain that is not your organization's, or does not exist, is 404 withZONE_NOT_FOUND. To keep a tool to fewer domains, give it a key with only those domains.
The record object
{
"id": 1001,
"recordType": "MX",
"host": "@",
"value": "mx1.example.net",
"ttl": 3600,
"servedTtl": 300,
"priority": 10,
"weight": null,
"port": null,
"caaFlag": null,
"caaTag": null,
"status": "ACTIVE",
"statusReason": null,
"systemManaged": false
}
hostis relative to the domain:@for the domain itself,wwwforwww.example.com.servedTtlis the TTL resolvers get for the record's set, the lowest TTL in the set. It isnullfor a record that was just deleted.statusisACTIVE(on the nameservers),PENDING(saved, not yet on the nameservers) orFAILED(not published;statusReasonsays why).systemManagedistruefor a record CertPing manages: the domain's own NS records, and the MX record written by email forwarding or mailboxes. These cannot be changed through the API.- Fields a record type does not use are
null, never missing. New fields may be added, so ignore fields you do not know.
GET /dns/zones/{zone}/records
Needs dns:read. Lists the domain's records in id order.
| Parameter | Description |
|---|---|
type | One record type, any case. |
name | One name: www, www.example.com or www.example.com.. The domain name itself for @. |
size | Records per page, 1 to 100. Default 50. |
cursor | The nextCursor of the previous page. |
nextCursor is null on the last page. Records added or deleted between pages do not repeat or shift the others.
GET /dns/zones/{zone}/records/{recordId}
Needs dns:read. One record, or 404 with RECORD_NOT_FOUND.
POST /dns/zones/{zone}/records
Needs dns:edit. Creates a record.
{ "recordType": "TXT", "host": "_acme-challenge", "value": "token", "ttl": 60 }
| Field | Description |
|---|---|
recordType | Upper case. One of A, AAAA, CNAME, MX, TXT, SRV, NS, CAA, HTTPS, SVCB, TLSA, SSHFP, DS, PTR, NAPTR, URI, CERT, LOC, SMIMEA, OPENPGPKEY. |
host | Required. @, a name relative to the domain, a full name inside the domain, or a full name ending in a dot. A leading * label makes a wildcard. At most 253 characters. |
value | Required, at most 4,096 characters. A and AAAA take an address; CNAME, NS, MX and SRV a host name (. for MX and SRV means no service). Send a TXT value without quotes. CAA takes at most 255 characters, without quotes. |
ttl | 60 to 86,400 seconds. Default 3,600. |
priority | Required for MX and SRV, 0 to 65,535. |
weight, port | Required for SRV, 0 to 65,535. |
caaFlag | Required for CAA, 0 to 255. |
caaTag | Required for CAA: issue, issuewild, iodef, issuemail, issuevmc, contactemail or contactphone. |
Fields a type does not use are dropped, and unknown fields are ignored. Each of these is refused with the code shown under Errors:
- No CNAME, NS or DS at
@. The domain's NS records are CertPing's, and its DS record comes from the DNSSEC setting. - A CNAME cannot share its name with any other record.
- A DS needs NS records at the same name, and cannot be a wildcard.
- An HTTPS or SVCB record in alias mode (priority 0) must be the only record of its type at its name.
- A name has at most one SPF record (
v=spf1) and one DMARC record (v=DMARC1), and each must be valid. An SPF record may need at most 10 DNS lookups, its includes counted. - The same type, name and value twice is a duplicate,
RECORD_EXISTS. A DNS-01 client can treat it as done. - A domain holds at most 1,000 records.
- While email forwarding or mailboxes receive the domain's mail, no other MX can be added at
@.
PUT /dns/zones/{zone}/records/{recordId}
Needs dns:edit. Replaces the record with the body, which has the same shape and rules as a create. The record keeps its id.
DELETE /dns/zones/{zone}/records/{recordId}
Needs dns:edit. Deletes the record.
POST /dns/zones/{zone}/records/bulk-delete
Needs dns:edit. Deletes 1 to 100 records of the domain in one change: all of them, or none.
{ "ids": [1001, 1002] }
{ "deletedIds": [1001, 1002], "status": "ACTIVE" }
If any id is not a record of the domain, nothing is deleted: 422 with RECORD_NOT_FOUND, and refusedIds names them.
Write results
A change is sent to the nameservers before it is answered.
| Endpoint | On the nameservers | Saved, not yet on them |
|---|---|---|
| Create | 201 with the record | 202 with the record, status: PENDING |
| Replace | 200 with the record | 202 with the record, status: PENDING |
| Delete | 204, no body | 202 with the deleted record, status: PENDING |
| Bulk delete | 200, status: ACTIVE | 202, status: PENDING |
A 202 change is saved and keeps being sent until it is published. Read the record, or the list for a delete, until it is ACTIVE before relying on it, for example before asking a certificate authority to check a DNS-01 record.
Records can be changed while a domain is PENDING, ACTIVE or DELEGATED. Any other status, such as expired or transferred out, is 409 with ZONE_NOT_WRITABLE. A domain whose DNS is served elsewhere is 422 with DNS_NOT_HOSTED.
Rate limits
| Limit | Value |
|---|---|
| Per source address, before the key is checked | 60 a minute. A request whose key is valid does not count. |
| Per key | 300 a minute, bursts of 100 |
| Per organization, all keys together | 1,200 a minute, bursts of 300 |
Answers carry RateLimit-Limit and RateLimit-Remaining for the key. A refused request is 429 with Retry-After, the seconds to wait. Domain availability checks have their own limit, described in the domain search API.
Errors
Every error has one shape:
{
"status": 409,
"error": "Conflict",
"code": "RECORD_EXISTS",
"message": "A TXT record at _acme-challenge.example.com with this value already exists.",
"path": "/api/v1/domains/token-api/dns/zones/example.com/records",
"timestamp": "2026-11-30T09:16:30.0889Z",
"requestId": "req-http-...",
"correlationId": "corr-http-..."
}
message is written for people and may change, so act on status and code. A refused field adds fieldErrors, such as [{"field": "value", "message": "..."}]. Quote requestId when you contact support.
| Code | Status | Meaning |
|---|---|---|
INVALID_RECORD | 400 | A field breaks its rule; fieldErrors names it. Also a bulk delete ids list outside 1 to 100. |
INVALID_REQUEST | 400 | The body is not one JSON object of the endpoint's shape, or recordId, size, cursor, type or name is invalid. |
PERMISSION_MISSING | 403 | The key lacks the permission the endpoint needs; the message names it. |
ZONE_NOT_COVERED | 403 | Your organization's domain, but not one the key covers. |
ZONE_NOT_FOUND | 404 | No domain of your organization by that name. |
RECORD_NOT_FOUND | 404, or 422 on bulk delete | No record of the domain with that id. |
ZONE_NOT_WRITABLE | 409 | The domain's status allows no changes. |
DNS_NOT_HOSTED | 422 | CertPing does not serve this domain's DNS. |
RECORD_LIMIT | 422 | The domain already has 1,000 records. |
RECORD_EXISTS | 409 | The same record is already there. |
CNAME_CONFLICT | 409 | A CNAME would share its name with another record. |
DS_WITHOUT_NS | 409 | A DS would stand where there are no NS records. |
ALIAS_NOT_ALONE | 409 | An alias-mode HTTPS or SVCB record would share its set. |
SPF_EXISTS | 409 | The name already has an SPF record; change it instead. |
DMARC_EXISTS | 409 | The name already has a DMARC record; change it instead. |
MX_OWNED_BY_FORWARDING | 409 | Email forwarding holds the domain's MX. Turn it off in the app to release it. |
MX_OWNED_BY_MAILBOXES | 409 | Mailboxes hold the domain's MX. Turn them off in the app to release it. |
SYSTEM_MANAGED | 409 | The record is managed by CertPing, such as the domain's NS records. |
RECORD_CHANGED | 409 | The record changed while the request ran. Read it again and retry. |
DNS_REFUSED | 422 | The nameservers refused the change, and it was undone. |
These errors have the same shape without a code:
| Status | Meaning |
|---|---|
| 401 | The key is missing, unknown, revoked or expired. |
| 403 | The key is used from an address outside its allowed IPs. |
| 429 | A rate limit. Wait the seconds in Retry-After. |
| 500 | Something failed on our side. Try again in a moment. |
| 503 | The key check is briefly unavailable. Try again shortly. |