Skip to main content

Get domain

Retrieve a custom domain and its verification status.

Address the domain by its id or by its name. Names are unique per workspace, so
api.acme.com is sufficient. You do not need to supply a project, app, or environment.

Use this endpoint to poll after domains.createDomain. Verification runs in the background
and checks DNS approximately each minute.

status: verified means the domain is verified. Unkey has configured routing and requested a
certificate. Each entry in dnsRecords has a verified flag. The flag shows which records
Unkey has read back, so you can see which records are still missing. 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. verificationError gives the reason for the last failed
attempt.

dnsRecords contains the same values that domains.createDomain returned. Use it to recover
the values without creating the domain again.

Important: verification stops 24 hours after the domain was created, and the status becomes
failed. The window starts at createdAt, not at the last attempt.

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.getDomain
Request example
Response
post/v2/domains.getDomain

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
domainstringrequired#

Identifies a domain by its Unkey ID or by its name. Pass a 'dom_'-prefixed ID, or a fully
qualified domain name such as 'api.acme.com' without a scheme, port, or path. You can give an
internationalized name in Unicode or Punycode form. Both forms address the same domain.

Domain names are unique per workspace, so the name alone addresses the domain. You do not
need to supply a project, app, or environment.

Length: 4–253

Responses

application/json
Successfully retrieved the domain.
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.
dataobjectrequired#
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.