POST /v1/sessions- Permission
write:sessions- Tokens
- API key, CLI user token, Session token
Spend limit for this session: session is the most it may spend, in US dollars. Omitted, an agent session keeps the agent's limit and a raw session takes the organization's default. Above the organization's per-session ceiling is a 400. day, week, and month are agent-wide limits and are rejected with a 422.
Claude Code input and native options. Set exactly one of claude_code, codex, or gemini.
Codex input and native options. Set exactly one of claude_code, codex, or gemini.
Conversation settings. Omitted, a raw session is interactive and an agent session keeps the agent's setting. Warmth and prompting are server-owned response fields.
Where the session runs. A STRING is a saved environment's name or env_... id, substituted wholesale. An OBJECT is the whole environment for this session, and {} is the bare environment. Nothing is merged: what you send is the whole environment. Omitted, a raw session runs in the built-in basic environment and an agent session keeps the agent's own environment.
API and webhooks
Start a session with one API call or from a webhook event.