Domains

BASE  https://api.rii.link/v1AUTH: BEARER → AUTHENTICATION

A domain is a host you connect through this API and route API links through. Connect it, set two DNS records, and verification flips on its own. Links can go onto it before that — they wait, staged, and go live with the domain.

POST/v1/domains

Connect a domain

Returns the two DNS records to set — copy the values exactly as returned. Status starts at pending_dns and flips automatically — see below. You can create links on it right away; they are staged until it is active.

PARAMETERS
hoststringREQUIRED

The fully-qualified host, e.g. go.example.com.

include_wwwboolean

Also connect the www ↔ apex twin (www.example.com for example.com, or the other way round). It 301-redirects to host and is free: it does not count toward your plan’s custom domains. Defaults to false. See below.

REQUEST
curl -X POST https://api.rii.link/v1/domains \
-H "Authorization: Bearer $RII_KEY" \
-H "Content-Type: application/json" \
-d '{ "host": "go.example.com" }'
RESPONSE · 201
{
"id": "dom_4kq2mR7vTx0bWn3sLc5hYA",
"host": "go.example.com",
"status": "pending_dns",
"records": [
{ "type": "CNAME", "name": "go.example.com", "value": "‹routing target›" },
{ "type": "TXT", "name": "_rii.go.example.com", "value": "rii-verify=7f3a…" }
],
"links": 0,
"staged_links": 0,
"created_at": "2026-08-12T09:14:03Z",
"updated_at": "2026-08-12T09:14:03Z"
}
GET/v1/domains

List domains

Every domain connected through this API, with status and link count. links tells you what a disconnect would break; staged_links counts the links still waiting for the domain to go active (0 once it is).

REQUEST
curl https://api.rii.link/v1/domains \
-H "Authorization: Bearer $RII_KEY"
RESPONSE · 200
{
"data": [
{
"id": "dom_4kq2mR7vTx0bWn3sLc5hYA",
"host": "go.example.com",
"status": "active",
"records": [ … ],
"links": 214,
"staged_links": 0,
"created_at": "2026-08-12T09:14:03Z",
"updated_at": "2026-08-12T09:20:11Z"
}
]
}
GET/v1/domains/{id}

Retrieve a domain

One domain, the same shape as a list entry. Poll it during a migration: staged_links is how many imported links are waiting on DNS.

REQUEST
curl https://api.rii.link/v1/domains/dom_4kq2mR7vTx0bWn3sLc5hYA \
-H "Authorization: Bearer $RII_KEY"
RESPONSE · 200 (MID-MIGRATION)
{
"id": "dom_4kq2mR7vTx0bWn3sLc5hYA",
"host": "go.example.com",
"status": "pending_dns",
"records": [ … ],
"links": 50000,
"staged_links": 50000,
"created_at": "2026-08-12T09:14:03Z",
"updated_at": "2026-08-12T09:14:03Z"
}

How verification flips

We re-check DNS every minute; status turns active once both records resolve and the certificate is issued. It is polling, not a callback — nothing to expose on your side; outbound webhooks are roadmap, dated on their own page. Staged links need nothing either: they were already loaded into routing, so they answer as soon as the domain does.

NO ACTION NEEDED AFTER THE RECORDS ARE SET — THE FLIP IS AUTOMATIC

www and the bare domain

Connect example.com with "include_www": true and www.example.com comes along: every request to it gets a 301 to example.com, path and query kept, so you never create a link twice. The domain you send as host is the one that holds the links. The response names the twin in www_redirect and lists its routing record in records with "required": false: set it for the redirect to work, but the domain goes active without it. If the name can’t pair up (go.example.com has no www twin) or the twin is already connected somewhere, the domain is connected alone and www_redirect is null. Test keys never add one. A twin added or removed later in the dashboard shows up here too.

FREE ON EVERY PLAN · THE TWIN NEVER COUNTS AS A CUSTOM DOMAIN

REQUEST
curl -X POST https://api.rii.link/v1/domains \
-H "Authorization: Bearer $RII_KEY" \
-H "Content-Type: application/json" \
-d '{ "host": "example.com", "include_www": true }'
RESPONSE · 201 (WITH THE WWW TWIN)
{
"id": "dom_9Tq3nX8wRb2kLm5vYc0sHA",
"host": "example.com",
"status": "pending_dns",
"records": [
{ "type": "A", "name": "example.com", "value": "‹routing address›", "required": true },
{ "type": "AAAA", "name": "example.com", "value": "‹routing address›", "required": false },
{ "type": "TXT", "name": "_rii.example.com", "value": "rii-verify=2c9e…", "required": true },
{ "type": "CNAME", "name": "www.example.com", "value": "‹routing target›", "required": false }
],
"links": 0,
"staged_links": 0,
"www_redirect": "www.example.com",
"created_at": "2026-10-14T09:14:03Z",
"updated_at": "2026-10-14T09:14:03Z"
}
DELETE/v1/domains/{id}

Disconnect a domain

Refused with 409 domain_in_use while links still resolve on the host. Move or delete them first, or force it and accept the breakage consciously. Disconnecting a domain also disconnects its www twin.

PARAMETERS
forceboolean

Query param. Deletes the links on the host (slugs quarantined 30 days), then disconnects.

REQUEST
curl -X DELETE https://api.rii.link/v1/domains/dom_4kq2mR7vTx0bWn3sLc5hYA \
-H "Authorization: Bearer $RII_KEY"
RESPONSE · 409 (LINKS STILL LIVE)
{
"error": {
"code": "domain_in_use",
"message": "214 links still resolve on go.example.com.",
"doc_url": "https://rii.link/docs/api/errors#domain_in_use"
}
}