API REFERENCE
Delete Session Chat
On this page
/api/sessions/{sessionId}/chats/{chatId}Removes the chat (cascade clears chat_messages and chat_reads). Refuses with 400 if this is the only chat in the session — sessions must always retain at least one chat.
Authentication
x-api-key in header
BearerAuth bearer
Request
curl --request DELETE \
--url 'https://api.recoupable.dev/api/sessions/YOUR_SESSION_ID/chats/YOUR_CHAT_ID' \
--header 'x-api-key: YOUR_API_KEY'Replace the YOUR_ placeholders with your values. Required query parameters are included; optional parameters are listed below.
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 DELETE \
--url 'https://recoup-api.vercel.app/api/sessions/{sessionId}/chats/{chatId}'Parameters
Path parameters
sessionIdstringrequiredThe id of the parent session.
chatIdstringrequiredThe id of the chat being deleted.
Responses
200Chat deleted successfully.+
application/json
successboolean · enumrequiredValues: true
400Cannot delete the only chat in a session.+
application/json
statusstring · enumrequiredAlways "error" for error responses.
Values: "error"
errorstringrequiredHuman-readable error message.
401Unauthorized — invalid or missing API key / Bearer token.+
application/json
statusstring · enumrequiredAlways "error" for error responses.
Values: "error"
errorstringrequiredHuman-readable error message.
403Forbidden — the authenticated account does not own this session.+
application/json
statusstring · enumrequiredAlways "error" for error responses.
Values: "error"
errorstringrequiredHuman-readable error message.
404Not found — no session exists with the given id, the chat does not exist, or the chat belongs to a different session.+
application/json
statusstring · enumrequiredAlways "error" for error responses.
Values: "error"
errorstringrequiredHuman-readable error message.
500Server error — the chat could not be deleted.+
application/json
statusstring · enumrequiredAlways "error" for error responses.
Values: "error"
errorstringrequiredHuman-readable error message.
Full specification
Download the OpenAPI file for complete schemas, constraints, and examples.
Download sessions.jsonView operation source
{
"summary": "Delete session chat",
"description": "Removes the chat (cascade clears `chat_messages` and `chat_reads`). Refuses with 400 if this is the only chat in the session — sessions must always retain at least one chat.",
"parameters": [
{
"name": "sessionId",
"in": "path",
"required": true,
"description": "The id of the parent session.",
"schema": {
"type": "string"
}
},
{
"name": "chatId",
"in": "path",
"required": true,
"description": "The id of the chat being deleted.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Chat deleted successfully.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeleteSessionChatResponse"
}
}
}
},
"400": {
"description": "Cannot delete the only chat in a session.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized — invalid or missing API key / Bearer token.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Forbidden — the authenticated account does not own this session.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found — no session exists with the given id, the chat does not exist, or the chat belongs to a different session.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"500": {
"description": "Server error — the chat could not be deleted.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}