🚀 Simplify your work by integrating Haufe Copilot via API
Threads

Create a message

Adds a message to a thread's message stack. Supports user, system, tool, and assistant roles. Cannot add messages to threads created via Chat Completions. Tool messages must follow an assistant message whose tool_call_id matches. System messages should be the first message in a thread.

POST/v1/threads/{thread_id}/messages

Authorization

APIKeyHeader
api-key<token>

In: header

Path Parameters

thread_id*Thread Id
Formatuuid

Request Body

application/json

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/threads/497f6eca-6276-4993-bfeb-53cbbbba6f08/messages" \  -H "Content-Type: application/json" \  -d '{    "content": "Welche Kündigungsfristen gelten während der Probezeit?",    "role": "user"  }'
{  "content": "Welche Kündigungsfristen gelten während der Probezeit?",  "created_at": "2025-03-15T09:12:45.123456Z",  "id": "4d5e6f70-8901-cdef-0123-445566778899",  "role": "user",  "thread_id": "1a2b3c4d-5678-9abc-def0-112233445566"}

{  "error_code": "thread_is_deactivated",  "detail": "Thread is deactivated"}

{  "error_code": "unauthorized",  "detail": "Missing or invalid API key"}
{  "error_code": "attachment_access_forbidden",  "detail": "You do not have permission to access this attachment."}

{  "error_code": "assistant_not_found",  "detail": "Assistant not found"}

{  "error_code": "conflict",  "detail": "Conflict - File is infected with a virus or it's still being processed"}

{  "error_code": "message_content_empty",  "detail": "Message content cannot be empty."}

{  "message": "Rate limit exceeded!"}

{  "error_code": "internal_server_error",  "detail": "Internal Server Error"}
{  "error_code": "attachment_document_not_reachable",  "detail": "The file attachment service does not respond as expected. Please try again later."}
{  "error_code": "internal_service_error",  "detail": "An internal service required for processing the request is currently unavailable. Please try again later."}