Claim a custom domain for a sandbox's port

Claims a name of the customer's own and answers the records to add at its DNS host: a TXT record proving the name is theirs (`verification.txt_name`, `txt_value`; it must stay in place) and the route, a CNAME to `verification.route_host` or, at a zone's apex, A and AAAA records to `route_addresses`.

POST/v1/domains

Claims a name of the customer's own and answers the records to add at its DNS host: a TXT record proving the name is theirs (verification.txt_name, txt_value; it must stay in place) and the route, a CNAME to verification.route_host or, at a zone's apex, A and AAAA records to route_addresses. A wildcard (*.preview.example.com) needs a CNAME of _acme-challenge to acme_cname_target as well, and routes each label sbx-<id> to that sandbox of the domain's project; it names no sandbox_id. The domain then moves from pending_dns through issuing (a public certificate) to active; checkDomain looks again at once. A pending claim holds nothing: whoever proves the name first holds it. Pod's own zones are invalid; a name another organization holds is conflict. A project out of the caller's reach is forbidden, as on createSandbox. Needs the custom_domains entitlement (getNetworkSettings); max_domains counts them.

A key with the network:write scope.

Request

curl -X POST "https://api.pod.mapier.ai/v1/domains" \
  -H "Authorization: Bearer $POD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"example","port":1}'

Parameters

NameInTypeRequiredWhat it is
Idempotency-KeyheaderstringNoMakes a repeat of this call safe for 24 hours.

Body

FieldTypeRequiredWhat it is
namestringYesLowercase ASCII, an internationalised name in its xn-- form. A leading *. makes a wildcard that matches one label. Pod's own zones (mapier.ai, and mapier.dev, the content domain) and public suffixes are refused.
projectstringNoThe key's own project by default, and the only one it may name. A person must name one.
sandbox_idstringNoRequired for an exact name; not for a wildcard.
portintegerYesFrom 1 to 65535.

Answer

201. The domain, waiting for its records.

201
{
  "id": "dom_3ahrz6dmv29gqy5ckt18fpx4b",
  "project_id": "prj_3ahrz6dmv29gqy5ckt18fp",
  "name": "example",
  "wildcard": false,
  "target": {
    "sandbox_id": null,
    "port": 1
  },
  "state": "pending_dns",
  "verification": null,
  "certificate": null,
  "failure": null,
  "warning": null,
  "created_at": null,
  "changed_at": null
}
FieldTypeAlwaysWhat it is
idstringYes
project_idstringYes
namestringYesLowercase ASCII, an internationalised name in its xn-- form. A leading *. makes a wildcard that matches one label. Pod's own zones (mapier.ai, and mapier.dev, the content domain) and public suffixes are refused.
wildcardbooleanYes
targetDomainTargetYes
state"pending_dns" | "issuing" | "active" | "failed"Yespending_dns until the records are seen, issuing while the certificate is made, then active; failed says why in failure. Treat a value you do not know as pending.
verificationDomainVerification | nullYesThe records to add; null once nothing is left to add.
certificateDomainCertificate | nullYesThe certificate served; null until one is issued.
failurestring | nullNoWhy the domain is failed.
warningstring | nullNoWhat went missing from an active domain's records.
created_atstring | nullYes
changed_atstring | nullYes

Errors

The refusals this call is known for: invalid, forbidden, plan_required, account_restricted, conflict, quota_exceeded. Any call can also answer unauthorized, rate_limited, unavailable or internal; the error list says what each means and when to send the call again.

In the SDKs

ClientCall
TypeScriptpod.network.domains.create({ … })
Pythonpod.network.domains.create({…})