RecoupGet a free auditFree audit

API REFERENCE

Compact Chats

On this page
POST/api/chats/compact

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.

Authentication

See the authentication guide for API key and account access requirements.

Request

cURL
curl --request POST \
  --url 'https://api.recoupable.dev/api/chats/compact' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "chatId": [
    "YOUR_ID"
  ]
}'

Try it

Fill in the fields, send the request from your browser, and read the live response. The curl below updates as you type.

Kept in this browser tab only and cleared when it closes.

cURL for this request
curl --request POST \
  --url 'https://recoup-api.vercel.app/api/chats/compact' \
  --header 'Content-Type: application/json' \
  --data '{
  "chatId": [
    "YOUR_ID"
  ]
}'

Request body required

Chat compaction parameters

application/json

chatIdarray<string>required

Array of chat IDs to compact

minItems: 1

Item properties for chatId

string

promptstring

Optional prompt to control what information gets preserved in the compacted summary

Responses

200Chats compacted successfully

application/json

chatsarray<CompactedChat>required

Array of compacted chat results

Item properties for chats
chatIdstringrequired

The ID of the chat that was compacted

format: uuid

compactedstringrequired

The compacted summary text of the chat

400Bad request - invalid parameters

application/json

errorintegerrequired

format: int32

messagestringrequired
401Unauthorized - invalid or missing API key

application/json

errorintegerrequired

format: int32

messagestringrequired
404Not found - one or more chat IDs do not exist

application/json

errorintegerrequired

format: int32

messagestringrequired

Full specification

Download the OpenAPI file for complete schemas, constraints, and examples.

Download research.json
View operation source
json
{
  "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"
          }
        }
      }
    }
  }
}