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

# Prune Threads

> Immediately apply TTL policies to the caller's expired threads.

Threads whose TTL has expired are deleted (strategy `delete`) or have
their checkpoint history compacted (strategy `keep_latest`). Threads with
active runs are skipped and handled once their runs settle.



## OpenAPI

````yaml /openapi.json post /threads/prune
openapi: 3.1.0
info:
  title: Aegra
  description: Production-ready Agent Protocol server
  version: 0.10.4
servers: []
security: []
tags:
  - name: Assistants
    description: A configured instance of a graph.
  - name: Threads
    description: Accumulated state and outputs from a group of runs.
  - name: Thread Runs
    description: Invoke a graph on a thread, updating its persistent state.
  - name: Stateless Runs
    description: Invoke a graph without state or memory persistence.
  - name: Crons
    description: Scheduled recurring runs on a cron schedule.
  - name: Store
    description: Persistent key-value and semantic storage available from any thread.
  - name: Event Streaming
    description: Agent Protocol v2 thread event streaming and commands.
  - name: Health
    description: Server health checks and service information.
paths:
  /threads/prune:
    post:
      tags:
        - Threads
      summary: Prune Threads
      description: >-
        Immediately apply TTL policies to the caller's expired threads.


        Threads whose TTL has expired are deleted (strategy `delete`) or have

        their checkpoint history compacted (strategy `keep_latest`). Threads
        with

        active runs are skipped and handled once their runs settle.
      operationId: prune_threads_threads_prune_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadPruneResponse'
components:
  schemas:
    ThreadPruneResponse:
      properties:
        deleted:
          type: integer
          title: Deleted
          description: Expired threads fully deleted (strategy 'delete')
          default: 0
        pruned:
          type: integer
          title: Pruned
          description: Expired threads whose history was pruned (strategy 'keep_latest')
          default: 0
      type: object
      title: ThreadPruneResponse
      description: Response model for POST /threads/prune

````