Add a domain
Add a custom domain to a site. The response carries the verification TXT record, the CNAME target, and setup instructions in plain language. Add the records at your DNS provider, then poll check until the domain reads active.
Apex domains automatically get a www. pair.
POST https://sitepaste.com/api/v1/public/domains
Requires the settings scope.
Usage
curl -X POST "https://sitepaste.com/api/v1/public/domains" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "domain": "www.example.com" }'
Authorizations
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token (Authorization: Bearer sp_...). Created in the dashboard under Account > Tokens. See authentication. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
| domain | string | Yes | The domain to add. |
| siteId | string | No | Target site (short ID or the literal default). Omitted, the domain goes on your default site. |
Errors
| Code | Meaning |
|---|---|
| 422 | domain is not a valid domain name; the error names the field. |
| 400 | siteId is neither a short ID nor the literal default. |
| 404 | siteId names no site in the workspace, or it was omitted and the workspace has no default site. |
| 402 | plan_required: custom domains require a Pro plan. Plain error envelope, no counts. |
| 402 | domain_limit_reached: the add would exceed paid capacity; carries the counts (see below). |
| 409 | domain_already_claimed: the domain (or its www. variant) is already claimed. |
A domain add beyond paid capacity returns 402 in the standard error envelope with the counts alongside:
{
"error": "Domain limit reached. Purchase additional domain packs to add more.",
"code": "domain_limit_reached",
"includedDomains": 1,
"domainPacks": 0,
"limit": 1,
"used": 1
}
Nothing is added when the request is refused. Additional packs are purchased in the dashboard.
Response
201 Created with the DNS records to add. Add the records, then call check.
{
"domains": [
{
"id": "d3kplm9nqrst",
"siteId": "s7k2m0dq1p3z",
"domain": "www.example.com",
"status": "pending_verification",
"verification": { "type": "TXT", "name": "_sitepaste-verify.www.example.com", "value": "sp-verify-..." },
"instructions": "Configure DNS: ...",
"cnameTarget": "cname.sitepaste.com",
"isApex": false,
"isPrimary": true,
"createdAt": "2026-08-30T12:00:00Z"
}
]
}
| Field | Type | Description |
|---|---|---|
| domains | array | The created domain records, in the shape list domains returns each entry in. Two entries for an apex domain (the apex and its www. pair), one otherwise. Each entry’s verification is the TXT record to add (type, name, value). An apex and its www. pair carry the same record, so one record covers both. |
The response sends no Location header. Read the IDs from domains; each is addressable at /domains/{domainId}.