API REFERENCE
Copy Chat Messages
On this page
/api/chats/{id}/messages/copyCopy all messages from the source chat (id path param) to a target chat (targetChatId in request body). By default, existing target messages are cleared before copy.
Authentication
See the authentication guide for API key and account access requirements.
Request
curl --request POST \
--url 'https://api.recoupable.dev/api/chats/YOUR_ID/messages/copy' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"targetChatId": "YOUR_ID"
}'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 POST \
--url 'https://recoup-api.vercel.app/api/chats/{id}/messages/copy' \
--header 'Content-Type: application/json' \
--data '{
"targetChatId": "YOUR_ID"
}'Parameters
Path parameters
idstringrequiredThe source chat room UUID.
Request body required
Copy target options
application/json
targetChatIdstringrequiredTarget chat room UUID to receive the copied messages.
format: uuid
clearExistingbooleanWhen true, existing messages in the target chat are deleted before copy.
Default: true
Responses
200Messages copied successfully+
application/json
statusstring · enumrequiredStatus of the request
Values: "success"
source_chat_idstringrequiredSource chat room UUID.
format: uuid
target_chat_idstringrequiredTarget chat room UUID.
format: uuid
copied_countintegerrequiredNumber of messages copied from source to target.
cleared_existingbooleanrequiredWhether existing target messages were deleted before copy.
400Bad request - invalid payload or chat identifiers+
application/json
statusstring · enumrequiredStatus of the request
Values: "error"
errorstringrequiredError message describing what went wrong.
401Unauthorized - invalid or missing credentials+
application/json
errorintegerrequiredformat: int32
messagestringrequired403Forbidden - caller lacks access to source or target chat+
application/json
statusstring · enumrequiredStatus of the request
Values: "error"
errorstringrequiredError message describing what went wrong.
404Not found - source or target chat does not exist+
application/json
statusstring · enumrequiredStatus of the request
Values: "error"
errorstringrequiredError message describing what went wrong.
500Server error - failed to copy messages+
application/json
statusstring · enumrequiredStatus of the request
Values: "error"
errorstringrequiredError message describing what went wrong.
Full specification
Download the OpenAPI file for complete schemas, constraints, and examples.
Download research.jsonView operation source
{
"description": "Copy all messages from the source chat (`id` path param) to a target chat (`targetChatId` in request body). By default, existing target messages are cleared before copy.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The source chat room UUID.",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"description": "Copy target options",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CopyChatMessagesRequest"
}
}
}
},
"responses": {
"200": {
"description": "Messages copied successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CopyChatMessagesResponse"
}
}
}
},
"400": {
"description": "Bad request - invalid payload or chat identifiers",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CopyChatMessagesErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized - invalid or missing credentials",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Forbidden - caller lacks access to source or target chat",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CopyChatMessagesErrorResponse"
}
}
}
},
"404": {
"description": "Not found - source or target chat does not exist",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CopyChatMessagesErrorResponse"
}
}
}
},
"500": {
"description": "Server error - failed to copy messages",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CopyChatMessagesErrorResponse"
}
}
}
}
}
}