CustomDomain™ docs
API referenceConnections

Move a domain to its application's current routing, or back to the edge

retarget connection: reference page for this CustomDomain™ API operation in the connections group. Covers parameters, request body, responses and error codes.

POST
/connections/{id}:retarget

A connected domain keeps the routing it connected with when its application's routing changes (domains still waiting for DNS follow the change). This moves one: the domain's expected records become those of the application's current routing, or with {"to": "edge"} those of the CustomDomain™ edge whatever the application's routing (the way back for a domain moved off the edge by mistake). The body is optional.

The customer's DNS is not changed. A moved domain goes back to pending with a fresh verification clock, is checked at once (a domain whose DNS already names the new place is live again in the response's status), and otherwise waits for its records (returned in records); drift is not reported while it waits. Moving a live domain off the edge stops edge serving at once (stops_edge_serving).

A no-op (moved: false) when the domain already points there. Refused (409) when the domain's records are stored: records your backend supplied (change them with PUT /connections/{id}/records) or records written into the customer's DNS during setup (disconnect and reconnect to move it). A server-side API key or an agent token only: a widget token is refused (403). Recorded in the audit log as connection.retargeted.

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

curl -X POST "https://example.com/connections/string:retarget" \  -H "Content-Type: application/json" \  -d '{}'
{  "connection_id": "string",  "moved": true,  "routing": {    "mode": "edge",    "cname_target": "string",    "apex_ipv4": [      "string"    ],    "set_at": "2019-08-24T14:15:22Z"  },  "previous_routing": {    "mode": "edge",    "cname_target": "string",    "apex_ipv4": [      "string"    ],    "set_at": "2019-08-24T14:15:22Z"  },  "records": [    {      "type": "CNAME",      "host": "string",      "value": "string",      "ttl": 3600,      "priority": 0,      "applied": true,      "change": "created",      "prior": [        {          "type": "string",          "value": "string",          "ttl": 0,          "priority": 0        }      ],      "prior_source": "provider"    }  ],  "customer_action_required": true,  "stops_edge_serving": true,  "status": "pending"}
{  "code": "string",  "title": "string",  "details": "string"}
{  "code": "string",  "title": "string",  "details": "string"}
{  "code": "string",  "title": "string",  "details": "string"}
{  "code": "string",  "title": "string",  "details": "string"}
{  "code": "string",  "title": "string",  "details": "string"}