
# Roll back branding

`POST /v1/branding:rollback` · permission `branding:write`

Republishes an earlier version: its snapshot becomes a new version with `source: rollback` and `rolled_back_from` set. Drafts are not changed. Only the last 50 versions can be restored.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `version` | integer | yes | Version number to republish (at least 1). |

## Response

`200 OK` with the new version's metadata (the snapshot itself is not returned).

```json
{
  "version": 4,
  "snapshot_sha256": "3f1c…",
  "source": "publish",
  "rolled_back_from": null,
  "actor_type": "api_key",
  "actor_id": "key_01jb…",
  "published_at": "2026-10-05T09:31:00Z"
}
```

## Errors

| HTTP | code | When |
|---|---|---|
| 400 | `unknown_field` | The body has an unknown field or is not a JSON object. |
| 404 | `not_found` | The version does not exist or is no longer kept. |
| 422 | `validation_failed` | `version` is missing (`required`) or less than 1 (`out_of_range`). |
| 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

```bash
curl -X POST https://api.eu.keenauth.com/v1/branding:rollback \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version":3}'
```
