Add a user message
POST/v1/projects/:project_id/sessions/:session_id/messages
Saves a user message to the session. When auto_generate is enabled on the session and no generation is currently in progress, generation is triggered automatically and the response is the generated turn, the same body ?wait=true generate answers. Otherwise returns the saved user message.
Request
Responses
- 200
- 201
- 400
- 401
- 403
- 404
- 409
- 410
- 413
- 429
- 500
- 502
- 4XX
Duplicate request — original message returned (idempotency_key matched)
User message saved
The request was malformed or failed validation.
Missing or invalid credentials.
The credential is scoped to a different project, or the caller's role in the project does not carry this action.
The resource does not exist (existence is not leaked).
IDEMPOTENCY_KEY_REUSED — the key is already claimed by a message in this session sent from a different request. No message is saved.
SESSION_EXPIRED — the session outlived its time-to-live and takes no more messages.
REQUEST_REJECTED — the request body is over the size the body parser accepts
QUOTA_EXCEEDED: the session auto-generates and an enforce-mode generation quota is exhausted. error.meta carries quota_id, metric, limit, window and resets_at, with a Retry-After header. The message is saved. A session with message_delay_seconds answers 201 before the quota is read.
Unexpected server error — INTERNAL_ERROR, with the raw message never forwarded
The deployment's admission service is asked about this write and did not answer — ADMISSION_UNAVAILABLE; the write did not happen
The deployment's admission service refused this write — answered under the service's own 4xx status, with its code (matching ^[A-Za-z_][A-Za-z0-9_]{0,63}$, not necessarily an ERROR_CODES key), message and meta; the write did not happen. A status this operation also declares on its own is documented there