Create a chat session, optionally with its first turn
POST/api/v2/chat-sessions/
Creating with first_turn persists a user message and queues generation. An empty session returns 201; a session with its first turn returns 202. Responses carry ETag and Content-Language but no Location or Link header. Use active_turn_id to construct the SSE URL. Matching idempotency replay returns the current session. For document sessions, resume with the document_context and optional session_id; the server verifies access to the resolved owner and full file path for the authenticated user. Client-supplied owner and path are not authorization proof.
Request
Responses
- 201
- 202
- 400
- 401
- 403
- 409
- 500
Empty session created
Response Headers
Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.
Prevents storage of sensitive authenticated chat data.
Strong session revision tag. Polish has no suffix; other supported languages append the language code. Use the same Accept-Language on reads and conditional mutations.
Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.
Session and first turn persisted; generation accepted
Response Headers
Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.
Prevents storage of sensitive authenticated chat data.
Strong session revision tag. Polish has no suffix; other supported languages append the language code. Use the same Accept-Language on reads and conditional mutations.
Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.
Malformed request
Response Headers
Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.
Prevents storage of sensitive authenticated chat data.
Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.
Missing or invalid API key
Response Headers
Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.
Prevents storage of sensitive authenticated chat data.
Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.
Authenticated, but the API key's account has no access to this resource
Response Headers
Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.
Prevents storage of sensitive authenticated chat data.
Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.
Request conflicts with current session state
Response Headers
Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.
Prevents storage of sensitive authenticated chat data.
Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.
Unexpected request failure.
Response Headers
Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.
Prevents storage of sensitive authenticated chat data.
Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.