DNS Centerdesk manual

Using the API

Manage your DNS records from your own scripts and servers. Everything you can do in the console's DNS pages, you can do here.

Signed in, you can download this guide as a Markdown file (apidns.md).

1. Getting started

  1. Make sure you have access to the DNS console (see Requesting access).
  2. In the console, go to API keys and make a key for the public IP address your script connects from (see API keys).
  3. Store the key safely, for example in an environment variable. Never put it in code that ends up in a repository.

2. Authentication

Send the key in the Authorization header:

Authorization: Bearer cdk_xxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In the examples below:

export CDKEY='cdk_...'      # your key
export API=https://api.centerdesk.nl

3. Who am I: GET /v1/me

A quick check that your key works.

curl -s "$API/v1/me" -H "Authorization: Bearer $CDKEY" -H "Accept: application/json"
{
  "data": {
    "id": "6f1c0d8e-8a51-4c57-9b3e-2d1f0a7e5b11",
    "name": "Acme BV",
    "slug": "acme-x1y2",
    "zones": 1
  }
}

4. Your domains: GET /v1/zones

What you may change, and within which limits. Read this before you write; you never have to discover a limit by running into it.

curl -s "$API/v1/zones" -H "Authorization: Bearer $CDKEY" -H "Accept: application/json"
{
  "data": [
    {
      "zone": "example.nl",
      "covers": "*.shop.example.nl and shop.example.nl",
      "scope": "subtree",
      "label": "shop",
      "types": ["A", "AAAA"],
      "allowed_targets": ["217.154.204.53/32"],
      "ttl": { "min": 300, "max": 86400 },
      "records": { "used": 2, "limit": 25 },
      "writable": true,
      "expires_at": null,
      "role": "full"
    }
  ]
}
coversThe names you may use: subtree = a name and everything under it, exact = only that one name, zone = every name in the domain.
allowed_targetsAddresses and ranges your records may point to.
writablefalse: the domain is not yet hosted at the provider; writes are refused.
roleWhat this key may do here: read, create or full. With create, below holds the name it may add below (e.g. test.example.nl: adds a.test.example.nl), and it changes and deletes only its owner's records there.

5. Listing records

GET /v1/zones/{zone}/records gives the records you made in that domain. GET /v1/zones/{zone}/records/{id} gives one.

curl -s "$API/v1/zones/example.nl/records" -H "Authorization: Bearer $CDKEY" -H "Accept: application/json"
{
  "data": [
    {
      "id": "0b6a3a0e-8b35-4d6e-9d0f-2a4c5e6f7a8b",
      "name": "app.shop.example.nl",
      "type": "A",
      "value": "217.154.204.53",
      "ttl": 3600,
      "status": "active",
      "applied_at": "2026-09-30T10:12:44+00:00",
      "created_at": "2026-09-30T10:12:43+00:00"
    }
  ]
}

This lists only the records made through the console or the API.

Add ?all=1 to see every record within the names you were given, as the DNS provider serves them. That includes records Centerdesk made, and for a whole domain also the domain itself (MX, TXT and so on). Your own have an id and "editable": true. The others have "id": null, "editable": false and the reason in locked; they cannot be changed through the API. prio is set for MX and SRV records. If the provider cannot be reached, you get your own records with "complete": false.

curl -s "$API/v1/zones/example.nl/records?all=1" -H "Authorization: Bearer $CDKEY" -H "Accept: application/json"

6. Creating a record: POST /v1/zones/{zone}/records

FieldRequiredMeaning
nameyesThe name without the domain (app.shop), or in full (app.shop.example.nl).
typenoA (default), AAAA, CNAME or TXT, as far as your types allow.
valueyesA/AAAA: the IPv4 or IPv6 address. CNAME: a host name (shop.example.com). TXT: up to 255 printable characters on one line, without double quotes.
ttlnoSeconds, default 3600, within the domain's TTL range.
curl -s -X POST "$API/v1/zones/example.nl/records" \
  -H "Authorization: Bearer $CDKEY" -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{"name": "app.shop", "type": "A", "value": "217.154.204.53", "ttl": 3600}'

Answer: 201 with the new record, including its id. Keep that id to change or delete the record later.

Did the call time out? Do not blindly try again: first list your records (section 5). A create for a name that already exists is refused with 409 name_in_use, so a retry never gives you two records, but you do want to know which of your attempts landed.

7. Changing a record: PATCH /v1/zones/{zone}/records/{id}

