Reply to a chat

Posts your next message to an existing chat and starts the next agent turn. The request returns as soon as the message is saved. Poll the chat status until it leaves processing, then get the chat to read the answer.

POST https://chat.betterstack.com/api/v2/chats/{chat_id}/messages

URL parameters

chat_id
required string

Headers

Authorization
required string
Content-Type
required string

Body parameters

message
required string
model
string
201

Response body

{
  "data": {
    "id": "12345",
    "type": "chat",
    "attributes": {
      "team_id": 123456,
      "team_name": "example-team",
      "name": "Checkout 5xx spike",
      "status": "processing",
      "message_count": 4,
      "last_message_at": "2026-09-07T10:35:00.000Z",
      "total_tokens": 15420,
      "model": "anthropic/claude-opus-5.5",
      "total_cost_usd": 0.0928,
      "created_at": "2026-09-07T10:30:00.000Z",
      "updated_at": "2026-09-07T10:35:00.000Z",
      "messages": [
        {
          "id": 9001,
          "message_type": "user",
          "text": "Why did checkout start returning 5xx at 10:15?",
          "artifacts": [],
          "created_at": "2026-09-07T10:30:00.000Z",
          "user": null
        },
        {
          "id": 9002,
          "message_type": "ai",
          "text": "The 5xx responses come from checkout-api pods restarting after the 10:12 deploy of v2.4.0. The new version fails its readiness probe because PAYMENTS_URL is unset. Set it in the deployment manifest and roll out again.",
          "artifacts": [],
          "created_at": "2026-09-07T10:32:18.000Z",
          "user": null
        },
        {
          "id": 9003,
          "message_type": "user",
          "text": "Was the payments service affected too?",
          "artifacts": [],
          "created_at": "2026-09-07T10:35:00.000Z",
          "user": null
        },
        {
          "id": 9004,
          "message_type": "ai",
          "text": null,
          "artifacts": [],
          "created_at": "2026-09-07T10:35:00.000Z",
          "user": null
        }
      ],
      "pending_confirmations": []
    }
  }
}
400

Response body

{
  "errors": "The requested model is not available. Use one of available_models; GET /api/v2/chats/models describes the models a chat can run on.",
  "available_models": [
    "deepseek/deepseek-v4.1-flash",
    "openai/gpt-5.6-sol",
    "anthropic/claude-opus-5.5"
  ]
}
401

Response body

{
  "errors": "Invalid authentication"
}
403

Response body

{
  "errors": "AI SRE is not available on this plan."
}
404

Response body

{
  "errors": "Resource with the provided ID was not found"
}
409

Response body

{
  "errors": "The agent is still working on this chat (status: processing). Poll GET /api/v2/chats/:id/status and retry once it leaves processing."
}
409

Response body

{
  "errors": "The agent is waiting on a tool-use confirmation (status: awaiting_confirmation). Resolve it via PATCH /api/v2/chats/:chat_id/confirmations/:id before replying."
}
422

Response body

{
  "errors": "Sorry, you are missing some required attributes",
  "required_attributes": [
    "message"
  ]
}
422

Response body

{
  "errors": "Sorry, some values are incorrect",
  "invalid_values": {
    "model": "can't be changed on a chat created before model selection"
  }
}

Example cURL

Example
curl --request POST \
  --url https://chat.betterstack.com/api/v2/chats/12345/messages \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "message": "Was the payments service affected too?"
  }'