Add, view, or remove domains for Railway services. Use when user wants to add a domain, generate a railway domain, check current domains, get the URL for a service, or remove a domain.
Add, view, or remove domains for Railway services.
Generate a railway-provided domain (max 1 per service):
railway domain --json
For a specific service:
railway domain --json --service backend
Returns the generated domain URL. Service must have a deployment.
railway domain example.com --json
Returns required DNS records:
{
"domain": "example.com",
"dnsRecords": [
{ "type": "CNAME", "host": "@", "value": "..." }
]
}
Tell user to add these records to their DNS provider.
Use railway-environment skill to see configured domains, or query directly:
query domains($envId: String!) {
environment(id: $envId) {
config(decryptVariables: false)
}
}
Domains are in config.services.<serviceId>.networking:
serviceDomains - Railway-provided domainscustomDomains - User-provided domainsUse railway-environment skill to remove domains:
{
"services": {
"<serviceId>": {
"networking": {
"customDomains": { "<domainId>": null }
}
}
}
}
{
"services": {
"<serviceId>": {
"networking": {
"serviceDomains": { "<domainId>": null }
}
}
}
}
Then use railway-environment skill to apply and commit the change.
| Flag | Description |
|---|---|
[DOMAIN] | Custom domain to add (omit for railway domain) |
-p, --port <PORT> | Port to connect |
-s, --service <NAME> | Target service (defaults to linked) |
--json | JSON output |
No service linked. Use --service flag or run `railway service` to select one.
Service already has a railway-provided domain. Maximum 1 per service.
Service has no deployment. Deploy first with `railway up`.
Invalid domain format. Use a valid domain like "example.com" or "api.example.com".