Docs
Docs
Getting started

How it works

A domain moves through a handful of states, each with one owner and a fixed check cadence. Every move is recorded, and the ones you act on fire a webhook.

The request path

Your customer adds one DNS record that points their hostname at Apexly. Visitors then reach our edge, which terminates TLS with a certificate issued for that hostname and forwards the request to your app's origin with the original Host header and a signature. Your app never handles certificates or DNS.

  1. You create the domain: POST /v1/domains returns the record to add and a connect link.
  2. Your customer adds the record, alone or with the connect page.
  3. We see the record, confirm it from three resolvers, and request a certificate.
  4. The domain goes active and serves HTTPS. You get domain.active.

Headers your origin receives

Every request keeps the visitor's Host (for example careers.acme.com) and gets X-Forwarded-For, X-Forwarded-Proto: https, X-Apexly-Domain-Id, X-Apexly-App-Id, X-Apexly-Timestamp and X-Apexly-Signature. Find the tenant from the Host or the domain id, and accept a request only when the signature verifies (see the guide for your framework).

If your origin routes on a header instead, give the domain origin_headers and the edge adds them to every request for it:

curl -X PATCH https://api.apexly.dev/v1/domains/dom_01M551Z4AYJ9G7AW89XTQN0DFK \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"origin_headers":{"X-Tenant-Id":"42"}}'
  • Up to 5 headers. Names start with X- and use letters, digits and dashes; X-Apexly-*, X-Forwarded-* and X-Real-IP are reserved. Values are printable text up to 256 characters.
  • A visitor's own copy of each header is removed before ours is added, so nobody can pick another tenant by sending X-Tenant-Id themselves.
  • Anyone who reaches your origin directly can still send any header. Trust origin_headers only on requests whose X-Apexly-Signature verifies.
  • Changes reach the edge within seconds. null removes them all; set them on POST /v1/domains too, or from the domain's ⋯ menu in the dashboard.

The state machine

Every domain
  1. pending_dns
  2. record seen
  3. verifying
  4. 3 of 3 resolvers agree
  5. issuing
  6. certificate stored
  7. active
The record never lands
  1. pending_dns
  2. 72 h, no record
  3. expired
The certificate authority refuses
  1. issuing
  2. fails after retries
  3. cert_failed
  4. backoff retry, or cause fixed
  5. issuing
The record breaks after go-live
  1. active
  2. removed or points elsewhere
  3. dns_broken
  4. record restored
  5. verifying
Abuse hold
  1. any state
  2. held for review
  3. held
  4. released
  5. previous state
Deleted
  1. any state
  2. DELETE /v1/domains/{id}
  3. deleted
StateWhat it meansChecked
pending_dnsWaiting for the customer's record. status_reason says what we found instead.Every 15 s for the first hour, then every 5 min, for 72 h
verifyingRecord seen once; confirming it from 1.1.1.1, 8.8.8.8 and the zone's own nameservers.Every 5 s, up to 2 min
issuingDNS verified; the certificate is being issued.Every 5 s, up to 10 min
activeServing HTTPS. The certificate renews itself from day 60.DNS every 6 h, origin every 15 min
dns_brokenWas active; the record was removed or points elsewhere. The existing certificate keeps serving.Every 15 s for an hour, then every 5 min
cert_failedIssuance or renewal failed after retries. status_reason names the cause.Retries at 1 min, 5 min, 30 min, 2 h, then every 12 h
expiredThe record never arrived within 72 hours. Nothing was billed.Not checked; kept 30 days
heldPaused for review before any certificate is requested. A person reviews within one business day.Not checked until released
deletedRemoved. Routing stops within 5 seconds and the hostname can be added again.Not checked

What a subdomain needs

One CNAME from the hostname to the dns.cname.value in the domain object (or to your white-label host, if you set one). We follow up to five CNAME hops.

What an apex needs

An apex (acme.com) cannot have a CNAME, so it needs the A records in dns.apex.a (and AAAA, if the zone has any, set to dns.apex.aaaa) plus a TXT record at _apexly.<hostname> with the value in dns.apex.txt. The TXT record proves control; the A records route traffic. Set apex_redirect: "www" to redirect the apex to www.

Reasons

When a domain is not active, status_reason and status_detail explain why in the same words the dashboard and the connect page use. Every reason has a page under Troubleshooting, for example dns_record_mismatch. Reasons without their own page:

  • confirming_record (verifying): the record landed; we are confirming it from three resolvers.
  • issuing_certificate (issuing): DNS is verified and the certificate is being issued; usually under a minute.
  • serving (active): live; nothing to do.
  • ca_error (cert_failed): the certificate authority refused for a reason we could not classify. We retry with backoff; POST /v1/domains/{id}/verify retries now.
  • held_for_review (held): paused for review before issuing a certificate.
  • deleted (deleted): routing stopped.
  • sandbox: a test domain moving through the states on a timer; see Test mode.

Webhooks

Every transition writes an event to GET /v1/events and, for domain.created, domain.verified, domain.active, domain.dns_broken, domain.cert_failed, domain.certificate_renewed, domain.deleted, domain.held and domain.released, sends one signed webhook. See Webhooks.

What to read next

Was this helpful?