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

# Compact Chats

> Compact one or more chat conversations into summarized versions. This reduces the size of chat history while preserving key information. Optionally provide a prompt to control what information gets preserved in the compacted summary.



## OpenAPI

````yaml api-reference/openapi/research.json POST /api/chats/compact
openapi: 3.1.0
info:
  title: Recoup API - Research
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.recoupable.dev
security: []
paths:
  /api/chats/compact:
    post:
      description: >-
        Compact one or more chat conversations into summarized versions. This
        reduces the size of chat history while preserving key information.
        Optionally provide a prompt to control what information gets preserved
        in the compacted summary.
      requestBody:
        description: Chat compaction parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompactChatsRequest'
      responses:
        '200':
          description: Chats compacted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompactChatsResponse'
        '400':
          description: Bad request - invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found - one or more chat IDs do not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CompactChatsRequest:
      type: object
      required:
        - chatId
      properties:
        chatId:
          type: array
          minItems: 1
          items:
            type: string
            format: uuid
          description: Array of chat IDs to compact
        prompt:
          type: string
          description: >-
            Optional prompt to control what information gets preserved in the
            compacted summary
    CompactChatsResponse:
      type: object
      required:
        - chats
      properties:
        chats:
          type: array
          items:
            $ref: '#/components/schemas/CompactedChat'
          description: Array of compacted chat results
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    CompactedChat:
      type: object
      required:
        - chatId
        - compacted
      properties:
        chatId:
          type: string
          format: uuid
          description: The ID of the chat that was compacted
        compacted:
          type: string
          description: The compacted summary text of the chat

````