Skip to content
Runtime

How to add a custom domain to a sandbox

Run runtime domains add app.example.com <sandbox> 3000, set the TXT and CNAME records it prints, then run runtime domains verify.

On Runtime, a custom domain is included in the price. You get up to 50 per account, with HTTPS certificates from Let's Encrypt and no monthly fee (pricing checked 25 October 2026, network products). You pay only for the sandbox behind the name, from $0.03125 an hour for 2 vCPU and 4 GiB while it waits. A paused sandbox is woken by the first visit. A site that is used now and then costs running time only while it is used.

Add the name

Terminalruntime domains add app.example.com <sandbox> 3000   # prints the DNS records to setruntime domains verify app.example.com               # live once the TXT record matches
TypeScriptimport { Runtime } from "withruntime";const runtime = new Runtime();const sbx = await runtime.sandboxes.create();await sbx.spawn("python3 -m http.server 3000");const domain = await runtime.domains.add({  hostname: "app.example.com",  sandboxId: sbx.id,  port: 3000,});console.log(domain.records); // set these at your DNS providerawait runtime.domains.verify("app.example.com");
Pythonfrom withruntime import Runtimeruntime = Runtime()sbx = runtime.sandboxes.create()sbx.spawn("python3 -m http.server 3000")domain = runtime.domains.add("app.example.com", sandbox_id=sbx.id, port=3000)print(domain["records"])  # set these at your DNS providerruntime.domains.verify("app.example.com")

An agent connected through MCP uses runtime_domains with the actions add and verify.

The DNS records

Record Name Value Why
TXT _runtime-challenge.app.example.com runtime-verify=<token> Proves the name is yours
CNAME app.example.com domains.runtimehost.com Sends visitors to Runtime

A bare name such as example.com cannot hold a CNAME. Set an A record to the address the answer gives instead. The name goes live when the TXT record matches. The first visit fetches its certificate, which takes a few seconds.

Options and limits

What Detail
Price Included, up to 50 domains per account
New names 20 added a day
Certificates Let's Encrypt, issued only for names whose TXT record matched
Traffic HTTPS to one port of one sandbox; WebSockets work
Paused sandbox Woken by a visit, as a preview is
Move it Run add again; it moves before the command returns
Remove it runtime domains rm app.example.com, connections included
Who can add one Paid accounts, serving a paid sandbox

Mistakes and how Runtime handles them

  • Only the CNAME is set. A CNAME that points at Runtime proves nothing, so the name stays pending until the TXT record matches. This is on purpose. A record someone forgot to delete cannot be used to take their name.
  • The server listens on the wrong address. It must listen on 0.0.0.0 or localhost inside the sandbox. Start it with spawn, which keeps it running. A process started with exec stops when its command ends.
  • An account or a sandbox without credit. The answer is payment_required (402). Add credit and serve from a paid sandbox.
  • Two accounts claim the same name. The DNS owner wins. Whoever proves the name later takes it over, and the earlier claim ends. Each claim has its own token.
  • Over a limit. Past 50 domains, the answer is quota_exceeded (409: remove one first). Past 20 new names in a day, it is rate_limited (429) (errors).

Every response includes an X-Runtime-Report header. Runtime can take down a reported name. A reported name stays down for every account.

A domain or a preview?

A preview is the quick way to show one port. It is an address under runtimehost.com, private with a token unless you make it public. A custom domain suits a name that people type or bookmark, such as a customer's app built by an agent. To revoke preview links without changing anything else, see rotate a preview token.

For traffic that is not HTTP, such as Postgres or MQTT, open a TCP port instead.

Facts on this page were checked on 26 October 2026.

100 free hoursin your first 30 days.

of a 1 GB machine

  • No credit card
  • Four sandboxes at once, 2 vCPU and 4 GiB each
  • Then prepaid credit from $10, no plan fee
Start free, no card
Start free, no card