Domains
Add your customers' hostnames, read the record each one needs and where it stands, re-check it, remove it.
Base URL https://api.apexly.dev. Send your key as Authorization: Bearer sk_live_… or sk_test_…; the examples read it from APEXLY_API_KEY.
Create a connect session (embeddable widget)
POST/v1/domains/{id}/connect-sessions
Mints a short-lived token for the embeddable connect flow (widget.js, @apexly/react). Call it from your server with your API key, then hand only the token to the browser: it opens this one domain's connect flow (records, status, Check again) and nothing else, never other domains, the API, or email notifications. ttl is 60 to 86400 seconds, default 3600. Another app's domain, a deleted or expired one is 404. 300 per minute per app (429 rate_limited).
Path parameters
| Field | Type | Description |
|---|---|---|
id | string |
Body
| Field | Type | Description |
|---|---|---|
ttl | integer | Seconds the token works for: 60 to 86400 (24 h), default 3600 (1 h). 60 to 86400. |
Response
201 Created. Errors use the error envelope.
| Field | Type | Description |
|---|---|---|
token | string | cs_… Pass it to Apexly.mount() or <ApexlyConnect> in the browser. Opens this one domain only. |
expires_at | string | ISO 8601. After this the widget says the link no longer works. |
url | string | The embeddable page itself (what the widget frames). |
Example
curl -X POST https://api.apexly.dev/v1/domains/dom_01J9X8T4Q5M6N7P8R9S0V1W2X3/connect-sessions \
-H "Authorization: Bearer $APEXLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Add a domain
POST/v1/domains
201 with the new domain in pending_dns, or 200 with the existing one when the app already has this hostname (idempotent on app + hostname; an expired one is re-added: back to pending_dns with the same connect link and a fresh 72 h window). The mode comes from the key: test keys create test domains, which never contact a CA. 422 invalid_hostname, hostname_is_apexly, hostname_is_public_suffix, hostname_held, domain_limit_reached (live domains at the plan hard cap: 20 on Free (and on the retired Free promotional license), 20,000 on Pay as you go; error.status_detail lists { plan, trial, used, limit, hostname, plans[] } that fit one more. New accounts: 10 in the first 24 hours), origin_not_allowed, validation_failed (metadata over 4 KB, apex_redirect on a subdomain, hostname already in the app in the other mode). origin needs a paid plan; Free ignores it and the response carries warnings. A new live domain also gets a quick preflight (at most 2 seconds, never a failure): warnings cloudflare_proxy, apex_records_elsewhere, caa_blocks_issuance or origin_unreachable name what will stop it going live.
Body
| Field | Type | Description |
|---|---|---|
hostname | string | Required. The customer's hostname, e.g. careers.acme.com (Unicode is encoded). At most 1024 characters. |
origin | string | null | Per-domain origin override (paid plans; Free: ignored with a warning). At most 2048 characters. |
metadata | object | null | Any JSON object, at most 4 KB; returned on every domain object and event. |
origin_headers | object | null | Headers the edge adds to every request for this domain, e.g. {"X-Tenant-Id": "42"} (at most 5; X- names, not X-Apexly-, X-Forwarded- or X-Real-IP; printable values up to 256 characters). A visitor's own copy of each header is removed first; trust them only on requests whose X-Apexly-Signature verifies. |
apex_redirect | string | Apex domains only: also serve www.<apex> and redirect it (default: the app's apex_redirect_default). One of none, www. |
Response
200 OK: the hostname already exists in this app · 201 Created. Errors use the error envelope.
| Field | Type | Description |
|---|---|---|
id | string | dom_… |
hostname | string | Lowercase ASCII (punycode). |
status | string | One of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted. |
status_reason | string | null | Machine code when status is not active, e.g. dns_record_mismatch. |
status_detail | object | null | { expected, found, hint }. |
is_apex | boolean | |
mode | string | From the key that created it; test domains never contact a CA. One of live, test. |
dns | object | Record names are relative to the registrable domain (e.g. "careers" in acme.com). |
dns.cname | object | Subdomains: the one record to add. |
dns.cname.name | string | |
dns.cname.value | string | |
dns.apex | object | Apex domains: A (and AAAA) records plus the _apexly TXT record. |
dns.apex.a | string[] | |
dns.apex.aaaa | string[] | |
dns.apex.txt | object | |
dns.apex.txt.name | string | |
dns.apex.txt.value | string | |
origin | string | null | Origin override, or null for the app origin. |
apex_redirect | string | One of none, www. |
connect_url | string | The page the customer opens to connect the domain. |
certificate | object | null | |
certificate.issuer | string | |
certificate.not_before | string | |
certificate.not_after | string | |
certificate.renews_at | string | |
metadata | object | null | |
origin_headers | object | null | Headers the edge adds to every request for this domain, or null. |
created_at | string | |
updated_at | string | |
last_checked_at | string | null | |
next_check_at | string | null | |
warnings | object[] | Present when part of the request was ignored (plan_required) or, on create, when the preflight found what will stop the domain going live: cloudflare_proxy, apex_records_elsewhere, caa_blocks_issuance, origin_unreachable. |
warnings[].code | string | |
warnings[].message | string |
Example
curl -X POST https://api.apexly.dev/v1/domains \
-H "Authorization: Bearer $APEXLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"hostname":"careers.acme.com"}'List domains
GET/v1/domains
Newest first (created_at desc), cursor-paginated: pass next_cursor as cursor. Filters: status, hostname (prefix), metadata.<key>=<value> (string equality on a top-level key, up to 5).
Query parameters
| Field | Type | Description |
|---|---|---|
status | string | One of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted. |
hostname | string | Hostname prefix. At most 253 characters. |
limit | integer | Default 50. 1 to 100. |
cursor | string | next_cursor of the previous page. At most 200 characters. |
Response
200 OK. Errors use the error envelope.
| Field | Type | Description |
|---|---|---|
data | object[] | |
data[].id | string | dom_… |
data[].hostname | string | Lowercase ASCII (punycode). |
data[].status | string | One of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted. |
data[].status_reason | string | null | Machine code when status is not active, e.g. dns_record_mismatch. |
data[].status_detail | object | null | { expected, found, hint }. |
data[].is_apex | boolean | |
data[].mode | string | From the key that created it; test domains never contact a CA. One of live, test. |
data[].dns | object | Record names are relative to the registrable domain (e.g. "careers" in acme.com). |
data[].dns.cname | object | Subdomains: the one record to add. |
data[].dns.cname.name | string | |
data[].dns.cname.value | string | |
data[].dns.apex | object | Apex domains: A (and AAAA) records plus the _apexly TXT record. |
data[].dns.apex.a | string[] | |
data[].dns.apex.aaaa | string[] | |
data[].dns.apex.txt | object | |
data[].origin | string | null | Origin override, or null for the app origin. |
data[].apex_redirect | string | One of none, www. |
data[].connect_url | string | The page the customer opens to connect the domain. |
data[].certificate | object | null | |
data[].certificate.issuer | string | |
data[].certificate.not_before | string | |
data[].certificate.not_after | string | |
data[].certificate.renews_at | string | |
data[].metadata | object | null | |
data[].origin_headers | object | null | Headers the edge adds to every request for this domain, or null. |
data[].created_at | string | |
data[].updated_at | string | |
data[].last_checked_at | string | null | |
data[].next_check_at | string | null | |
next_cursor | string | null |
Example
curl https://api.apexly.dev/v1/domains \
-H "Authorization: Bearer $APEXLY_API_KEY"Get a domain
GET/v1/domains/{id}
Another app’s domain, or a deleted one, is 404.
Path parameters
| Field | Type | Description |
|---|---|---|
id | string |
Response
200 OK. Errors use the error envelope.
| Field | Type | Description |
|---|---|---|
id | string | dom_… |
hostname | string | Lowercase ASCII (punycode). |
status | string | One of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted. |
status_reason | string | null | Machine code when status is not active, e.g. dns_record_mismatch. |
status_detail | object | null | { expected, found, hint }. |
is_apex | boolean | |
mode | string | From the key that created it; test domains never contact a CA. One of live, test. |
dns | object | Record names are relative to the registrable domain (e.g. "careers" in acme.com). |
dns.cname | object | Subdomains: the one record to add. |
dns.cname.name | string | |
dns.cname.value | string | |
dns.apex | object | Apex domains: A (and AAAA) records plus the _apexly TXT record. |
dns.apex.a | string[] | |
dns.apex.aaaa | string[] | |
dns.apex.txt | object | |
dns.apex.txt.name | string | |
dns.apex.txt.value | string | |
origin | string | null | Origin override, or null for the app origin. |
apex_redirect | string | One of none, www. |
connect_url | string | The page the customer opens to connect the domain. |
certificate | object | null | |
certificate.issuer | string | |
certificate.not_before | string | |
certificate.not_after | string | |
certificate.renews_at | string | |
metadata | object | null | |
origin_headers | object | null | Headers the edge adds to every request for this domain, or null. |
created_at | string | |
updated_at | string | |
last_checked_at | string | null | |
next_check_at | string | null |
Example
curl https://api.apexly.dev/v1/domains/dom_01J9X8T4Q5M6N7P8R9S0V1W2X3 \
-H "Authorization: Bearer $APEXLY_API_KEY"Update a domain
PATCH/v1/domains/{id}
origin (paid plans; null removes the override; Free ignores it with warnings), metadata and origin_headers (each replaces the object; null removes it), apex_redirect (apex domains only).
Path parameters
| Field | Type | Description |
|---|---|---|
id | string |
Body
| Field | Type | Description |
|---|---|---|
origin | string | null | Per-domain origin override (paid plans; Free: ignored with a warning). At most 2048 characters. |
metadata | object | null | Any JSON object, at most 4 KB; returned on every domain object and event. |
origin_headers | object | null | Headers the edge adds to every request for this domain, e.g. {"X-Tenant-Id": "42"} (at most 5; X- names, not X-Apexly-, X-Forwarded- or X-Real-IP; printable values up to 256 characters). A visitor's own copy of each header is removed first; trust them only on requests whose X-Apexly-Signature verifies. |
apex_redirect | string | Apex domains only. One of none, www. |
Response
200 OK. Errors use the error envelope.
| Field | Type | Description |
|---|---|---|
id | string | dom_… |
hostname | string | Lowercase ASCII (punycode). |
status | string | One of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted. |
status_reason | string | null | Machine code when status is not active, e.g. dns_record_mismatch. |
status_detail | object | null | { expected, found, hint }. |
is_apex | boolean | |
mode | string | From the key that created it; test domains never contact a CA. One of live, test. |
dns | object | Record names are relative to the registrable domain (e.g. "careers" in acme.com). |
dns.cname | object | Subdomains: the one record to add. |
dns.cname.name | string | |
dns.cname.value | string | |
dns.apex | object | Apex domains: A (and AAAA) records plus the _apexly TXT record. |
dns.apex.a | string[] | |
dns.apex.aaaa | string[] | |
dns.apex.txt | object | |
dns.apex.txt.name | string | |
dns.apex.txt.value | string | |
origin | string | null | Origin override, or null for the app origin. |
apex_redirect | string | One of none, www. |
connect_url | string | The page the customer opens to connect the domain. |
certificate | object | null | |
certificate.issuer | string | |
certificate.not_before | string | |
certificate.not_after | string | |
certificate.renews_at | string | |
metadata | object | null | |
origin_headers | object | null | Headers the edge adds to every request for this domain, or null. |
created_at | string | |
updated_at | string | |
last_checked_at | string | null | |
next_check_at | string | null | |
warnings | object[] | Present when part of the request was ignored (plan_required) or, on create, when the preflight found what will stop the domain going live: cloudflare_proxy, apex_records_elsewhere, caa_blocks_issuance, origin_unreachable. |
warnings[].code | string | |
warnings[].message | string |
Example
curl -X PATCH https://api.apexly.dev/v1/domains/dom_01J9X8T4Q5M6N7P8R9S0V1W2X3 \
-H "Authorization: Bearer $APEXLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"metadata":{"customer":"acme"}}'Delete a domain
DELETE/v1/domains/{id}
Emits domain.deleted; routing is dropped within 5 seconds; the hostname can be added again at once.
Path parameters
| Field | Type | Description |
|---|---|---|
id | string |
Response
204 No Content. Errors use the error envelope.
Example
curl -X DELETE https://api.apexly.dev/v1/domains/dom_01J9X8T4Q5M6N7P8R9S0V1W2X3 \
-H "Authorization: Bearer $APEXLY_API_KEY"Check a domain now
POST/v1/domains/{id}/verify
Queues a DNS check right away instead of waiting for the next scheduled one; on a cert_failed domain it retries issuance (after re-checking CAA when that was the reason). One per 15 seconds per domain (429 rate_limited with Retry-After). 422 validation_failed when there is nothing to check (issuing, held, expired, or a test domain).
Path parameters
| Field | Type | Description |
|---|---|---|
id | string |
Response
202 Accepted. Errors use the error envelope.
| Field | Type | Description |
|---|---|---|
queued | boolean | One of true. |
Example
curl -X POST https://api.apexly.dev/v1/domains/dom_01J9X8T4Q5M6N7P8R9S0V1W2X3/verify \
-H "Authorization: Bearer $APEXLY_API_KEY"Diagnose a domain (why isn't it live?)
GET/v1/domains/{id}/diagnose
Runs every check that decides whether the domain serves, live: the record at each resolver (1.1.1.1, 8.8.8.8, the domain's own nameservers), other A and stale AAAA records, the Cloudflare proxy, CAA, the certificate, the origin and, with apex_redirect www, the www domain. Each check is pass, fail, warn or skip with what we saw (detail) and what to change (fix). blocking_check_id is the failing check to fix first. Read-only: it never changes the domain. Results are reused for 20 seconds per domain; 30 requests per minute per app (429 rate_limited).
Path parameters
| Field | Type | Description |
|---|---|---|
id | string |
Response
200 OK. Errors use the error envelope.
| Field | Type | Description |
|---|---|---|
domain_id | string | |
hostname | string | |
status | string | One of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted. |
live | boolean | Active and no check fails. |
blocking_check_id | string | null | The failing check to fix first (root causes first), or null when nothing fails. One of dns_authoritative, dns_1.1.1.1, dns_8.8.8.8, apex_extra_a, stale_aaaa, cloudflare_proxy, caa, certificate, origin, www_pair. |
checked_at | string | When the checks ran (results are reused for 20 seconds). |
checks | object[] | In this order, each present when it applies: dns_authoritative, dns_1.1.1.1, dns_8.8.8.8, apex_extra_a, stale_aaaa, cloudflare_proxy, caa, certificate, origin, www_pair. |
checks[].id | string | One of dns_authoritative, dns_1.1.1.1, dns_8.8.8.8, apex_extra_a, stale_aaaa, cloudflare_proxy, caa, certificate, origin, www_pair. |
checks[].status | string | One of pass, fail, warn, skip. |
checks[].title | string | |
checks[].detail | string | What we saw. |
checks[].fix | string | null | What to change, or null when nothing is needed. |
checks[].docs | string | Docs page for this check. |
Example
curl https://api.apexly.dev/v1/domains/dom_01J9X8T4Q5M6N7P8R9S0V1W2X3/diagnose \
-H "Authorization: Bearer $APEXLY_API_KEY"