CustomDomain Docs
API referenceAPI referenceNameservers

Move the domain's nameservers, with the end user's consent

Move the domain's nameservers, with the end user's consent: CustomDomain™ API reference in the nameservers group. Covers parameters, request body and responses.

POST
/connections/{id}/nameservers:migrate

Starts moving the nameservers of the connection's registrable domain (acme.com, also for shop.acme.com) to the application's DNS host, or resumes the domain's open migration with what the call brings (a key, zone_ready, skip_zone_check). 201 when a migration was created, 200 when one was resumed. The response is the migration as far as it got in this call: with a registrar key and no DNSSEC it is often already propagating or active.

Where the nameservers go is the application's nameserver_migration.target (PATCH /applications/{id}): managed (CustomDomain™ hosts the zone), dns_host (a zone we create in the platform's own DNS host account) or custom (the platform's own nameservers; the zone must already answer for the domain). For managed and dns_host the domain's records are copied first, mail included, so nothing breaks at the switch: the whole zone through the old DNS host's API when we hold a key there, else from public DNS, and then the move waits in needs_review until a person confirms the copy (copy_reviewed). An API key may pass target for managed or custom; dns_host is always the application's own account. A delegated agent token may name only the application's own target and may not send skip_zone_check (403 target_not_allowed): with a registrar account linked, nameservers an agent chose would hand it the whole domain in one call.

Where they change: at the domain's registrar (registrar), never at the DNS host because it hosts the DNS. A key, an account, a cloud browser sign in and the instructions all go to that registrar; when no registrar is known, no company is named and next_step says "where the domain is registered".

How they change (path): api, the registrar's own API with a key the customer created (credential with provider, used once and never stored, or provider_account_id, a connected account; the connection's linked account, or one at the registrar that holds the domain, is used when there is one the caller may use); agent, the cloud browser, where the end user signs in to their registrar and approves the exact nameservers (start it with POST /connections/{id}/browser:start and purpose: nameservers); manual, the person sets them with the values in next_step. There is no standard a third party can use to ask a registrar for this (Domain Connect edits records only; CDS and CSYNC need the current DNS operator and DNSSEC), so these three are the ways.

Which account: a caller uses only a connected account it may use. An API key may use the accounts an admin or an owner connected and the ones its own member connected, so a member naming another member's account (provider_account_id) is refused 403 forbidden before any migration exists, and a start or a resume that names none never takes one the caller may not use: it takes the connection's linked account, or one at the registrar that holds the domain, among the accounts the caller may use, and goes on without one when there is none (path api then answers 400). A delegated agent token may use any account of the workspace that serves the application. An app scoped token may use none: it has no member behind it, and a member can make one (a member holds app:write: they can create an application and mint such a token for it), so it names no kept account, picks none and is offered none; it moves by hand, by the cloud browser, or with a credential it sends, used once and never kept. The same rule holds for the account a resume and :rollback are given. A resume that only sets skip_zone_check, naming no account and sending no key, sends the move on to the registrar at once with the account it was started with, so it needs someone who may use that account (403 forbidden otherwise: mark the zone ready with zone_ready instead, which does not). A move on path agent keeps no account: the cloud browser changes the nameservers, so none is stored for a later move back to use. GET /connections/{id}/nameservers:offer lists exactly the accounts a caller may name.

A lost answer: a registrar's error is not taken at its word, since a timeout can come after the registrar acted. The registrar (then the registry) is read back: the nameservers asked for mean the change happened; others mean it didn't (registrar_refused); no answer leaves the move in setting with waiting_for: registrar_confirm, still possible to move back, and the next check reads back first.

