Skip to the page

Guides · Shipping & operations

Custom domains

Bind your own domains to a project’s HTTPS API and file buckets with automated TLS certificates and zero-downtime cutover.

In the schema
—

What you’ll build#

This guide binds your own domain to a project’s HTTPS API (api.example.com) and to your cluster’s private and public file buckets (files.example.com and cdn.example-files.com). Napalm issues and renews every TLS certificate automatically and serves both your custom API domain and <label>.napalmdata.com during cutover so live clients never drop requests.

Domain commands require an organization manager role or an org token with manage scope, plus access to your domain’s DNS records. A custom API domain also needs a project whose cluster has a public endpoint. The commands below take the project’s name, notes.

Custom API hostname

Queries, live streams, sign-in, MCP and A2A all answer on your own HTTPS domain.

Delegated TLS renewal

A delegated ACME CNAME lets Napalm issue and renew certificates without DNS credentials.

Isolated file domains

Private signed links and permanent public asset URLs stream straight from object storage.

API domains vs file domains#

Napalm separates your project API hostname from your file storage hostnames because each serves a distinct data path. Queries, live subscriptions, sign-in and agent protocols terminate on your cluster’s stateless engines, while file uploads and downloads stream directly between clients and object storage.

TargetWhat the domain servesDNS recordsTLS and default hostname
apiProject API: /query, /subscribe (SSE and WebSockets), /sign-in, /uploads, /ask, /openapi.json, /mcp and /.well-known/agent-card.json, plus branches at https://api.example.com/branches/<branch>.DNS recordsTwo CNAME records: traffic CNAME to <label>.napalmdata.com and _acme-challenge CNAME to _acme-challenge.<label>.api.napalmdata.com.TLS and default hostnameDNS-01 TLS issued and renewed automatically. <label>.napalmdata.com stays on the same certificate and keeps serving.
filesPrivate file bucket: presigned file_url and file_download_url links for private ext::files::File records (file_is_public = false).DNS recordsOne CNAME record pointing at the private bucket target shown in napalm domains ls notes or the console.TLS and default hostnameManaged TLS issued once the CNAME resolves. Signed download links switch to your domain automatically.
publicPublic file bucket: permanent unsigned file_url and file_download_url links for public ext::files::File records (file_is_public = true).DNS recordsOne CNAME record pointing at the public bucket target shown in napalm domains ls notes or the console.TLS and default hostnameManaged TLS issued once the CNAME resolves. Use a dedicated asset domain so uploads never share cookies with your app.

Attach a custom API domain#

Register the custom API domain first with --no-check so Napalm reserves the hostname and prints the two CNAME targets. If your cluster has not claimed a <label>.napalmdata.com subdomain yet, pass --label <label> when adding your first API domain (for example napalm domains add notes api api.example.com --label notes --no-check).

Terminal
# Register the custom API domain (--label claims <label>.napalmdata.com on first setup)napalm domains add notes api api.example.com --no-check # After adding both CNAME records at your DNS provider, verify DNS and issue TLSnapalm domains check notes

In the web console, open your project, select the Access and agents tab, find Custom domains and enter api.example.com. Add both CNAME records at your DNS provider, then click Check domain (or run napalm domains check notes).

TypeNameTargetProxy and TTL
CNAMEapi.example.comTarget<label>.napalmdata.comProxy and TTLDNS only (HTTP proxy off), 300 s TTL
CNAME_acme-challenge.api.example.comTarget_acme-challenge.<label>.api.napalmdata.comProxy and TTLDNS only (HTTP proxy off), 300 s TTL

Four DNS details keep initial verification, streaming connections and background renewals trouble-free.

Turn off DNS HTTP proxying
Keep proxy and CDN interception off (such as DNS-only gray-cloud mode in Cloudflare) on both CNAME records. Client connections must reach your cluster’s engines directly for TLS termination, HTTP/2, SSE streaming and long-lived /subscribe WebSockets, and DNS resolvers must follow _acme-challenge straight to the validation TXT record.
Keep _acme-challenge in place
Leave the _acme-challenge CNAME record permanently in DNS. Napalm renews certificates automatically 30 days before expiry through that delegated record without storing credentials for your DNS zone. If either record is missing at renewal, the domain goes back to waiting for its records and the project advertises <label>.napalmdata.com again. A nightly check attaches the domain once both records resolve.
Apex domains and CNAME flattening
Use a subdomain such as api.example.com whenever possible. If your DNS provider flattens CNAME, ALIAS or ANAME records into A and AAAA answers, Napalm accepts matching cluster IP answers on the traffic record while _acme-challenge stays a standard CNAME.
CAA records
If your parent zone publishes CAA records, allow letsencrypt.org (0 issue "letsencrypt.org") so Let’s Encrypt can issue and renew certificates for the hostname.

Update sign-in, CORS and agents#

Once api.example.com reaches serving, your cluster’s TLS certificate covers both api.example.com and <label>.napalmdata.com. Deployed mobile apps, open browser tabs and backend workers still calling https://<label>.napalmdata.com keep working with zero downtime. At the same time, GET /projects/{id}/endpoint, GET /sign-in, /openapi.json, /mcp and /.well-known/agent-card.json advertise https://api.example.com (and https://api.example.com/branches/<branch> on preview branches).

