Update an organization domain

PATCH /v1/organization-domains/{domain_id} · permission organization-domains:write

Updates the domain's capture and SSO routing settings with a JSON merge patch (RFC 7396, Content-Type: application/merge-patch+json). Both can only be turned on for a verified domain. A patch that changes nothing does not change the version.

Request

Field Type Required Description
domain_id path yes Organization domain ID (odm_…).
If-Match header no Optional. When sent it must match the ETag of the last read ("<version>").
capture_mode string no off, suggest or auto_join: what happens when a user with an email address on this domain signs in.
sso_routing_enabled boolean no Route sign-ins with this domain to the organization's SSO connection.

Request body:

{
  "capture_mode": "suggest",
  "sso_routing_enabled": true
}

Response

200 OK with the updated domain and its new ETag.

{
  "id": "odm_01j9xk3m7q8r2s4t6v8w0y2z4c",
  "organization_id": "org_01j9xk3m7q8r2s4t6v8w0y2z4a",
  "domain": "acme.com",
  "status": "verified",
  "verification_method": "dns_txt",
  "txt_record_name": "_akp-verify.acme.com",
  "txt_record_value": "idp-verify=EXAMPLEtokenEXAMPLEtokenEXAMPLEtokenEXAMPLEtok",
  "verification_started_at": "2026-10-12T09:30:00.123456Z",
  "verified_at": "2026-10-12T09:35:00.654321Z",
  "last_checked_at": "2026-10-12T09:35:00.654321Z",
  "unverified_at": null,
  "next_check_at": "2026-10-13T09:35:00.654321Z",
  "last_failure_code": null,
  "capture_mode": "suggest",
  "sso_routing_enabled": true,
  "created_at": "2026-10-12T09:30:00.123456Z",
  "updated_at": "2026-10-12T10:05:00.000000Z",
  "version": 3
}

Errors

HTTP code When
400 unknown_field The body has a field that is not in the schema or is read-only.
404 not_found No organization domain with this ID exists in this environment.
409 domain_not_verified The domain is not verified, so capture or SSO routing cannot be turned on.
412 precondition_failed If-Match was sent and does not match the current version; read the domain again.
422 validation_failed A field is null or has an invalid value.
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.
503 service_unavailable A dependency is temporarily unavailable; retry after the Retry-After period.

Example

curl -X PATCH https://api.eu.keenauth.com/v1/organization-domains/odm_01j9xk3m7q8r2s4t6v8w0y2z4c \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H "Content-Type: application/merge-patch+json" \
  -d '{"capture_mode":"suggest"}'