Skip to main content

List domains

List the custom domains attached to an environment and their verification status.

Results are paginated and sorted by their id. When hasMore is true, send the
returned cursor to get the next page. An environment with no domains returns an
empty array, not a 404.

status: verified means the domain is verified. Unkey has configured routing and requested a
certificate. Each domain includes its full dnsRecords. Each record has a verified flag.
The flag shows which records Unkey has read back, so you can see which records are still
missing without a second call. Some providers hide a record from DNS lookups, for example a
proxied or flattened routing record. Such a record stays false while it serves traffic.

Required Permissions

Your root key must have one of the following permissions:

  • environment.*.read_domain (to read domains in any environment)
  • environment.<environment_id>.read_domain (to read domains in a specific environment)
1 min read
post/v2/domains.listDomains
Request example
Response
post/v2/domains.listDomains

Authorization

Authorizationstringheaderrequired#

Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs.
To authenticate, include the token in the Authorization header of each request:

Root keys have specific permissions attached to them, controlling what operations they can perform. Legacy permissions use tuple strings like api.*.create_key; resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:keyspaces/*#create_key.
Security best practices:

  • Keep root keys secure and never expose them in client-side code
  • Use different root keys for different environments
  • Rotate keys periodically, especially after team member departures
  • Create keys with minimal necessary permissions following least privilege principle
  • Monitor key usage with audit logs.

Body

application/json
projectstringrequired#

Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$

appstringrequired#

Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$

environmentstringrequired#

Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$

limitinteger#

The maximum number of domains one response contains.
A small limit makes the response smaller, but makes more requests necessary.

Default: 100

Range: 1–100

cursorstring#

The pagination cursor from the response that came before.
Send it to get the next page when that response has hasMore: true.

Responses

application/json
Successfully retrieved the environment's domains.
metaobjectrequired#
Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The requestId is particularly important when troubleshooting issues with the Unkey support team.
Show child attributes
requestIdstringrequired#
A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
dataobject[]required#

The domains attached to the environment, sorted by their id.
The array is empty when the environment has no domains. This is not an error.

Items: max 100

Show child attributes
idstringrequired#

Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$

domainstringrequired#
Fully qualified domain name attached to the environment.

Length: 4–253

projectIdstringrequired#
The project the domain's environment belongs to.

Length: 8–255Pattern: ^[a-zA-Z0-9_]+$

appIdstringrequired#
The app the domain's environment belongs to.

Length: 8–255Pattern: ^[a-zA-Z0-9_]+$

environmentIdstringrequired#

The environment this domain serves. Traffic to the domain reaches whatever is currently
deployed to this environment.

Length: 8–255Pattern: ^[a-zA-Z0-9_]+$

statusenum<string>required#

The verification status of the domain.

  • pending: the domain is created. No DNS check has completed yet.
  • verifying: Unkey checks the DNS records approximately each minute.
  • verified: the domain is verified. Unkey has configured routing and requested a certificate.
  • failed: the required DNS records did not appear within 24 hours. Fix the records, then retry verification.
Options:pendingverifyingverifiedfailed
verificationErrorstring#

Why the most recent verification attempt did not succeed, in plain language.
Omitted while verification is progressing normally.

Length: max 512

dnsRecordsobject[]required#

The DNS records this domain needs. Create each record at your DNS provider.
Each record has a verified flag. The flag shows whether Unkey has read that record back,
so it tells you which records are still missing.

Items: min 1

Show child attributes
typeenum<string>required#

Record type to create. ALIAS is not a real DNS record type: it means an apex-compatible
alias, which providers expose as ALIAS, ANAME, or a flattened CNAME. Apex domains cannot
hold a plain CNAME, so they receive ALIAS where a subdomain receives CNAME.

Options:CNAMEALIASTXT
namestringrequired#

Fully qualified name of the record, ready to use as-is.

Some providers want a name relative to the zone instead. Drop the zone and its trailing dot:
in zone acme.com, api.acme.com becomes api and _unkey.api.acme.com becomes
_unkey.api. A name equal to the zone itself is usually entered as @.

Length: 1–253

valuestringrequired#

The value to set on the record, exactly as given, including any prefix.
Do not trim or reformat it: verification compares the published record against this string.

Use the lowest TTL your provider allows until the domain is verified. Verification polls DNS,
so a long TTL keeps a stale value cached and can burn the verification window on a value you
have already corrected. Raise it afterwards if you want.

Length: 1–512

ttlintegerrequired#

Seconds a resolver may cache this record. Set it in your provider alongside the record's
name and value.

Range: >= 1

verifiedbooleanrequired#

Whether Unkey has read this record back with the expected value. Use it to see which
records are still outstanding.

False does not always mean the record is missing. A provider that does not expose the
published value to a DNS lookup, such as a proxied or flattened routing record, leaves
this false for as long as it serves traffic; such a domain verifies through its TXT
record instead. Always false on a domain no check has run against yet.

notestring#

What this record is for and any provider-specific caveat that applies to it.
Worth surfacing to whoever edits the DNS zone. Treat it as optional: it carries
no data the record itself needs, so a future record type may omit it.

Length: max 512

createdAtintegerrequired#
Unix timestamp in milliseconds when the domain was created. The 24 hour verification window runs from here.
updatedAtinteger#
Unix timestamp in milliseconds of the last change to this domain. Omitted if it has never changed.
paginationobjectrequired#
Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
Show child attributes
cursorstring#

Opaque pagination token for retrieving the next page of results.
Include this exact value in the cursor field of subsequent requests.
Cursors are temporary and may expire after extended periods.

Length: 1–1024

hasMorebooleanrequired#

Indicates whether additional results exist beyond this page.
When true, use the cursor to fetch the next page.
When false, you have reached the end of the result set.