Send only what changes: value and/or ttl. The name and type of a record never change; for that, delete it and make a new one.

curl -s -X PATCH "$API/v1/zones/example.nl/records/0b6a3a0e-8b35-4d6e-9d0f-2a4c5e6f7a8b" \
  -H "Authorization: Bearer $CDKEY" -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{"value": "217.154.204.54", "ttl": 600}'

Answer: 200 with the changed record.

8. Deleting a record: DELETE /v1/zones/{zone}/records/{id}

curl -s -X DELETE "$API/v1/zones/example.nl/records/0b6a3a0e-8b35-4d6e-9d0f-2a4c5e6f7a8b" \
  -H "Authorization: Bearer $CDKEY" -H "Accept: application/json"
{ "data": { "id": "0b6a3a0e-8b35-4d6e-9d0f-2a4c5e6f7a8b", "status": "deleted" } }

9. History: GET /v1/changes

The latest changes for your organisation, newest first. Optional ?limit= from 1 to 200 (default 50).

curl -s "$API/v1/changes?limit=20" -H "Authorization: Bearer $CDKEY" -H "Accept: application/json"
{
  "data": [
    {
      "id": "…",
      "zone": "example.nl",
      "action": "update",
      "name": "app.shop.example.nl",
      "type": "A",
      "from": { "value": "217.154.204.53", "ttl": 3600 },
      "to": { "value": "217.154.204.54", "ttl": 600 },
      "status": "applied",
      "error": null,
      "applied_at": "2026-09-30T10:20:01+00:00",
      "created_at": "2026-09-30T10:20:00+00:00"
    }
  ]
}

10. Rules

Every write is checked against these rules, in the API itself. The console applies exactly the same ones.

11. Errors

An error has this shape, with a sentence you can show to a person:

{ "error": "outside_grant", "message": "www.example.nl is outside your names. You hold: *.shop.example.nl and shop.example.nl." }

Field errors (422) come as {"message": …, "errors": {"field": ["…"]}}.

StatuserrorMeaning and what to do
401unauthenticatedKey missing, wrong, or revoked.
401key_disabledThe key was revoked or not used for 60 days. Make a new one.
403ip_not_allowedCalled from another IP address than the key's.
403https_requiredCalled over plain HTTP. Replace the key: it crossed the network unencrypted.
403role_forbidsYour role in this domain does not allow this (for example read-only).
403outside_grantThe name is outside the names assigned to you.
404–Unknown domain or record, or a domain you have no access to.
409name_in_useSomething is already published at that name.
409record_limit_reachedYou have the maximum number of records for that name.
409zone_driftedThe record was changed outside the API. Contact Centerdesk.
409zone_not_managedThe domain is not yet hosted at the provider (writable: false).
409zone_busyAnother change to the domain is in progress. Try again in a few seconds.
422reserved_nameA reserved name, or one starting with an underscore.
422apex_not_writableThe domain itself cannot be changed.
422type_not_allowedA record type other than those in types.
422target_not_allowedThe address is outside allowed_targets.
422ttl_out_of_rangeTTL outside the allowed range.
429–Too many requests. Wait the number of seconds in the Retry-After header.
502–The DNS provider did not respond or refused. Check the record list before trying again.

12. Limits

13. Example: keep a record up to date

A small shell script that points app.shop.example.nl at an address, and only changes it when needed. It uses curl and jq.

#!/bin/sh
set -eu
API=https://api.centerdesk.nl
ZONE=example.nl
FQDN=app.shop.example.nl
WANT=217.154.204.54
AUTH="Authorization: Bearer $CDKEY"

record=$(curl -sf "$API/v1/zones/$ZONE/records" -H "$AUTH" -H "Accept: application/json" \
  | jq -c --arg n "$FQDN" '.data[] | select(.name == $n and .type == "A")')

if [ -z "$record" ]; then
  curl -sf -X POST "$API/v1/zones/$ZONE/records" -H "$AUTH" -H "Accept: application/json" \
    -H "Content-Type: application/json" -d "{\"name\": \"$FQDN\", \"value\": \"$WANT\"}"
elif [ "$(echo "$record" | jq -r .value)" != "$WANT" ]; then
  id=$(echo "$record" | jq -r .id)
  curl -sf -X PATCH "$API/v1/zones/$ZONE/records/$id" -H "$AUTH" -H "Accept: application/json" \
    -H "Content-Type: application/json" -d "{\"value\": \"$WANT\"}"
fi

Questions about the API? Contact Centerdesk.