DNSSEC: when the registry publishes a DS record for the domain, the nameservers do not move until it is gone and its TTL has passed, or the domain would stop resolving. With a connected account (lasting access) whose registrar API removes DS records, we remove it; otherwise the migration waits in needs_dnssec_off for the person (or the cloud browser's remove_dnssec step).

A widget token (the end user) may start a migration only when the application's nameserver_migration.mode is offer or prefer, must send consent (the id and version of the consent text the person agreed to; stored with the time, never their address), and may not send target, credential, provider_account_id, zone_ready or skip_zone_check. A delegated agent token needs domains:connect (the MCP tool also asks the person to confirm first), and moves nameservers only while the application's nameserver_migration.mode is offer or prefer: while it is off, or none was saved, every call of this route by an agent token, a start or a resume of a move a person began, is refused 403 with code ns_not_offered and changes nothing, so an agent does not retry it. A person can turn DNS hosting on in the application's settings, and the platform can still start the move for one domain with an API key, which this rule leaves as it was (so does a widget token's own refusal, a plain 403 forbidden); :rollback stays open to the agent. A credential bound to one application (a delegated agent token, a widget token) resumes only the moves of its own application: the open migration of a domain that another application of the workspace is moving answers 409, and only an API key, which spans the workspace, resumes it. A widget token starts, resumes or confirms a move, whatever its target, only on connections that are its own end user's: the call's connection and the open move's connection (a connection that names an end user is the token's when that is its end_user_ref; one that names none, only when its domain is one the token is bound to, which a token with an end_user_ref and no bound domain is not). Another end user's connection, and an open move whose connection is another end user's, or was removed and so names none, answer 403 token_wrong_end_user, and nothing is read, copied or confirmed; an end user's call never takes over such a move, and only an API key resumes one that names no connection. A widget token whose move goes to a managed zone that already exists also starts or resumes it only when the zone is that end user's (every connection linked to it is the token's, by the same rule); another end user's zone answers 409 before the move exists and nothing is linked or written. Each start, resume or move back by an agent token that changed the move is recorded in the audit log as agent.acted ("moved a domain's nameservers") under agent:<grant id>, whatever key it used; a call that only read the move leaves no row.

AuthorizationBearer <token>

Long-lived tenant API key, cd_live_… (production) or cd_test_… (staging, development), stored hashed. Keys created before the switch to cd_ start with sk_live_… / sk_test_… and are still accepted. Scoped to the owning application's tenant.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/connections/string/nameservers:migrate" \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "string",  "connection_id": "string",  "zone": "string",  "state": "pending",  "path": "api",  "target": "managed",  "dns_host": "string",  "provider": "string",  "registrar": {    "name": "string",    "provider": "string",    "iana_id": 0,    "url": "string",    "source": "rdap"  },  "old_dns_host": "string",  "old_nameservers": [    "string"  ],  "new_nameservers": [    "string"  ],  "observed_nameservers": [    "string"  ],  "waiting_for": "zone_ready",  "next_step": "string",  "next_action": {    "kind": "sign_in",    "method": "POST",    "path": "string",    "body": {}  },  "failure_code": "zone_copy_failed",  "failure_detail": "string",  "records_copied": 0,  "email_records": 0,  "email_kinds": [    "mx"  ],  "copy_source": "api",  "copy_warnings": [    "string"  ],  "copy_reviewed_at": "2019-08-24T14:15:22Z",  "ds_present": true,  "ds_removed_at": "2019-08-24T14:15:22Z",  "ds_cleared_at": "2019-08-24T14:15:22Z",  "can_rollback": true,  "rollback_path": "api",  "rollback_targets": [    "previous"  ],  "rollback_default": "previous",  "rollback_target": "previous",  "rollback_set_at": "2019-08-24T14:15:22Z",  "old_dns_serves": true,  "consent": {    "id": "string",    "version": "string",    "at": "2019-08-24T14:15:22Z"  },  "actor": "end_user",  "created_at": "2019-08-24T14:15:22Z",  "set_at": "2019-08-24T14:15:22Z",  "active_at": "2019-08-24T14:15:22Z",  "failed_at": "2019-08-24T14:15:22Z",  "rolled_back_at": "2019-08-24T14:15:22Z",  "drifted_at": "2019-08-24T14:15:22Z",  "checked_at": "2019-08-24T14:15:22Z",  "next_check_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}
{  "id": "string",  "connection_id": "string",  "zone": "string",  "state": "pending",  "path": "api",  "target": "managed",  "dns_host": "string",  "provider": "string",  "registrar": {    "name": "string",    "provider": "string",    "iana_id": 0,    "url": "string",    "source": "rdap"  },  "old_dns_host": "string",  "old_nameservers": [    "string"  ],  "new_nameservers": [    "string"  ],  "observed_nameservers": [    "string"  ],  "waiting_for": "zone_ready",  "next_step": "string",  "next_action": {    "kind": "sign_in",    "method": "POST",    "path": "string",    "body": {}  },  "failure_code": "zone_copy_failed",  "failure_detail": "string",  "records_copied": 0,  "email_records": 0,  "email_kinds": [    "mx"  ],  "copy_source": "api",  "copy_warnings": [    "string"  ],  "copy_reviewed_at": "2019-08-24T14:15:22Z",  "ds_present": true,  "ds_removed_at": "2019-08-24T14:15:22Z",  "ds_cleared_at": "2019-08-24T14:15:22Z",  "can_rollback": true,  "rollback_path": "api",  "rollback_targets": [    "previous"  ],  "rollback_default": "previous",  "rollback_target": "previous",  "rollback_set_at": "2019-08-24T14:15:22Z",  "old_dns_serves": true,  "consent": {    "id": "string",    "version": "string",    "at": "2019-08-24T14:15:22Z"  },  "actor": "end_user",  "created_at": "2019-08-24T14:15:22Z",  "set_at": "2019-08-24T14:15:22Z",  "active_at": "2019-08-24T14:15:22Z",  "failed_at": "2019-08-24T14:15:22Z",  "rolled_back_at": "2019-08-24T14:15:22Z",  "drifted_at": "2019-08-24T14:15:22Z",  "checked_at": "2019-08-24T14:15:22Z",  "next_check_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}
{  "code": "account_not_verifiable",  "title": "string",  "details": "string",  "request_id": "string",  "challenge": {    "value": "string",    "bits": 1,    "expires_at": "2019-08-24T14:15:22Z"  }}
{  "code": "account_not_verifiable",  "title": "string",  "details": "string",  "request_id": "string",  "challenge": {    "value": "string",    "bits": 1,    "expires_at": "2019-08-24T14:15:22Z"  }}
{  "code": "account_not_verifiable",  "title": "string",  "details": "string",  "request_id": "string",  "challenge": {    "value": "string",    "bits": 1,    "expires_at": "2019-08-24T14:15:22Z"  }}
{  "code": "account_not_verifiable",  "title": "string",  "details": "string",  "request_id": "string",  "challenge": {    "value": "string",    "bits": 1,    "expires_at": "2019-08-24T14:15:22Z"  }}
{  "code": "account_not_verifiable",  "title": "string",  "details": "string",  "request_id": "string",  "challenge": {    "value": "string",    "bits": 1,    "expires_at": "2019-08-24T14:15:22Z"  }}
{  "code": "account_not_verifiable",  "title": "string",  "details": "string",  "request_id": "string",  "challenge": {    "value": "string",    "bits": 1,    "expires_at": "2019-08-24T14:15:22Z"  }}
{  "code": "account_not_verifiable",  "title": "string",  "details": "string",  "request_id": "string",  "challenge": {    "value": "string",    "bits": 1,    "expires_at": "2019-08-24T14:15:22Z"  }}