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:
Service domains (*.railway.app)
Create a service domain
Generate a Railway-provided domain:
Delete a service domain
Custom domains
Check domain availability
Check if a custom domain can be added:
Add a custom domain
Get custom domain status
Check DNS configuration status:
Update a custom domain
Delete a custom domain
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
| Status | Description |
|---|---|
PENDING | DNS record not yet configured |
VALID | DNS record is correctly configured |
INVALID | DNS record is configured incorrectly |
Certificate statuses
| Status | Description |
|---|---|
PENDING | Certificate is being issued |
ISSUED | Certificate is active |
FAILED | Certificate issuance failed |