RecoupGet a Free AuditFree Audit

API REFERENCE

Copy Chat Messages

On this page
POST/api/chats/{id}/messages/copy

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.

Authentication

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

Request

cURL
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.

Parameters

Path parameters

idstringrequired

The source chat room UUID.

Request body required

Copy target options

application/json

targetChatIdstringrequired

Target chat room UUID to receive the copied messages.

format: uuid

clearExistingboolean

When true, existing messages in the target chat are deleted before copy.

Default: true

Responses

200Messages copied successfully

application/json

statusstring · enumrequired

Status of the request

Values: "success"

source_chat_idstringrequired

Source chat room UUID.

format: uuid

target_chat_idstringrequired

Target chat room UUID.

format: uuid

copied_countintegerrequired

Number of messages copied from source to target.

cleared_existingbooleanrequired

Whether existing target messages were deleted before copy.

400Bad request - invalid payload or chat identifiers

application/json

statusstring · enumrequired

Status of the request

Values: "error"

errorstringrequired

Error message describing what went wrong.

401Unauthorized - invalid or missing credentials

application/json

errorintegerrequired

format: int32

messagestringrequired
403Forbidden - caller lacks access to source or target chat

application/json

statusstring · enumrequired

Status of the request

Values: "error"

errorstringrequired

Error message describing what went wrong.

404Not found - source or target chat does not exist

application/json

statusstring · enumrequired

Status of the request

Values: "error"

errorstringrequired

Error message describing what went wrong.

500Server error - failed to copy messages

application/json

statusstring · enumrequired

Status of the request

Values: "error"

errorstringrequired

Error message describing what went wrong.

Full specification

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

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