Create Message

POST /api/v1/orgs/{slug}/chats/{chatID}/messages

Adds a new message to an existing chat session. Can be called via Public API (API Key).

Path parameters

  • slug string Required

    Organization Slug

  • chatID integer Required

    Chat ID

application/json

Body Required

Message Details (role, content, metadata)

  • content string Required
  • metadata object Required

    Use structured type

    Hide metadata attributes Show metadata attributes object
    • response_time number Required

      In milliseconds

    • token_count integer Required
  • role string Required

Responses

  • 201 application/json

    message: Message created successfully, message_id: uint64

    Additional properties are allowed.

  • 400 application/json

    Invalid chat ID or request data (role, content, metadata validation)

    Hide response attribute Show response attribute object
    • * string Additional properties
  • 401 application/json

    Unauthorized (API Key invalid/missing or Org ID not found)

    Hide response attribute Show response attribute object
    • * string Additional properties
  • 403 application/json

    Forbidden (API Key doesn't match slug or chat doesn't belong to org)

    Hide response attribute Show response attribute object
    • * string Additional properties
  • 404 application/json

    Chat not found

    Hide response attribute Show response attribute object
    • * string Additional properties
  • 500 application/json

    Failed to get chat or create message

    Hide response attribute Show response attribute object
    • * string Additional properties
POST /api/v1/orgs/{slug}/chats/{chatID}/messages
curl \
 --request POST 'http://api.example.com/api/v1/orgs/{slug}/chats/{chatID}/messages' \
 --header "x-organization-api-key: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"content":"string","metadata":{"response_time":42.0,"token_count":42},"role":"string"}'
Request examples
{
  "content": "string",
  "metadata": {
    "response_time": 42.0,
    "token_count": 42
  },
  "role": "string"
}
Response examples (201)
{}
Response examples (400)
{
  "additionalProperty1": "string",
  "additionalProperty2": "string"
}
Response examples (401)
{
  "additionalProperty1": "string",
  "additionalProperty2": "string"
}
Response examples (403)
{
  "additionalProperty1": "string",
  "additionalProperty2": "string"
}
Response examples (404)
{
  "additionalProperty1": "string",
  "additionalProperty2": "string"
}
Response examples (500)
{
  "additionalProperty1": "string",
  "additionalProperty2": "string"
}