Getting Started

Quickstart

From zero to live subdomain in under 5 minutes.

1

Get your admin token

You need an ADMIN_TOKEN to authenticate against the API. Set it as an environment variable:

export TOKEN="your-admin-token-here"
2

Provision a subdomain

POST a slug and target origin. The slug must be 2–63 lowercase alphanumeric characters or hyphens, and must not be on the reserved list.

curl -X POST https://xdns.wtf/api/tenants \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "myapp",
    "target_origin": "https://myapp.vercel.app"
  }'

You'll receive:

{
  "ok": true,
  "fqdn": "myapp.xdns.wtf",
  "target_origin": "https://myapp.vercel.app"
}
3

Access your subdomain

Your subdomain is live immediately. All paths and query strings are preserved:

curl https://myapp.xdns.wtf/
# → proxied from https://myapp.vercel.app

# Paths and query strings work:
curl https://myapp.xdns.wtf/api/users?page=2
# → https://myapp.vercel.app/api/users?page=2

The Worker adds X-XDNS-Tenant: myapp to all upstream requests so your origin can identify the routing source.

4

Inspect a tenant

Verify the configuration of any active tenant:

curl https://xdns.wtf/api/tenants/myapp \
  -H "Authorization: Bearer $TOKEN"
{
  "slug": "myapp",
  "target_origin": "https://myapp.vercel.app",
  "subnet_id": null,
  "status": "active",
  "created_at": 1740600000
}
5

Remove a subdomain

When you're done, DELETE the tenant. Routing stops immediately — no DNS flush required.

curl -X DELETE https://xdns.wtf/api/tenants/myapp \
  -H "Authorization: Bearer $TOKEN"

# { "ok": true }

Tips

Subnet grouping

Pass subnet_id to group tenants. The Worker sets X-XDNS-Subnet on upstream requests when a subnet is configured.

Upsert behavior

POST is idempotent — posting the same slug twice updates the target origin. No need to DELETE first.

Reserved slugs

Some slugs are reserved (www, api, docs, etc.) and will return 400 reserved_slug. See the full list in the architecture docs.

HTTP methods preserved

POST, PUT, PATCH, DELETE — all methods are proxied. The request body is streamed directly to the upstream origin.