API

Domains

Add, check, redirect, move and remove custom domains, and connect Cloudflare by sign-in or API token.

See Domains for the DNS record to add and how a domain moves from pending through verifying to active.

Every route below, with its parameters, request and response, errors and samples, is in the API reference.

RouteWhat it does
GET /v1/orgs/:orgId/domainsLists custom domains, and target: the hostname to point their CNAME records at.
POST /v1/orgs/:orgId/domainsAdds a custom domain to a Serverless App Service and returns the DNS record to create.
POST /v1/orgs/:orgId/domains/:hostname/verifyChecks the domain's certificate and updates its status.
POST /v1/orgs/:orgId/domains/:hostname/cloudflareCreates the domain's records with the org's connected Cloudflare token, then checks right away. Create-only: a record already pointing elsewhere is replaced only for an owner or admin (a move's second click, say); for anyone else nothing is written and the answer names it (409), so the connection never repoints a live record for someone who may only add one.
PATCH /v1/orgs/:orgId/domains/:hostnameMoves a domain to another Serverless App Service of the org, or makes it redirect to another domain of its Serverless App Service (redirectTo: null serves the Serverless App Service again). The edge route changes right away.
DELETE /v1/orgs/:orgId/domains/:hostnameRemoves a custom domain: its route and its certificate.
GET /v1/orgs/:orgId/integrations/cloudflareWhether Cloudflare is connected (by sign-in or API token), the zones it can see, whether a sign-in grant expired, and whether sign-in is available. Credentials are never returned.
POST /v1/orgs/:orgId/integrations/cloudflare/authorizeStarts the OAuth flow: stores a one-time state and returns Cloudflare's authorize URL.
POST /v1/orgs/:orgId/integrations/cloudflare/oauthCompletes the OAuth flow. The state is consumed first (one use), then checked against this user and org. With error instead of code (the user declined), it only consumes the state and returns where to go back to; retry says to start again without offline access.
PUT /v1/orgs/:orgId/integrations/cloudflareConnects a Cloudflare API token (Zone → DNS → Edit) for adding domain records. The token is checked against Cloudflare, encrypted and stored; it must see at least one zone.
DELETE /v1/orgs/:orgId/integrations/cloudflareDisconnects Cloudflare: revokes a sign-in grant at Cloudflare (best effort) and deletes the stored credentials.