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.

GET/api/v1/domains

List all custom domains.

Scope: domains:read

Request

curl https://trimlink.co/api/v1/domains \
  -H "Authorization: Bearer tk_live_your_api_key"

Response

200Response
{
  "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

FieldTypeDescription
idstringUnique domain identifier (UUID).
domainstringThe hostname you registered.
verifiedbooleanWhether DNS verification has passed.
lastStatusstringMost recent DNS status (see status values below).
createdAtstringISO 8601 timestamp the domain was added.
POST/api/v1/domains

Add a custom domain for verification.

Scope: domains:write

Request

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

201Response
{
  "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:

  1. TXT Record - Add the verification token
  2. CNAME Record - Point to cname.trimlink.co
GET/api/v1/domains/:id

Get domain details.

Scope: domains:read

Request

curl https://trimlink.co/api/v1/domains/2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d \
  -H "Authorization: Bearer tk_live_your_api_key"

Response

200Response
{
  "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"
  }
}
POST/api/v1/domains/:id/verify

Trigger domain verification check.

Session-only. Verification mutates DNS/Vercel-managed state, so it runs from the dashboard (Domains settings) and is not available via API key. The response shape below is for reference.

Response

200Response
{
  "success": true,
  "data": {
    "id": "2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d",
    "domain": "go.example.com",
    "verified": true,
    "lastStatus": "fully_configured"
  }
}
GET/api/v1/domains/:id/status

Check domain DNS configuration status.

Scope: domains:read

Request

curl https://trimlink.co/api/v1/domains/2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d/status \
  -H "Authorization: Bearer tk_live_your_api_key"

Response

200Response
{
  "success": true,
  "data": {
    "txtConfigured": true,
    "cnameConfigured": true,
    "status": "fully_configured"
  }
}
DELETE/api/v1/domains/:id

Delete a custom domain.

Scope: domains:write

Request

curl -X DELETE https://trimlink.co/api/v1/domains/2b9d8c1a-3e4f-4a6b-8c0d-1f2e3a4b5c6d \
  -H "Authorization: Bearer tk_live_your_api_key"

Response

204 No Content

Errors

These endpoints use the standard error response format. Common domain-specific failures:

CodeWhen it happens
403Custom domains require a Teams or Enterprise plan, or the key lacks the domains:write scope.
409The domain is already registered to an account.
422The hostname is malformed, or verification was triggered before the DNS records propagated.
404No domain exists for the supplied ID.

Usage Notes

  • DNS changes can take minutes to hours to propagate. If verification returns txt_missing or cname_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

StatusDescription
pendingAwaiting DNS configuration
txt_missingTXT record not found
cname_missingCNAME record not found
fully_configuredDomain is ready to use