Skip to Content

Send a message

POST/api/v1/threads/{id}/messages

Sends a member message and receives the reply synchronously or as a stream.

Path parameters

idstringrequired(matches ^thr_)

Thread identifier (thr_…).

Request body

textstringrequired(1 to 4000 characters)

Message text sent by the member.

streambooleanoptionaldefault: false

When false (default), returns a single JSON payload once generation finishes. When true, streams Server-Sent Events.

Delivery modes

Synchronous (stream: false): Returns 200 OK (application/json) with the thread ID and message object (id, role, text, created_at).

Streaming (stream: true): Returns 200 OK (text/event-stream) emitting SSE frames:

  • status: Progress steps and UI labels (thinking, reading_your_notes, searching, replying).
  • delta: Incremental text chunks.
  • done: Emitted when the turn finishes and is persisted to the thread.

See the Streaming replies guide for client implementations.

Returns

HTTP Status Codes

200 OKMessageOutput | EventStreamoptional

Message processed and reply returned.

401 UnauthorizedErroroptional

The integration key is missing, invalid, or revoked.

404 Not FoundErroroptional

No thread exists with this ID in your organisation.

409 ConflictErroroptional

Member onboarding is incomplete. Complete onboarding before sending messages.

422 Unprocessable EntityErroroptional

Validation failed (empty text or text over 4,000 characters).

503 Service UnavailableErroroptional

Coach temporarily unavailable. Safe to retry with backoff.

curl -X POST "https://api.bellacoach.ai/api/v1/threads/thr_9c41f0b7a2d64e83b15c7f20/messages" \ -H "Authorization: Bearer $BELLA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "What exercises are safe during week 24 of pregnancy?", "stream": false }'

Response (200 OK, application/json)

{ "thread": "thr_9c41f0b7a2d64e83b15c7f20", "message": { "id": "msg_7d02edd7fc430c94162cba02", "role": "coach", "text": "At 24 weeks, maintaining moderate-intensity strength training is great for back support and stamina. Focus on squats, hip hinge variations, and diaphragmatic breathing, while avoiding movements that cause abdominal coning.", "created_at": "2026-11-08T23:08:00.123456Z" } }

Next steps

Last updated on