API REFERENCE
Compact Chats
On this page
/api/chats/compactCompact 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 --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 --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>requiredArray of chat IDs to compact
minItems: 1
Item properties for chatId
string
promptstringOptional prompt to control what information gets preserved in the compacted summary
Responses
200Chats compacted successfully+
application/json
chatsarray<CompactedChat>requiredArray of compacted chat results
Item properties for chats
chatIdstringrequiredThe ID of the chat that was compacted
format: uuid
compactedstringrequiredThe compacted summary text of the chat
400Bad request - invalid parameters+
application/json
errorintegerrequiredformat: int32
messagestringrequired401Unauthorized - invalid or missing API key+
application/json
errorintegerrequiredformat: int32
messagestringrequired404Not found - one or more chat IDs do not exist+
application/json
errorintegerrequiredformat: int32
messagestringrequiredFull specification
Download the OpenAPI file for complete schemas, constraints, and examples.
Download research.jsonView operation source
{
"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"
}
}
}
}
}
}