|Docs

Manage Domains with the Public API

Here are examples to help you manage domains using the Public API.

List domains for a service

Get all domains (both Railway-provided and custom) for a service:

Variables

Service domains (*.railway.app)

Create a service domain

Generate a Railway-provided domain:

Variables

Delete a service domain

Variables

Custom domains

Check domain availability

Check if a custom domain can be added:

Variables

Add a custom domain

Variables

Get custom domain status

Check DNS configuration status:

Variables

Update a custom domain

Variables

Delete a custom domain

Variables

DNS configuration

After adding a custom domain, you need to configure DNS records. The required records are returned in the status.dnsRecords field, which includes both a routing record (CNAME / ALIAS / A) and a TXT record used to verify domain ownership. Both are required - without the TXT, the domain will not verify and requests will return a 404.

For root domains (example.com)

Add a CNAME-flattened, ALIAS, or ANAME record (depending on what your DNS provider supports) pointing to your Railway service domain, plus the TXT record returned in status.dnsRecords. Railway does not publish a static IP, so A records are not supported. See Adding a root domain for provider-specific guidance.

For subdomains (api.example.com)

Add a CNAME record pointing to your Railway service domain, plus the TXT record returned in status.dnsRecords.

DNS record statuses

StatusDescription
PENDINGDNS record not yet configured
VALIDDNS record is correctly configured
INVALIDDNS record is configured incorrectly

Certificate statuses

StatusDescription
PENDINGCertificate is being issued
ISSUEDCertificate is active
FAILEDCertificate issuance failed