> ## 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.

# Prune expired state records

> Delete every record past its state's ``retention_days`` horizon; returns the per-state
deleted counts.



## OpenAPI

````yaml /openapi.json post /api/state-retention/prune
openapi: 3.1.0
info:
  description: The operator HTTP surface served under /api/*.
  title: tai42-skeleton API
  version: 14.0.2
servers: []
security: []
paths:
  /api/state-retention/prune:
    post:
      tags:
        - states
      summary: Prune expired state records
      description: >-
        Delete every record past its state's ``retention_days`` horizon; returns
        the per-state

        deleted counts.
      operationId: post_api_state_retention_prune
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/PruneResult'
                required:
                  - data
                type: object
          description: Success.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PruneResult:
      description: >-
        The ``prune_state_retention`` report: ``pruned`` maps each state whose
        records were

        swept to the number deleted (empty when nothing was past its horizon).
      properties:
        pruned:
          additionalProperties:
            type: integer
          title: Pruned
          type: object
      required:
        - pruned
      title: PruneResult
      type: object
    Error:
      properties:
        code:
          description: >-
            Stable machine-readable reason a client keys a dedicated error state
            on, present on refusals that opt in (e.g. a 501 not-configured
            refusal). Optional: absent when the error carries only a
            human-readable message.
          type: string
        error:
          type: string
      required:
        - error
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````