> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tai42.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Roll a policy back to a version

> Re-point the enforced policy to a prior version. Store-first: the target version
body is read from the history, written to the enforced store (the authority) FIRST;
on that success the cache-invalidation key is bumped immediately so enforcement
follows, then the durable history pointer is advanced. Admin-only: a non-admin caller
is denied 403 so it can never roll back another user's (or its own) enforced policy.
404 if the version is absent or the user has no live key.



## OpenAPI

````yaml /openapi.json post /api/auth/api-keys/{user_id}/policy/rollback
openapi: 3.1.0
info:
  description: The operator HTTP surface served under /api/*.
  title: tai42-skeleton API
  version: 0.1.1
servers: []
security: []
paths:
  /api/auth/api-keys/{user_id}/policy/rollback:
    post:
      tags:
        - access-control
      summary: Roll a policy back to a version
      description: >-
        Re-point the enforced policy to a prior version. Store-first: the target
        version

        body is read from the history, written to the enforced store (the
        authority) FIRST;

        on that success the cache-invalidation key is bumped immediately so
        enforcement

        follows, then the durable history pointer is advanced. Admin-only: a
        non-admin caller

        is denied 403 so it can never roll back another user's (or its own)
        enforced policy.

        404 if the version is absent or the user has no live key.
      operationId: post_api_auth_api_keys_user_id_policy_rollback
      parameters:
        - in: path
          name: user_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PolicyRollback'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data: {}
                required:
                  - data
                type: object
          description: Success.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Malformed request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PolicyRollback:
      description: Re-point a user's enforced policy to a prior version.
      properties:
        version:
          title: Version
          type: integer
      required:
        - version
      title: PolicyRollback
      type: object
    Error:
      properties:
        error:
          type: string
      required:
        - error
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````