MagicWP Docs
Domains

Add and verify custom domain

POST
/v1/sites/{site_id}/domains

Permission: domains.manage

Authorization

apiToken
headerAuthorizationBearer <token>

An API token (mwp_…) from Settings → API tokens. Only accepted on this host.

Path Parameters

site_id*Site Id
Formatuuid

Header Parameters

Idempotency-Key?string

Any unique string up to 255 characters. Retrying with the same key returns the first request's stored response (header Idempotent-Replayed: true) instead of doing it again, for 24 hours. The same key with a different request is refused (idempotency_key_reused).

Length1 <= length <= 255

Request Body

application/json
  1. body
domain*Domain

Custom domain (e.g. blog.example.com)

Length4 <= length <= 255
defer_verification?Defer Verification

Create the domain in pending and hand back the records to add, instead of refusing a domain whose DNS is not in place yet. Verify it later with POST /domains/{id}/verify.

Defaultfalse

Response Body

Successful Response

application/json
  1. response
success*boolean
data*

The result; on an error, details such as code and permission.

message*string
status_code*integer
timestamp*string
Formatdate-time
meta?|null
curl -X POST "https://example.com/v1/sites/497f6eca-6276-4993-bfeb-53cbbbba6f08/domains" \  -H "Content-Type: application/json" \  -d '{    "domain": "string"  }'
{  "message": "string",  "status_code": 0,  "timestamp": "2019-08-24T14:15:22Z",  "meta": {},  "success": true,  "data": {    "domain": {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",      "site_id": "72771e6a-6f5e-4de4-a5b9-1266c4197811",      "domain": "string",      "base_domain": "string",      "verification_token": null,      "status": "string",      "is_connected": true,      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z"    },    "verification": {      "method": null,      "details": null,      "message": null    },    "records": [      {        "type": "CNAME",        "name": "string",        "value": "string",        "ttl": "string"      }    ]  }}