Skip to content

Roll Back Usage Limit Plan

Activate an original published revision immediately. No new draft, revision, or second Publish step is created.

POST /v1/projects/:project_id/usage-limit-plans/:id/rollback

Requires usage_control:write. project_id is the owning project; id (when present) is its Plan ID. The API key supplies the tenant scope. Resources outside that tenant/project are not returned.

There are no query parameters.

{
"revision": 1
}

revision is a required integer of at least 1. Publish accepts only the current real draft; rollback accepts a published revision belonging to this Plan.

HTTP 200.

{
"id": "ulpv_pro_v1",
"tenant_id": "t_001",
"project_id": "proj_gateway",
"plan_id": "ulp_pro",
"name": "pro",
"revision": 1,
"status": "published",
"title": "Pro daily budget",
"description": "Default allowance",
"published_at": 1784890000,
"created_at": 1784889000,
"updated_at": 1789722000,
"rules": [
{
"id": "ulpr_budget_v1",
"tenant_id": "t_001",
"project_id": "proj_gateway",
"plan_version_id": "ulpv_pro_v1",
"limit_key": "ulrk_budget",
"currency": "USD",
"measure": "amount",
"selector_type": "all",
"period": "day",
"limit_amount": "100",
"timezone": "UTC",
"action": "block",
"webhook_event": "usage_limit.exceeded",
"created_at": 1784890000,
"updated_at": 1784890000
}
],
"referenced_by_count": 0
}

Version fields: id (original version ID), tenant_id, project_id, plan_id, name, revision, status, title, optional description, original published_at (omitted for drafts), created_at, Plan updated_at, rules, and referenced_by_count. Detail/list reads can also include has_unpublished_changes and live_revision, derived from actual draft status. Reference counts are populated by detail/list reads; history and mutation responses do not calculate them. Each rule returns the business fields above plus its original id, plan_version_id, ownership, and creation/update timestamps. Empty optional fields may be omitted; timestamps are Unix seconds.

After v3 → v1, current_revision=1; the response is original v1 with unchanged version/rule IDs, limit keys, configuration, and original publish time. v2/v3 remain available, including v1 → v3. Repeating current is idempotent and still refreshes policy caches. An existing draft is preserved unchanged. Archived Plans, draft targets, never-published Plans, and invalid revisions return 400; absent or out-of-scope targets return 404. The target need not be lower than current.

If configuration committed but policy cache refresh failed, HTTP 503 returns { "error": "…", "committed": true, "version": { ... } }, containing the complete committed version. Re-read detail/current first; repeating rollback to that revision retries refresh idempotently. Failure does not mean the database was rolled back. Do not automatically overwrite a newer current selected by another operator.

Missing/out-of-scope resources return 404, invalid inputs/lifecycle transitions 400, name/revision conflicts 409, insufficient permission 403, and internal/infrastructure failures 5xx. Failed write transactions leave Plan/history/rules unchanged; cache errors explicitly marked committed are the exception.

Lifecycle and window behavior · Create Usage Limit Plan · Get Usage Limit Plan · Update Usage Limit Plan Draft · Publish Usage Limit Plan · List Usage Limit Plan Revisions