Docs
Docs
API reference

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

FieldTypeDescription
idstring

Body

FieldTypeDescription
ttlintegerSeconds the token works for: 60 to 86400 (24 h), default 3600 (1 h). 60 to 86400.

Response

201 Created. Errors use the error envelope.

FieldTypeDescription
tokenstringcs_… Pass it to Apexly.mount() or <ApexlyConnect> in the browser. Opens this one domain only.
expires_atstringISO 8601. After this the widget says the link no longer works.
urlstringThe 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

FieldTypeDescription
hostnamestringRequired. The customer's hostname, e.g. careers.acme.com (Unicode is encoded). At most 1024 characters.
originstring | nullPer-domain origin override (paid plans; Free: ignored with a warning). At most 2048 characters.
metadataobject | nullAny JSON object, at most 4 KB; returned on every domain object and event.
origin_headersobject | nullHeaders 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_redirectstringApex 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.

FieldTypeDescription
idstringdom_…
hostnamestringLowercase ASCII (punycode).
statusstringOne of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted.
status_reasonstring | nullMachine code when status is not active, e.g. dns_record_mismatch.
status_detailobject | null{ expected, found, hint }.
is_apexboolean
modestringFrom the key that created it; test domains never contact a CA. One of live, test.
dnsobjectRecord names are relative to the registrable domain (e.g. "careers" in acme.com).
dns.cnameobjectSubdomains: the one record to add.
dns.cname.namestring
dns.cname.valuestring
dns.apexobjectApex domains: A (and AAAA) records plus the _apexly TXT record.
dns.apex.astring[]
dns.apex.aaaastring[]
dns.apex.txtobject
dns.apex.txt.namestring
dns.apex.txt.valuestring
originstring | nullOrigin override, or null for the app origin.
apex_redirectstringOne of none, www.
connect_urlstringThe page the customer opens to connect the domain.
certificateobject | null
certificate.issuerstring
certificate.not_beforestring
certificate.not_afterstring
certificate.renews_atstring
metadataobject | null
origin_headersobject | nullHeaders the edge adds to every request for this domain, or null.
created_atstring
updated_atstring
last_checked_atstring | null
next_check_atstring | null
warningsobject[]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[].codestring
warnings[].messagestring

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

FieldTypeDescription
statusstringOne of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted.
hostnamestringHostname prefix. At most 253 characters.
limitintegerDefault 50. 1 to 100.
cursorstringnext_cursor of the previous page. At most 200 characters.

Response

200 OK. Errors use the error envelope.

FieldTypeDescription
dataobject[]
data[].idstringdom_…
data[].hostnamestringLowercase ASCII (punycode).
data[].statusstringOne of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted.
data[].status_reasonstring | nullMachine code when status is not active, e.g. dns_record_mismatch.
data[].status_detailobject | null{ expected, found, hint }.
data[].is_apexboolean
data[].modestringFrom the key that created it; test domains never contact a CA. One of live, test.
data[].dnsobjectRecord names are relative to the registrable domain (e.g. "careers" in acme.com).
data[].dns.cnameobjectSubdomains: the one record to add.
data[].dns.cname.namestring
data[].dns.cname.valuestring
data[].dns.apexobjectApex domains: A (and AAAA) records plus the _apexly TXT record.
data[].dns.apex.astring[]
data[].dns.apex.aaaastring[]
data[].dns.apex.txtobject
data[].originstring | nullOrigin override, or null for the app origin.
data[].apex_redirectstringOne of none, www.
data[].connect_urlstringThe page the customer opens to connect the domain.
data[].certificateobject | null
data[].certificate.issuerstring
data[].certificate.not_beforestring
data[].certificate.not_afterstring
data[].certificate.renews_atstring
data[].metadataobject | null
data[].origin_headersobject | nullHeaders the edge adds to every request for this domain, or null.
data[].created_atstring
data[].updated_atstring
data[].last_checked_atstring | null
data[].next_check_atstring | null
next_cursorstring | 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

FieldTypeDescription
idstring

Response

200 OK. Errors use the error envelope.

