Create session
Create a new Inspect session with an initial prompt. Accepts either `application/json` or `multipart/form-data`. Use multipart when you need to upload file attachments alongside the prompt; put the JSON request in the `data` field. Supports an `Idempotency-Key` request header. When the same key is sent twice from the same API key, the second call returns the originally-created session (HTTP 200) instead of creating a new one. Keys are scoped per API key user and remain valid until the originally-created session is archived; a same-key request after archive starts a fresh session.
Create a new Inspect session with an initial prompt. Accepts either application/json or multipart/form-data. Use multipart when you need to upload file attachments alongside the prompt; put the JSON request in the data field.
Supports an Idempotency-Key request header. When the same key is sent twice from the same API key, the second call returns the originally-created session (HTTP 200) instead of creating a new one. Keys are scoped per API key user and remain valid until the originally-created session is archived; a same-key request after archive starts a fresh session.
bearerAuth sessions:writeAuthorizationBearer <token>API key authentication. Use your API key as the bearer token.
Scope: sessions:write
Idempotency-Key?stringOptional client-supplied key for safe retries. A same-key retry from the same API key user returns the originally-created session (HTTP 200) instead of creating a duplicate. Blank keys are ignored; otherwise 8 to 255 characters. Idempotency is keyed per API key user.
length <= 255- body
review_buddy_reviewers?array<>Optional Review agent reviewers. Each model must be available to the caller and support the requested reasoning effort.
repository*stringThe repository to create the session for. Use "auto" to infer the best repository from the prompt.
1 <= lengthprompt?stringThe initial prompt for the session. At least one of prompt, attachments, or agent_context is required.
title?stringOptional title for the session. When omitted, Inspect generates one from the creation request.
no_reply?booleanIf true, stores the prompt and dispatches the runner silently without posting an assistant reply back into the session timeline.
falsemodel?||Optional model ID or shorthand alias. An explicit model takes precedence over custom-agent and saved-default models; leave unspecified to use the normal default selection. Use GET /api/v2/models for model IDs and aliases.
variant?Models.ModelVariant"low""medium""high""xhigh""max""minimal""none"service_tier?Sessions.ModelServiceTierOptional model service tier. Supported values depend on the selected model; unsupported combinations return 400.
"default""auto""flex""priority"enabled_skill_ids?array<>Optional list of skill IDs to enable for this session in addition to those configured on the caller's user settings, custom agent, or referenced via slash commands in the prompt. Unknown skill IDs are ignored.
base_branch?stringOptional base branch, defaults to the repository's default branch. If provided, Inspect normalizes common Git prefixes and verifies the branch exists on GitHub before creating the session.
base_commit?stringBenchmark mode only (SWE-bench agent). Pins the session to a per-session Code Storage fork of the repository at this commit SHA: full real history up to the commit, no forward history, and no GitHub remote. Required (non-blank) for the SWE-bench agent; ignored for other agents.
branch?stringOptional branch name for the session, only pass this if trying to work on an existing branch
pull_request_number?numberOptional existing pull request number to associate with this session
attach_pull_request?booleanWhether Inspect may automatically associate this session with an existing pull request that matches pull_request_number or branch. Set to false to check out branch without attaching its existing pull request. Pull requests created by this session are still attached. Defaults to true.
trueagent_context?stringOptional additional context for the agent that will not appear in user messages. Useful for providing detailed system context or metadata that should inform the agent but not clutter the visible conversation.
agent_id?stringOptional ID of an agent to use for this session. When provided, the session will be configured with the agent's system prompt, model, capability settings, and any repository restrictions. If the agent is limited to a set of repositories, the chosen repository must be within that set. Private agents cannot be started from the public API. Use GET /api/v2/agents to list available agents and their IDs.
read_only?booleanDeprecatedDeprecated. Read-only sessions are not fully supported: this flag blocks only some Inspect tools and does not restrict other tools, including connector tools. Do not rely on it to prevent changes.
falsevisibility?Sessions.SessionVisibilityControls whether the session appears in discoverable listings and analytics exports. Private sessions remain accessible by direct URL/session ID, but are excluded from list endpoints, public tables, leaderboards, and exports.
"public""private"settings?Optional session settings
collaborators?array<>Optional list of collaborator email addresses to add to the session. Users matching these emails will be added as session participants.
pull_request_footer?stringOptional custom footer text to append to PR descriptions. This will appear between the agent-generated description and the standard Inspect footer.
commit_prefix?stringOptional prefix to prepend to commit messages and PR titles. Useful for linking sessions to external systems like incident trackers or issue management tools.
pull_request_labels?array<>Optional list of GitHub labels to apply to any PR created or adopted by this session. Child sessions inherit these labels automatically.
tags?array<>Optional list of tags for grouping and filtering sessions (for example, run IDs, workflow names, or tenant keys).
items <= 50callback_url?stringOptional HTTPS webhook URL that the session can call back to via the api_callback tool. The hostname must be allowed by Inspect. When provided, the agent inside the session can send structured events to this URL, proxied through the Inspect API.
uriapi_callback_data_schema?Optional JSON Schema describing the expected shape of the data argument of the api_callback tool. Must be an object whose type, when present, is object. The schema is injected verbatim into the api_callback tool's description so the model knows what payload to send back.
api_callback_event_types?array<>Optional non-empty list of allowed event_type values for the api_callback tool. When provided, Inspect exposes those values as the tool schema enum and rejects callbacks whose event_type is not in the list.
1 <= itemson_behalf_of?stringOptional email address of an existing Inspect user to create the session on behalf of. When provided, the session will be owned by and attributed to this user (including git commits and PR authorship) instead of the API key owner. The user must have logged into Inspect at least once.
emailattribution_source?"approval_agent"Optional internal workflow that started the session, for usage attribution. Fixed at creation.
"approval_agent"attributed_session_id?Sessions.SessionIdOptional ID of an existing session in your organization that this session's usage rolls up to, including its session tree and automation. Ignored when no such session exists. Fixed at creation.
Idempotency-Key replay - returns the session originally created for this key.
application/json- response
data*curl -X POST 'https://app.inspect.com/api/v2/sessions' \ -H 'Content-Type: application/json' \ -d '{ "repository": "web"}'{ "data": { "id": "h2k9x4m7q1pd", "title": "Fix signup redirect loop", "description": "Stops the signup flow from redirecting verified users back to /signup and handles expired invite links.", "status": "finished", "retryable": null, "visibility": "public", "model": { "id": "claude-opus-5-5", "name": "Claude Opus 5.5", "provider": "anthropic", "variant": "high", "service_tier": null }, "user": { "id": "Kq8vN3xR7mT2pL5wB9cY4dF6gH1jZ0aE", "name": "Jane Doe", "email": "jane@acme.com", "avatar_url": "https://lh3.googleusercontent.com/a/ACg8ocJ4kP9xQ2mV7nR3tW8yB5cL1dF6hG0sZeA=s96-c" }, "opening_pull_request": false, "pushing": false, "working_phase": null, "deploy": { "active": true, "url": "https://web-git-jane-inspect-fix-signup-redirect-3f9a-acme.vercel.app", "commit_sha": "9c4e1b7a2f6d8e3c5b0a9f1e7d2c4b6a8e0f3d5c", "latest_commit_sha": "9c4e1b7a2f6d8e3c5b0a9f1e7d2c4b6a8e0f3d5c", "last_succeeded_at": "2026-10-28T16:05:37.000Z", "last_attempt_status": "succeeded", "last_attempt_commit_sha": "9c4e1b7a2f6d8e3c5b0a9f1e7d2c4b6a8e0f3d5c", "last_attempt_started_at": 1793203351000, "timed_out": false, "outdated": false }, "vnc_url": null, "vnc_expires_at": null, "ota_install_url": null, "ota_qr_code_url": null, "ota_expires_at": null, "has_changes": true, "created_at": "2026-10-28T15:42:11.204Z", "finished_at": "2026-10-28T16:07:45.918Z", "last_read_at": "2026-10-28T16:12:03.441Z", "deleted_at": null, "pull_requests": [ { "repository": "web", "github_repository": "web", "url": "https://github.com/acme/web/pull/1842", "pull_request_number": 1842, "adopted_at": "2026-10-28T15:56:40.117Z", "status_updated_at": "2026-10-28T16:10:04.871Z", "title": "Fix signup redirect loop for verified users", "review_session_id": "d4f7j2l9s6ub", "approval_status": { "stamp_buddy": { "source_sequence": 7, "generation": 2, "publication_sequence": 3, "head_sha": "9c4e1b7a2f6d8e3c5b0a9f1e7d2c4b6a8e0f3d5c", "base_branch": "main", "view_status": "ready", "status": "success", "current": true, "reason": null, "rationale": { "version": 1, "sections": [ { "title": "Checks", "items": [ { "title": "CI", "status": "passed", "summary": "All required checks passed on the latest commit.", "session_ids": [ "d4f7j2l9s6ub" ], "details": [ { "label": "Required checks", "text": null, "values": [ "build", "test", "lint" ] } ] } ] } ] }, "risk_tier": "low", "auto_approval": "approved", "history": [ { "head_sha": "9c4e1b7a2f6d8e3c5b0a9f1e7d2c4b6a8e0f3d5c", "session_id": "d4f7j2l9s6ub", "status": "success", "auto_approval": "approved", "updated_at": "2026-10-28T16:09:58.204Z" } ], "grant_approval_binding": null, "updated_at": "2026-10-28T16:09:58.204Z" }, "smart_reviewer": { "source_sequence": 7, "generation": 2, "publication_sequence": 3, "head_sha": "9c4e1b7a2f6d8e3c5b0a9f1e7d2c4b6a8e0f3d5c", "base_branch": "main", "status": "success", "current": true, "reason": null, "recommendation": { "login": "mchen", "status": "requested", "reasoning": "Owns the signup and invite flows and reviewed the last three changes to apps/web/src/auth.", "selection_reason": "Most recent reviewer of the changed files" }, "request_review_binding": null, "updated_at": "2026-10-28T16:10:04.871Z" } }, "status": "awaiting_review", "merged_at": null, "author": { "login": "jane-acme", "display_name": "Jane Doe", "avatar_url": "https://avatars.githubusercontent.com/u/48151623?v=4", "profile_url": "https://github.com/jane-acme" } } ], "repositories": [ { "id": "web", "state_updated_at": "2026-10-28T16:05:12.330Z", "branch": "jane/inspect-fix-signup-redirect-3f9a", "base_branch": "main", "latest_commit_sha": "9c4e1b7a2f6d8e3c5b0a9f1e7d2c4b6a8e0f3d5c", "diff": { "file_id": "session-h2k9x4m7q1pd-w8r3n5t1y6ka.diff", "local_file_id": "session-h2k9x4m7q1pd-q3v8m1k6z2ta.diff", "source": "github", "additions": 48, "deletions": 11 } } ], "branch": "jane/inspect-fix-signup-redirect-3f9a", "base_branch": "main", "stack_base_branch": null, "helpfulness": 1, "helpfulness_reason": "Found the root cause on the first pass.", "total_input_tokens": 1284530, "total_output_tokens": 38214, "total_reasoning_tokens": 12907, "total_cache_read_tokens": 1102345, "total_cache_write_tokens": 96410, "total_tokens": 1322744, "total_cost": 4.82, "last_user_message_at": "2026-10-28T15:58:22.610Z", "parent_session_id": null, "project_id": null, "child_sessions": [ { "id": "c8w3n6y1t5rb", "title": "Audit invite link expiry handling", "name": "invite-expiry-audit", "status": "finished", "created_at": "2026-10-28T15:47:29.552Z" } ], "tags": [ "signup", "web-oncall" ], "automation": { "id": "u9e2r5t8y3wq", "name": "Nightly dependency upgrades" }, "automation_trigger_source": null, "contextual_actions": { "source_assistant_message_id": "msg_laminar_h2k9x4m7q1pd_msg_laminar_user_41", "suggestions": [ { "action_key": "request_review", "label": "Request review", "prompt": null, "repository": "web", "pull_request_number": 1842 } ] }, "settings": { "ci_failures_enabled": true, "auto_address_pull_request_reviews_policy": { "enabled": true, "reviewer_categories": { "human": true, "bot": false }, "identity_rules": [ { "selector": "bot:49699333", "rule_type": "block" } ], "review_buddy": { "enabled": true, "enabled_finding_types": [ "critical", "warning" ] } } }, "viewer_is_owner": true, "read_only": false, "participants": [ { "id": null, "session_id": "h2k9x4m7q1pd", "user_id": "Kq8vN3xR7mT2pL5wB9cY4dF6gH1jZ0aE", "joined_at": "2026-10-28T15:42:11.204Z", "last_active_at": "2026-10-28T16:12:03.441Z", "left_at": null, "user": { "id": "Kq8vN3xR7mT2pL5wB9cY4dF6gH1jZ0aE", "name": "Jane Doe", "email": "jane@acme.com", "avatar_url": "https://lh3.googleusercontent.com/a/ACg8ocJ4kP9xQ2mV7nR3tW8yB5cL1dF6hG0sZeA=s96-c" } } ], "agent": { "id": "a6g3k8e1v9ym", "name": "Frontend fixer", "model": "claude-opus-5-5", "avatar_url": null }, "workspace": { "id": "web", "name": "web", "description": "Acme customer dashboard and marketing site", "organization": "acme", "remote": "github", "github_host": "github", "base_branch": "main" } }}