Update the environment theme
PATCH /v1/branding · permission branding:write
Changes the environment theme draft with a JSON merge patch (application/merge-patch+json, RFC 7396). A token set to null (or a whole group such as "light": null) is cleared and inherits again; "theme": null clears every token. Only changed tokens are written; a patch that changes nothing keeps the version. Values are checked on write: colors are #rgb/#rrggbb, font.size_base 14-18, radius.card 0-24, radius.control 0-16, logo_height 24-80. logo, favicon and background_image must name an image of that kind uploaded with Upload a branding asset; otherwise the field fails with asset_not_found. Contrast is checked on publish.
Request
| Field | Type | Required | Description |
|---|---|---|---|
If-Match |
header | yes | The ETag of the draft as last read ("0" if never written). Missing: 428; stale: 412. |
theme |
object | null | no | Partial BrandingTheme; every field and group may be null. |
Response
200 OK with the environment draft and its ETag. theme holds only the tokens that are set; unset tokens inherit from the platform default.
{
"theme": {"mode": "light", "light": {"color": {"primary": "#0a3d91"}}, "logo_height": 40},
"css": null,
"page_template": null,
"updated_at": "2026-10-05T09:30:00.123456Z"
}
Errors
| HTTP | code | When |
|---|---|---|
| 400 | unknown_field |
The body has an unknown field or is not a JSON object. |
| 412 | precondition_failed |
If-Match does not match the current version of the draft. |
| 415 | unsupported_media_type |
The content type is not application/merge-patch+json. |
| 422 | validation_failed |
A token value is invalid (invalid_value, out_of_range, unknown_token); pointer names the token, e.g. /theme/light/color/primary. |
| 428 | precondition_required |
The If-Match header is missing. |
| 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/branding \
-H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
-H "Content-Type: application/merge-patch+json" \
-H 'If-Match: "3"' \
-d '{"theme":{"light":{"color":{"primary":"#0a3d91"}},"radius":null}}'