Chat
Leverage our chat endpoint for seamless interaction with your agents.
POST/api/v1/chat
Send a Message
This endpoint allows you to add a new conversation between you and a contact or group. A contact or group id is required to create a conversation.
Required attributes
- Name
 messages- Type
 - list(message)
 - Description
 List of objects of roles and content of the message. Send additional messages as the converation history for additional context.
- Name
 message.role- Type
 - string
 - Description
 Role of the message. Can be either
userorassistant.
- Name
 message.content- Type
 - string
 - Description
 The content of the message.
Request
POST
/api/v1/chat  curl --location https://chat.brevian.ai/api/v1/chat \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token}' \
  --data '{
    "messages": [
      {
        "role": "user",
        "content": "Hi"
      }
    ],
    "agentId": "{find this is the URL of the agent you want to use e.g e1bf33db-feb6-49a3-a766-2e727ded3ee9}",
  }'
Response
{
  "id": "1c7f6e67-3aa7-4e85-877d-37c380774407",
  "conversation_id": "617515ac-3ab8-4c7c-b4dd-7e7d59da9076",
  "object": "chat.completion",
  "created": 1709114526.150963,
  "model": "gpt-4-0613",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?"
      },
      "index": 0,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 5,
    "completion_tokens": 11,
    "total_tokens": 16
  }
}