Make a custom domain primary
POST /v1/custom-domains/{custom_domain_id}:make-primary · permission custom-domains:write
Makes the domain the environment's primary custom domain (hosted sign-in links use it); the previous primary is released from that role in the same operation. The domain must be active; making the current primary primary again changes nothing. When the environment's issuer is on a custom domain, changing the primary domain changes the issuer and must be scheduled as an issuer migration.
Request
| Field | Type | Required | Description |
|---|---|---|---|
custom_domain_id |
string | yes | Custom domain ID (cdom_…). |
Idempotency-Key |
header | no | Optional key (16-64 characters) that makes a retried request safe. |
If-Match |
header | no | Optional. When given it must match the domain's ETag (412 otherwise). |
No request body.
Response
200 OK with the domain and an ETag header.
{
"id": "cdom_01j9xk3m7q8r2s4t6v8w0y2z4a",
"hostname": "login.example.com",
"is_primary": true,
"status": "active",
"failure_reason": null,
"dns_records": [
{
"type": "TXT",
"name": "_akp-verify.login.example.com",
"value": "idp-verify=3q2-7wEXAMPLEtokenQ9"
},
{
"type": "CNAME",
"name": "login.example.com",
"value": "acme.eu.edge.keenauth.app"
}
],
"certificate_expires_at": "2027-01-04T09:31:12Z",
"last_checked_at": "2026-10-05T09:31:00Z",
"next_check_at": null,
"activated_at": "2026-10-05T09:31:12Z",
"degraded_since": null,
"status_changed_at": "2026-10-05T09:31:12Z",
"created_at": "2026-10-05T09:30:00.123456Z",
"updated_at": "2026-10-05T09:31:12Z"
}
Errors
| HTTP | code | When |
|---|---|---|
| 404 | not_found |
The custom domain does not exist or belongs to another environment. |
| 409 | custom_domain_state_conflict |
The domain is not active. |
| 409 | issuer_change_requires_schedule |
The environment's issuer is on a custom domain; the change must be scheduled as an issuer migration. |
| 412 | precondition_failed |
If-Match does not match the domain's current version. |
| 503 | service_unavailable |
The environment's issuer information is temporarily unavailable. |
| 401 | unauthenticated |
The credential is missing, invalid or revoked. |
| 403 | insufficient_permissions |
The credential lacks the required permission. |
| 429 | rate_limited |
The rate limit was exceeded; retry after the Retry-After period. |
Example
curl -X POST https://api.eu.keenauth.com/v1/custom-domains/cdom_01j9xk3m7q8r2s4t6v8w0y2z4a:make-primary \
-H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
-H 'If-Match: "4"'