Create session
POST/v1/sessions
Creates a conversation session for the calling end user. output_format fixes the reply form for the session's life, and capabilities or exclude_capabilities what the assistant may use in it (every capability when neither is sent). Include text (and optionally attachments, as in a later message) to start the first task right away: the response then carries its task_id, its reply streams on GET /v1/sessions/{session_id}/events — open it with Last-Event-ID set to the returned last_event_id to receive the task from its first frame — and is kept in the session's message list. Starting a task needs a spendable balance on the project's billing account; creating an empty session does not.
Request
Responses
- 201
- 401
- 404
- 409
- 413
- 422
- 429
- 500
Successful Response
Authentication failed: the credential is missing, malformed, expired, or revoked.
invalid_token— The access token is invalid.project_disabled— This project is not active.token_expired— The access token has expired.user_disabled— This user is not active.
The requested resource does not exist, or is not visible to the caller.
file_not_found— The requested file was not found.file_expired— The requested file has expired.
The request conflicts with the current state of the resource.
idempotency_conflict— This Idempotency-Key belongs to a different request.idempotency_in_progress— The first request with this Idempotency-Key is still in progress. Retry it with the same key shortly.
The request body is larger than the allowed limit.
file_too_large— The file exceeds the maximum allowed size.payload_too_large— The request body is too large.
A request value failed validation; the details array names each offending field.
unsupported_media_type— The media type is not supported.validation_failed— The request payload failed validation.
Either too many requests (a Retry-After header says when to retry) or the billing account is out of credits (no Retry-After — top up to continue); the code field tells the two apart.
insufficient_credits— The billing account has insufficient credits.rate_limited— Too many requests. Please slow down.
An unexpected server-side error occurred.
internal— An unexpected error occurred.