API reference
The /api/chat endpoint
OpenAPI 3.1 documentation for the PoseyAI chat endpoint — schemas, authentication, streaming semantics and a live request console you can run from this page.
Sends a conversation to PoseyAI and streams the reply back as a UI message stream. When a bearer token and threadId are supplied, the user message and the assistant reply are persisted to that conversation; otherwise the call runs in guest mode with no storage.
Authentication
Optional Authorization: Bearer <JWT> header. With a valid token and a threadId, the exchange is persisted to that conversation under your account. Without either, the request runs in guest mode: fully functional, nothing stored.
Request schema
ChatRequest
| messages* | array | Full conversation history in UI message format. |
| threadId | string | Conversation to persist to. Omit for guest mode (nothing is written to the database). |
UIMessage
| id | string | — |
| role* | string | —(user | assistant | system) |
| parts* | array | — |
MessagePart
| type* | string | `text` for prose, `file` for image or document attachments.(text | file) |
| text | string | — |
| mediaType | string | — |
| url | string | Data URL or https URL of the attachment. |
Responses
| 200 | Server-sent UI message stream of the assistant reply. |
| 400 | Invalid request body — `messages` must be an array. |
| 401 | Session expired or invalid bearer token. |
| 404 | Conversation not found for this user. |
| 500 | AI or backend not configured. |
Example request
curl -N -X POST "$BASE_URL/api/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"threadId": "5f9c1c1e-0a2b-4c1d-9f11-6f0d2a3b4c5d",
"messages": [
{ "role": "user", "parts": [{ "type": "text", "text": "Hello" }] }
]
}'Try it
Response
Run a request to see the streamed response here.