External OAuth callbacks
Before switching client traffic over, add https://api.example.com/sign-in/callback to Google, GitHub, Microsoft, Discord, Slack and any custom OIDC provider alongside your existing https://<label>.napalmdata.com/sign-in/callback entry. Keeping both callback URLs registered lets in-flight and older app builds complete OAuth sign-in cleanly.
allowedOrigins vs API domain
allowedOrigins lists up to 32 browser origins where your frontend web app runs (for example https://app.example.com), whereas api.example.com is the API address passed to new NapalmClient('https://api.example.com'). Only add an origin to allowedOrigins when browser pages on that origin call Napalm.
Post-login redirect URLs
napalm sign-in set --redirect lists the frontend pages or mobile app schemes where Napalm sends users after sign-in completes (such as https://app.example.com/signed-in), separate from the /sign-in/callback URL registered at OAuth providers.
MCP and A2A clients
napalm mcp notes picks up the new advertised endpoint automatically through the Control API. Update any hard-coded /mcp or /.well-known/agent-card.json URLs in external agent configurations at your own pace.
Terminal
# Allow browser CORS requests from your frontend web app originnapalm endpoint notes --allow-origin https://app.example.com # Allow post-login redirects back to your frontend callback pagenapalm sign-in set notes --redirect https://app.example.com/signed-in # Inspect the advertised API URL and active sign-in settingsnapalm endpoint notesnapalm sign-in show notes

Point your application’s SDK and SignIn client at https://api.example.com in your next deploy.

src/napalm.ts
import { NapalmClient, SignIn, webStore } from 'napalm-client' const signIn = new SignIn('https://api.example.com', {  redirectUrl: 'https://app.example.com/signed-in',  store: webStore(),}) export const napalm = new NapalmClient('https://api.example.com', {  token: signIn.token,})

Attach custom file domains#

You can also bind custom domains to your cluster’s public (public) and private (files) object storage buckets from the CLI or under Custom file domains on the cluster’s page in the console. Each file bucket domain uses a single CNAME record pointing at the bucket target printed by napalm domains ls.

Terminal
# Provision file storage if the cluster has no file buckets yetnapalm storage enable notes files --label notes # Register custom domains for public and private file bucketsnapalm domains add notes public cdn.example-files.com --no-checknapalm domains add notes files files.example.com --no-check # Inspect the bucket CNAME targets, then verify once DNS records resolvenapalm domains ls notesnapalm domains check notes

Once a bucket domain reaches serving, selecting file_url or file_download_url on Ready file records returns URLs on your custom domain automatically without re-uploading objects. Public files return permanent https://cdn.example-files.com/… URLs, and private files return presigned https://files.example.com/… URLs signed once in each 1-hour window and valid for 6 hours. See Files & object storage for schema declarations and upload verification.

Move or retire a domain safely#

Before retiring a custom API domain, deploy client updates pointing back to https://<label>.napalmdata.com (or attach and cut over to a replacement custom API domain first). Retiring the domain with napalm domains remove or POST /projects/{id}/domains/{host}/retire reverts the project’s advertised endpoint URL to https://<label>.napalmdata.com right away. The cluster’s certificate drops the retired hostname at its next renewal.

Terminal
# Retire the custom API domain and revert the advertised URL to <label>.napalmdata.comnapalm domains remove notes api.example.com

A custom hostname can belong to only one active or pending project or bucket across Napalm (409 host_taken otherwise). To move a hostname to another project, retire the domain on the original project first, update the CNAME records to the destination cluster’s <label> targets and run napalm domains add on the destination cluster.

Check your custom domains#

  1. Confirm every domain is serving

    Run napalm domains ls notes and verify each API and file bucket domain shows serving with no pending DNS warning.

  2. Verify TLS and advertised endpoint metadata

    Run the curl checks below to confirm TLS terminates cleanly on your custom API domain and /openapi.json and /sign-in advertise https://api.example.com.

  3. Exercise sign-in, live streams and file links

    Sign in from your production frontend origin, confirm an OAuth callback completes without error and verify a live subscription and file download succeed over your custom domains.

Terminal
# Confirm every API and file bucket domain reports servingnapalm domains ls notes # Verify TLS termination and check the advertised OpenAPI and sign-in metadatacurl -fsSI https://api.example.com/openapi.jsoncurl -fsS https://api.example.com/sign-in

Troubleshooting#

SymptomCauseFix
Domain stays in Waiting for the DNS recordOne or both CNAME records have not propagated yet, or DNS HTTP proxying rewrites the answer.FixCheck dig CNAME api.example.com +short and dig CNAME _acme-challenge.api.example.com +short, disable HTTP proxying and run napalm domains check notes.
Certificate validation times out_acme-challenge is missing or proxied, or a parent CAA record blocks Let’s Encrypt.FixVerify _acme-challenge points at _acme-challenge.<label>.api.napalmdata.com unproxied and allow 0 issue "letsencrypt.org" in your zone’s CAA records, then re-run napalm domains check notes.
409 host_taken when adding a domainThe hostname is already bound to or awaiting verification on another project or file bucket.FixRetire the domain on the other project with napalm domains remove before adding the hostname to this project’s cluster.
400 invalid_request when adding a domainThe hostname sits under napalmdata.com or napalmcontent.com, or the project’s cluster has a private endpoint.FixUse a hostname in a zone you control. Give the cluster a public endpoint before adding a custom API domain.
OAuth login fails with redirect_uri_mismatchThe OAuth provider only lists the <label>.napalmdata.com callback URL.FixAdd https://api.example.com/sign-in/callback to the provider’s authorized redirect URIs alongside https://<label>.napalmdata.com/sign-in/callback.
Browser requests fail with 403 forbidden or CORS errorsYour frontend web origin is missing from allowedOrigins.FixRun napalm endpoint <project> --allow-origin https://app.example.com (allowedOrigins lists your frontend app’s origin rather than api.example.com).

Type a word or two to search every docs page.