Domains API
Add and manage custom domains for your short links.
Custom domains let your short links live on your own branded host (for example go.example.com) instead of trimlink.co. The Domains API mirrors the dashboard flow: you register a domain, configure two DNS records, then trigger verification. Once a domain reports fully_configured it can be used as the host for any new short link.
Domains move through a small set of status values (listed at the bottom of this page) as TrimLink polls your DNS. A domain is only usable once both the TXT verification record and the CNAME record resolve correctly.
Note: Custom domains require a Teams or Enterprise plan.
/api/v1/domainsList all custom domains.
domains:readRequest
curl https://trimlink.co/api/v1/domains \
-H "Authorization: Bearer tk_live_your_api_key"Response
{
"success": true,
"data": [
{
"id": "7a1b2c3d-4e5f-4061-8273-849506a7b8c9",
"domain": "go.example.com",
"verified": true,
"lastStatus": "fully_configured",
"createdAt": "2026-01-15T10:00:00Z"
}
]
}Domain Object Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique domain identifier (UUID). |
domain | string | The hostname you registered. |
verified | boolean | Whether DNS verification has passed. |
lastStatus | string | Most recent DNS status (see status values below). |
createdAt | string | ISO 8601 timestamp the domain was added. |
/api/v1/domainsAdd a custom domain for verification.
domains:writeRequest
curl -X POST https://trimlink.co/api/v1/domains \
-H "Authorization: Bearer tk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"domain": "go.example.com"}'Response
{
"success": true,
"data": {
"id": "2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d",
"domain": "go.example.com",
"verified": false,
"verificationToken": "a3f5d9c7e8b2...",
"txtRecordHost": "_trimlink-verification.go.example.com",
"txtRecordValue": "trimlink-verify=a3f5d9c7e8b2...",
"cnameRecordHost": "go.example.com",
"cnameRecordValue": "cname.trimlink.co"
}
}DNS Setup Required
After adding a domain, configure these DNS records:
- TXT Record - Add the verification token
- CNAME Record - Point to cname.trimlink.co
/api/v1/domains/:idGet domain details.
domains:readRequest
curl https://trimlink.co/api/v1/domains/2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d \
-H "Authorization: Bearer tk_live_your_api_key"Response
{
"success": true,
"data": {
"id": "2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d",
"domain": "go.example.com",
"verified": false,
"lastStatus": "txt_missing",
"lastCheckedAt": "2026-01-31T12:00:00Z",
"createdAt": "2026-01-31T10:00:00Z"
}
}/api/v1/domains/:id/verifyTrigger domain verification check.
Response
{
"success": true,
"data": {
"id": "2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d",
"domain": "go.example.com",
"verified": true,
"lastStatus": "fully_configured"
}
}/api/v1/domains/:id/statusCheck domain DNS configuration status.
domains:readRequest
curl https://trimlink.co/api/v1/domains/2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d/status \
-H "Authorization: Bearer tk_live_your_api_key"Response
{
"success": true,
"data": {
"txtConfigured": true,
"cnameConfigured": true,
"status": "fully_configured"
}
}/api/v1/domains/:idDelete a custom domain.
domains:writeRequest
curl -X DELETE https://trimlink.co/api/v1/domains/2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d \
-H "Authorization: Bearer tk_live_your_api_key"Response
Errors
These endpoints use the standard error response format. Common domain-specific failures:
| Code | When it happens |
|---|---|
403 | Custom domains require a Teams or Enterprise plan, or the key lacks the domains:write scope. |
409 | The domain is already registered to an account. |
422 | The hostname is malformed, or verification was triggered before the DNS records propagated. |
404 | No domain exists for the supplied ID. |
Usage Notes
- DNS changes can take minutes to hours to propagate. If verification returns
txt_missingorcname_missing, wait and retry the verify call rather than re-adding the domain. - Use the verify endpoint to trigger an on-demand check; TrimLink also re-checks pending domains periodically in the background.
- Deleting a domain does not delete the links that used it, but those links will stop resolving on the custom host once the CNAME is removed.
Domain Status Values
| Status | Description |
|---|---|
pending | Awaiting DNS configuration |
txt_missing | TXT record not found |
cname_missing | CNAME record not found |
fully_configured | Domain is ready to use |