Create Chat

POST /api/v1/chats

Creates a new chat session for the organization. Can be called via Dashboard (JWT) or Public API (API Key).

Path parameters

  • slug string

    Organization Slug (Required for Public API)

application/json

Body Required

Chat Details

  • metadata object Required

    Use the structured type

    Hide metadata attributes Show metadata attributes object
    • avg_response_time number Required

      In seconds

    • country_code string Required

      ISO-3166 country code (e.g., "NL")

    • ip_address string Required
    • is_escalated boolean Required
    • is_forwarded_to_hr boolean Required
    • language_code string Required

      ISO-639 language code (e.g., "tr")

    • question_category string Required
    • sentiment string Required
    • session_id string Required
    • token_count integer Required

      Total tokens for the chat session

    • transcript_link string Required
    • user_rating integer Required

      Optional user rating

  • tags array[string] Required
  • title string Required
  • user_id integer Required

    Optional, for anonymous chats

Responses

  • 201 application/json

    message: Chat created successfully, chat_id: uint64

    Additional properties are allowed.

  • 400 application/json

    Invalid request data

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

    Unauthorized (JWT or 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)

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

    Failed to create chat or process tags/metadata

    Hide response attribute Show response attribute object
    • * string Additional properties
POST /api/v1/chats
curl \
 --request POST 'http://api.example.com/api/v1/chats' \
 --header "x-organization-api-key: $API_KEY" \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"metadata":{"avg_response_time":42.0,"country_code":"string","ip_address":"string","is_escalated":true,"is_forwarded_to_hr":true,"language_code":"string","question_category":"string","sentiment":"string","session_id":"string","token_count":42,"transcript_link":"string","user_rating":42},"tags":["string"],"title":"string","user_id":42}'
Request examples
{
  "metadata": {
    "avg_response_time": 42.0,
    "country_code": "string",
    "ip_address": "string",
    "is_escalated": true,
    "is_forwarded_to_hr": true,
    "language_code": "string",
    "question_category": "string",
    "sentiment": "string",
    "session_id": "string",
    "token_count": 42,
    "transcript_link": "string",
    "user_rating": 42
  },
  "tags": [
    "string"
  ],
  "title": "string",
  "user_id": 42
}
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 (500)
{
  "additionalProperty1": "string",
  "additionalProperty2": "string"
}