FieldTypeDescription
idstringdom_…
hostnamestringLowercase ASCII (punycode).
statusstringOne of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted.
status_reasonstring | nullMachine code when status is not active, e.g. dns_record_mismatch.
status_detailobject | null{ expected, found, hint }.
is_apexboolean
modestringFrom the key that created it; test domains never contact a CA. One of live, test.
dnsobjectRecord names are relative to the registrable domain (e.g. "careers" in acme.com).
dns.cnameobjectSubdomains: the one record to add.
dns.cname.namestring
dns.cname.valuestring
dns.apexobjectApex domains: A (and AAAA) records plus the _apexly TXT record.
dns.apex.astring[]
dns.apex.aaaastring[]
dns.apex.txtobject
dns.apex.txt.namestring
dns.apex.txt.valuestring
originstring | nullOrigin override, or null for the app origin.
apex_redirectstringOne of none, www.
connect_urlstringThe page the customer opens to connect the domain.
certificateobject | null
certificate.issuerstring
certificate.not_beforestring
certificate.not_afterstring
certificate.renews_atstring
metadataobject | null
origin_headersobject | nullHeaders the edge adds to every request for this domain, or null.
created_atstring
updated_atstring
last_checked_atstring | null
next_check_atstring | 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

FieldTypeDescription
idstring

Body

FieldTypeDescription
originstring | nullPer-domain origin override (paid plans; Free: ignored with a warning). At most 2048 characters.
metadataobject | nullAny JSON object, at most 4 KB; returned on every domain object and event.
origin_headersobject | nullHeaders 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_redirectstringApex domains only. One of none, www.

Response

200 OK. Errors use the error envelope.

FieldTypeDescription
idstringdom_…
hostnamestringLowercase ASCII (punycode).
statusstringOne of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted.
status_reasonstring | nullMachine code when status is not active, e.g. dns_record_mismatch.
status_detailobject | null{ expected, found, hint }.
is_apexboolean
modestringFrom the key that created it; test domains never contact a CA. One of live, test.
dnsobjectRecord names are relative to the registrable domain (e.g. "careers" in acme.com).
dns.cnameobjectSubdomains: the one record to add.
dns.cname.namestring
dns.cname.valuestring
dns.apexobjectApex domains: A (and AAAA) records plus the _apexly TXT record.
dns.apex.astring[]
dns.apex.aaaastring[]
dns.apex.txtobject
dns.apex.txt.namestring
dns.apex.txt.valuestring
originstring | nullOrigin override, or null for the app origin.
apex_redirectstringOne of none, www.
connect_urlstringThe page the customer opens to connect the domain.
certificateobject | null
certificate.issuerstring
certificate.not_beforestring
certificate.not_afterstring
certificate.renews_atstring
metadataobject | null
origin_headersobject | nullHeaders the edge adds to every request for this domain, or null.
created_atstring
updated_atstring
last_checked_atstring | null
next_check_atstring | null
warningsobject[]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[].codestring
warnings[].messagestring

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

FieldTypeDescription
idstring

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

FieldTypeDescription
idstring

Response

202 Accepted. Errors use the error envelope.

FieldTypeDescription
queuedbooleanOne 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

FieldTypeDescription
idstring

Response

200 OK. Errors use the error envelope.

FieldTypeDescription
domain_idstring
hostnamestring
statusstringOne of pending_dns, verifying, issuing, active, dns_broken, cert_failed, expired, held, deleted.
livebooleanActive and no check fails.
blocking_check_idstring | nullThe 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_atstringWhen the checks ran (results are reused for 20 seconds).
checksobject[]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[].idstringOne 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[].statusstringOne of pass, fail, warn, skip.
checks[].titlestring
checks[].detailstringWhat we saw.
checks[].fixstring | nullWhat to change, or null when nothing is needed.
checks[].docsstringDocs page for this check.

Example

curl https://api.apexly.dev/v1/domains/dom_01J9X8T4Q5M6N7P8R9S0V1W2X3/diagnose \
  -H "Authorization: Bearer $APEXLY_API_KEY"
Was this helpful?