
# Check a domain

Check a domain's DNS and move it on as far as its records allow. This is the one call that takes a domain from [added](/api/domains/post-domains) to serving your site. Poll it after you add the DNS records, until the domain reads `active`. Propagation can take minutes to hours.

```sh
POST https://sitepaste.com/api/v1/public/domains/{domainId}/check
```

Requires the `settings` scope.

What a check looks at depends on the domain's status:

| Status | What the check does |
|--------|---------------------|
| `pending_verification` | Looks for the verification TXT record from [add a domain](/api/domains/post-domains). When it is found, the domain moves to `pending`. The CNAME is not looked at yet. |
| `pending`, `active`, or `failed` | Checks the CNAME and the certificate, and sets the status (and its `error` note) to what it finds. A domain seen `active` for the first time starts serving your site. |

So a new domain takes at least two checks: one that proves ownership, and one or more that find the CNAME and certificate in place.

## Usage

```bash
curl -X POST "https://sitepaste.com/api/v1/public/domains/d8qjx2v7mz4r/check" \
  -H "Authorization: Bearer $TOKEN"
```

## Authorizations

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |

## Response

200 OK with the domain in the status the check left it, and its DNS setup instructions. A domain whose ownership was just proved reads `pending`. Call again until it reads `active`.

A domain of an apex and `www` pair is checked together with its other half, so both halves move together.

## Errors

| Code | Meaning |
|------|---------|
| 409 | `verification_failed`: the TXT record was not found or does not match, and the domain stays `pending_verification`. Check the DNS configuration and call again after propagation. Or `not_pending_verification`: the domain is already past verification. Call again to run the next step. |
| 429 | Too many checks of this domain. Checks are limited per domain to one every 12 seconds, with a burst of 5. |
| 400 | `{domainId}` is malformed, or the domain's certificate setup is not in place. Remove the domain and add it again. |
| 404 | The workspace has no domain with that ID. |
| 500 | The check did not complete. Retry, then re-read the domain to see where it stands. |
| 503 | `dns_lookup_failed`: the DNS lookup itself failed. Retry in a few minutes. A 503 without that code means custom domains are unavailable right now. Retry later. |