---
title: "Create session"
description: "Creates a new agent session in the given environment (or the organization's default when omitted). Picked repositories are validated against the organization's repository catalog before being attached."
url: "https://www.thecompany.company/docs/api/sessions/create"
---

# Create session

> Creates a new agent session in the given environment (or the organization's default when omitted). Picked repositories are validated against the organization's repository catalog before being attached.

- **Surface:** The App API
- **Endpoint:** `POST https://api.thecompany.company/v1/sessions`
- **Operation ID:** `sessions.create`
- **Authentication:** `Authorization: Bearer <TOKEN>`

## Request Body (`application/json`)

**Required:** Yes

Schema: `SessionCreateInput`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string \| null` | No | Optional client-generated TypeID (`asess_…`). Lets callers navigate and sync to the new session before the server round-trip completes; the underlying UUIDv7 keeps the id space time-ordered so cursor pagination on `id DESC` stays consistent. Format-validated at the boundary so a rogue string can't become a session PK. |
| `name` | `string` | No | Human-readable display name. If omitted, a random fun name is generated. |
| `model` | `object` | No |  |
| `model.modelId` | `string` | Yes |  |
| `model.reasoning` | `string` | Yes |  |
| `model.speed` | `string \| null` | No |  |
| `browserId` | `string \| null` | No | Optional browser identity selected before the first turn. Must be readable in the session organization. Omitted or null keeps inherited/default browser resolution. |
| `environmentId` | `string \| null` | No | Environment to run the session in. Validated to exist; when omitted, the organization's default environment is used. |
| `repositories` | `array<SessionRepositoryPick>` | No | Repositories selected in the composer (0..n, each a catalog repository in the organization). The agent loads context for these and provisioning refreshes their working trees. When omitted, defaults to the resolved environment's repositories; an explicitly empty list attaches none. |
| `repositories[].id` | `string \| null` | No | Optional client-generated TypeID (`sessrepo_...`) so optimistic inserts keep a stable id across the sync echo. Format-validated at the boundary. |
| `repositories[].repositoryId` | `string` | Yes | TypeID with prefix "repo_". |
| `events` | `array<object \| TextSubmitted \| Stopped \| ...>` | No | Optional harness events seeded into the new session (typically a MessagesSubmitted to start the first turn). Carried on the actor create call and processed when the actor boots, before it serves any read; a failing event is logged and skipped actor-side (later events still apply) and never fails creation. |
| `events[] (object).idempotencyKey` | `string` | Yes | Idempotency identity for one inbound session-event delivery. Reusing a key returns duplicate. |
| `events[] (object).event` | `TextSubmitted \| Stopped \| SessionSuggestionResolved \| ...` | Yes |  |
| `events[] (object).event (TextSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (TextSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (TextSubmitted).messages` | `array<TextInput>` | Yes |  |
| `events[] (object).event (TextSubmitted).messages[].content` | `string` | Yes |  |
| `events[] (object).event (Stopped)._tag` | `string` | Yes |  |
| `events[] (object).event (Stopped).operationId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionResolved)._tag` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionResolved).suggestionId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionResolved).outcome` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionResolved).sessionId` | `string \| null` | No | TypeID with prefix "asess_" (format-validated). |
| `events[] (object).event (SessionSuggestionResolved).claimId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionResolved).operationId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionClaimRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).suggestionId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).claimId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).placement` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).sessionId` | `string` | Yes | TypeID with prefix "asess_" (format-validated). |
| `events[] (object).event (SessionSuggestionClaimRequested).operationId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionClaimReleased)._tag` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimReleased).suggestionId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimReleased).claimId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimReleased).error` | `string` | No |  |
| `events[] (object).event (SessionSuggestionClaimReleased).operationId` | `string` | No |  |
| `events[] (object).event (Resumed)._tag` | `string` | Yes |  |
| `events[] (object).event (Resumed).operationId` | `string` | No |  |
| `events[] (object).event (Cancelled)._tag` | `string` | Yes |  |
| `events[] (object).event (Cancelled).operationId` | `string` | No |  |
| `events[] (object).event (Cancelled).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueCancelled)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueCancelled).operationId` | `string` | No |  |
| `events[] (object).event (Steered)._tag` | `string` | Yes |  |
| `events[] (object).event (Steered).operationId` | `string` | No |  |
| `events[] (object).event (Steered).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueFolded)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueFolded).operationId` | `string` | No |  |
| `events[] (object).event (QueueFolded).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (Rewound)._tag` | `string` | Yes |  |
| `events[] (object).event (Rewound).operationId` | `string` | No |  |
| `events[] (object).event (Rewound).messageId` | `number` | Yes |  |
| `events[] (object).event (Rewound).restoreWorkspace` | `boolean` | No |  |
| `events[] (object).event (BranchSwitched)._tag` | `string` | Yes |  |
| `events[] (object).event (BranchSwitched).operationId` | `string` | No |  |
| `events[] (object).event (BranchSwitched).branchId` | `number` | Yes |  |
| `events[] (object).event (Regenerated)._tag` | `string` | Yes |  |
| `events[] (object).event (Regenerated).operationId` | `string` | No |  |
| `events[] (object).event (Regenerated).messageId` | `number` | Yes |  |
| `events[] (object).event (Retried)._tag` | `string` | Yes |  |
| `events[] (object).event (Retried).operationId` | `string` | No |  |
| `events[] (object).event (Edited)._tag` | `string` | Yes |  |
| `events[] (object).event (Edited).operationId` | `string` | No |  |
| `events[] (object).event (Edited).messageId` | `number` | Yes |  |
| `events[] (object).event (Edited).parts` | `array<any>` | Yes |  |
| `events[] (object).event (QueueEdited)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueEdited).operationId` | `string` | No |  |
| `events[] (object).event (QueueEdited).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueEdited).message` | `any` | Yes |  |
| `events[] (object).event (QueueEdited).releaseHold` | `boolean` | No |  |
| `events[] (object).event (QueueHeld)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueHeld).operationId` | `string` | No |  |
| `events[] (object).event (QueueHeld).index` | `integer` | Yes |  |
| `events[] (object).event (QueueHeld).strategy` | `string \| null` | No |  |
| `events[] (object).event (QueueReleased)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueReleased).operationId` | `string` | No |  |
| `events[] (object).event (QueueReleased).index` | `integer` | Yes |  |
| `events[] (object).event (QueueEntryHeld)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueEntryHeld).operationId` | `string` | No |  |
| `events[] (object).event (QueueEntryHeld).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueEntryHeld).strategy` | `string \| null` | No |  |
| `events[] (object).event (QueueEntryHeld).reason` | `string \| null` | No |  |
| `events[] (object).event (QueueEntryReleased)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueEntryReleased).operationId` | `string` | No |  |
| `events[] (object).event (QueueEntryReleased).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueEntryReleased).wake` | `boolean` | No |  |
| `events[] (object).event (QueueMoved)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueMoved).operationId` | `string` | No |  |
| `events[] (object).event (QueueMoved).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueMoved).to` | `integer` | Yes |  |
| `events[] (object).event (ToolResultSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (ToolResultSubmitted).results` | `array<object>` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).toolCallId` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).state` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).errorText` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).toolCallId` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).state` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).output` | `any` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).mode` | `string` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).name` | `string` | No |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).persisted` | `boolean` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).status` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (QuestionAnswerSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).status` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).answers` | `array<object>` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).answers[].question` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).answers[].answer` | `string \| array<string>` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (DetachedInteractionSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted).toolName` | `string` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted).resolution` | `any` | Yes |  |
| `events[] (object).event (ToolApprovalResponded)._tag` | `string` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).operationId` | `string` | No |  |
| `events[] (object).event (ToolApprovalResponded).responses` | `array<object>` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].approvalId` | `string` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].toolCallId` | `string` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].approved` | `boolean` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].reason` | `string` | No |  |
| `events[] (object).event (MessagesSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (MessagesSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (MessagesSubmitted).messages` | `array<any>` | Yes |  |
| `events[] (object).event (MessagesSubmitted).behavior` | `string \| null` | No |  |
| `events[] (object).event (MessagesSubmitted).queue` | `object` | No |  |
| `events[] (object).event (MessagesSubmitted).queue.index` | `integer` | No |  |
| `events[] (object).event (MessagesSubmitted).queue.hold` | `boolean` | No |  |
| `events[] (object).event (MessageReactionSet)._tag` | `string` | Yes |  |
| `events[] (object).event (MessageReactionSet).operationId` | `string` | No |  |
| `events[] (object).event (MessageReactionSet).messageId` | `string` | Yes |  |
| `events[] (object).event (MessageReactionSet).emoji` | `string` | Yes |  |
| `events[] (object).event (MessageReactionSet).active` | `boolean` | Yes |  |
| `events[] (object).event (ModelConfigChanged)._tag` | `string` | Yes |  |
| `events[] (object).event (ModelConfigChanged).operationId` | `string` | No |  |
| `events[] (object).event (ModelConfigChanged).config` | `object` | Yes |  |
| `events[] (object).event (ModelConfigChanged).config.modelId` | `string` | Yes |  |
| `events[] (object).event (ModelConfigChanged).config.reasoning` | `string` | Yes |  |
| `events[] (object).event (ModelConfigChanged).config.speed` | `string \| null` | No |  |
| `events[] (object).event (SubscriptionPin)._tag` | `string` | Yes |  |
| `events[] (object).event (SubscriptionPin).operationId` | `string` | No |  |
| `events[] (object).event (SubscriptionPin).provider` | `string` | Yes |  |
| `events[] (object).event (SubscriptionPin).connectionId` | `string` | Yes |  |
| `events[] (object).event (ModeChanged)._tag` | `string` | Yes |  |
| `events[] (object).event (ModeChanged).operationId` | `string` | No |  |
| `events[] (object).event (ModeChanged).mode` | `string \| null` | Yes |  |
| `events[] (object).event (ModeChanged).ifUnset` | `boolean` | No | Apply only while the session has no active and no displaced mode. Reconciliation pushes (e.g. guide posture healing) use it so a re-assertion can never clobber a live mode such as plan. |
| `events[] (object).event (AllowedModesChanged)._tag` | `string` | Yes |  |
| `events[] (object).event (AllowedModesChanged).operationId` | `string` | No |  |
| `events[] (object).event (AllowedModesChanged).modes` | `array<string> \| null` | Yes |  |
| `events[] (object).event (CompactionRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (CompactionRequested).operationId` | `string` | No |  |
| `events[] (object).event (CompactionRequested).instructions` | `string` | No |  |
| `events[] (object).event (CompactionRequested).attemptId` | `string \| null` | No |  |
| `events[] (object).event (GoalSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (GoalSubmitted).message` | `any` | Yes |  |
| `events[] (object).event (GoalSubmitted).tokenBudget` | `integer \| null` | Yes |  |
| `events[] (object).event (GoalSubmitted).behavior` | `string \| null` | No |  |
| `events[] (object).event (GoalEdited)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalEdited).operationId` | `string` | No |  |
| `events[] (object).event (GoalEdited).objective` | `string \| null` | No |  |
| `events[] (object).event (GoalEdited).budget` | `object` | No |  |
| `events[] (object).event (GoalEdited).budget.tokenBudget` | `integer \| null` | Yes |  |
| `events[] (object).event (GoalEdited).revision` | `integer` | Yes |  |
| `events[] (object).event (GoalPauseRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalPauseRequested).operationId` | `string` | No |  |
| `events[] (object).event (GoalResumeRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalResumeRequested).operationId` | `string` | No |  |
| `events[] (object).event (GoalCleared)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalCleared).operationId` | `string` | No |  |
| `events[] (object).deliveryId` | `string` | Yes | Idempotency identity for one inbound session-event delivery. Reusing a key returns duplicate. |
| `events[] (object).idempotencyKey` | `string \| null` | No | Idempotency identity for one inbound session-event delivery. Reusing a key returns duplicate. |
| `events[] (object).event` | `TextSubmitted \| Stopped \| SessionSuggestionResolved \| ...` | Yes |  |
| `events[] (object).event (TextSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (TextSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (TextSubmitted).messages` | `array<TextInput>` | Yes |  |
| `events[] (object).event (TextSubmitted).messages[].content` | `string` | Yes |  |
| `events[] (object).event (Stopped)._tag` | `string` | Yes |  |
| `events[] (object).event (Stopped).operationId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionResolved)._tag` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionResolved).suggestionId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionResolved).outcome` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionResolved).sessionId` | `string \| null` | No | TypeID with prefix "asess_" (format-validated). |
| `events[] (object).event (SessionSuggestionResolved).claimId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionResolved).operationId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionClaimRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).suggestionId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).claimId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).placement` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimRequested).sessionId` | `string` | Yes | TypeID with prefix "asess_" (format-validated). |
| `events[] (object).event (SessionSuggestionClaimRequested).operationId` | `string` | No |  |
| `events[] (object).event (SessionSuggestionClaimReleased)._tag` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimReleased).suggestionId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimReleased).claimId` | `string` | Yes |  |
| `events[] (object).event (SessionSuggestionClaimReleased).error` | `string` | No |  |
| `events[] (object).event (SessionSuggestionClaimReleased).operationId` | `string` | No |  |
| `events[] (object).event (Resumed)._tag` | `string` | Yes |  |
| `events[] (object).event (Resumed).operationId` | `string` | No |  |
| `events[] (object).event (Cancelled)._tag` | `string` | Yes |  |
| `events[] (object).event (Cancelled).operationId` | `string` | No |  |
| `events[] (object).event (Cancelled).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueCancelled)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueCancelled).operationId` | `string` | No |  |
| `events[] (object).event (Steered)._tag` | `string` | Yes |  |
| `events[] (object).event (Steered).operationId` | `string` | No |  |
| `events[] (object).event (Steered).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueFolded)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueFolded).operationId` | `string` | No |  |
| `events[] (object).event (QueueFolded).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (Rewound)._tag` | `string` | Yes |  |
| `events[] (object).event (Rewound).operationId` | `string` | No |  |
| `events[] (object).event (Rewound).messageId` | `number` | Yes |  |
| `events[] (object).event (Rewound).restoreWorkspace` | `boolean` | No |  |
| `events[] (object).event (BranchSwitched)._tag` | `string` | Yes |  |
| `events[] (object).event (BranchSwitched).operationId` | `string` | No |  |
| `events[] (object).event (BranchSwitched).branchId` | `number` | Yes |  |
| `events[] (object).event (Regenerated)._tag` | `string` | Yes |  |
| `events[] (object).event (Regenerated).operationId` | `string` | No |  |
| `events[] (object).event (Regenerated).messageId` | `number` | Yes |  |
| `events[] (object).event (Retried)._tag` | `string` | Yes |  |
| `events[] (object).event (Retried).operationId` | `string` | No |  |
| `events[] (object).event (Edited)._tag` | `string` | Yes |  |
| `events[] (object).event (Edited).operationId` | `string` | No |  |
| `events[] (object).event (Edited).messageId` | `number` | Yes |  |
| `events[] (object).event (Edited).parts` | `array<any>` | Yes |  |
| `events[] (object).event (QueueEdited)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueEdited).operationId` | `string` | No |  |
| `events[] (object).event (QueueEdited).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueEdited).message` | `any` | Yes |  |
| `events[] (object).event (QueueEdited).releaseHold` | `boolean` | No |  |
| `events[] (object).event (QueueHeld)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueHeld).operationId` | `string` | No |  |
| `events[] (object).event (QueueHeld).index` | `integer` | Yes |  |
| `events[] (object).event (QueueHeld).strategy` | `string \| null` | No |  |
| `events[] (object).event (QueueReleased)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueReleased).operationId` | `string` | No |  |
| `events[] (object).event (QueueReleased).index` | `integer` | Yes |  |
| `events[] (object).event (QueueEntryHeld)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueEntryHeld).operationId` | `string` | No |  |
| `events[] (object).event (QueueEntryHeld).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueEntryHeld).strategy` | `string \| null` | No |  |
| `events[] (object).event (QueueEntryHeld).reason` | `string \| null` | No |  |
| `events[] (object).event (QueueEntryReleased)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueEntryReleased).operationId` | `string` | No |  |
| `events[] (object).event (QueueEntryReleased).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueEntryReleased).wake` | `boolean` | No |  |
| `events[] (object).event (QueueMoved)._tag` | `string` | Yes |  |
| `events[] (object).event (QueueMoved).operationId` | `string` | No |  |
| `events[] (object).event (QueueMoved).queueEntryId` | `number` | Yes |  |
| `events[] (object).event (QueueMoved).to` | `integer` | Yes |  |
| `events[] (object).event (ToolResultSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (ToolResultSubmitted).results` | `array<object>` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).toolCallId` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).state` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).errorText` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).toolCallId` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).state` | `string` | Yes |  |
| `events[] (object).event (ToolResultSubmitted).results[] (object).output` | `any` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).mode` | `string` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).name` | `string` | No |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).persisted` | `boolean` | Yes |  |
| `events[] (object).event (SecretAskOutcomeSubmitted).status` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (QuestionAnswerSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).status` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).answers` | `array<object>` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).answers[].question` | `string` | Yes |  |
| `events[] (object).event (QuestionAnswerSubmitted).answers[].answer` | `string \| array<string>` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (DetachedInteractionSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted).toolName` | `string` | Yes |  |
| `events[] (object).event (DetachedInteractionSubmitted).resolution` | `any` | Yes |  |
| `events[] (object).event (ToolApprovalResponded)._tag` | `string` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).operationId` | `string` | No |  |
| `events[] (object).event (ToolApprovalResponded).responses` | `array<object>` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].approvalId` | `string` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].toolCallId` | `string` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].approved` | `boolean` | Yes |  |
| `events[] (object).event (ToolApprovalResponded).responses[].reason` | `string` | No |  |
| `events[] (object).event (MessagesSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (MessagesSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (MessagesSubmitted).messages` | `array<any>` | Yes |  |
| `events[] (object).event (MessagesSubmitted).behavior` | `string \| null` | No |  |
| `events[] (object).event (MessagesSubmitted).queue` | `object` | No |  |
| `events[] (object).event (MessagesSubmitted).queue.index` | `integer` | No |  |
| `events[] (object).event (MessagesSubmitted).queue.hold` | `boolean` | No |  |
| `events[] (object).event (MessageReactionSet)._tag` | `string` | Yes |  |
| `events[] (object).event (MessageReactionSet).operationId` | `string` | No |  |
| `events[] (object).event (MessageReactionSet).messageId` | `string` | Yes |  |
| `events[] (object).event (MessageReactionSet).emoji` | `string` | Yes |  |
| `events[] (object).event (MessageReactionSet).active` | `boolean` | Yes |  |
| `events[] (object).event (ModelConfigChanged)._tag` | `string` | Yes |  |
| `events[] (object).event (ModelConfigChanged).operationId` | `string` | No |  |
| `events[] (object).event (ModelConfigChanged).config` | `object` | Yes |  |
| `events[] (object).event (ModelConfigChanged).config.modelId` | `string` | Yes |  |
| `events[] (object).event (ModelConfigChanged).config.reasoning` | `string` | Yes |  |
| `events[] (object).event (ModelConfigChanged).config.speed` | `string \| null` | No |  |
| `events[] (object).event (SubscriptionPin)._tag` | `string` | Yes |  |
| `events[] (object).event (SubscriptionPin).operationId` | `string` | No |  |
| `events[] (object).event (SubscriptionPin).provider` | `string` | Yes |  |
| `events[] (object).event (SubscriptionPin).connectionId` | `string` | Yes |  |
| `events[] (object).event (ModeChanged)._tag` | `string` | Yes |  |
| `events[] (object).event (ModeChanged).operationId` | `string` | No |  |
| `events[] (object).event (ModeChanged).mode` | `string \| null` | Yes |  |
| `events[] (object).event (ModeChanged).ifUnset` | `boolean` | No | Apply only while the session has no active and no displaced mode. Reconciliation pushes (e.g. guide posture healing) use it so a re-assertion can never clobber a live mode such as plan. |
| `events[] (object).event (AllowedModesChanged)._tag` | `string` | Yes |  |
| `events[] (object).event (AllowedModesChanged).operationId` | `string` | No |  |
| `events[] (object).event (AllowedModesChanged).modes` | `array<string> \| null` | Yes |  |
| `events[] (object).event (CompactionRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (CompactionRequested).operationId` | `string` | No |  |
| `events[] (object).event (CompactionRequested).instructions` | `string` | No |  |
| `events[] (object).event (CompactionRequested).attemptId` | `string \| null` | No |  |
| `events[] (object).event (GoalSubmitted)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalSubmitted).operationId` | `string` | No |  |
| `events[] (object).event (GoalSubmitted).message` | `any` | Yes |  |
| `events[] (object).event (GoalSubmitted).tokenBudget` | `integer \| null` | Yes |  |
| `events[] (object).event (GoalSubmitted).behavior` | `string \| null` | No |  |
| `events[] (object).event (GoalEdited)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalEdited).operationId` | `string` | No |  |
| `events[] (object).event (GoalEdited).objective` | `string \| null` | No |  |
| `events[] (object).event (GoalEdited).budget` | `object` | No |  |
| `events[] (object).event (GoalEdited).budget.tokenBudget` | `integer \| null` | Yes |  |
| `events[] (object).event (GoalEdited).revision` | `integer` | Yes |  |
| `events[] (object).event (GoalPauseRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalPauseRequested).operationId` | `string` | No |  |
| `events[] (object).event (GoalResumeRequested)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalResumeRequested).operationId` | `string` | No |  |
| `events[] (object).event (GoalCleared)._tag` | `string` | Yes |  |
| `events[] (object).event (GoalCleared).operationId` | `string` | No |  |
| `events[] (TextSubmitted)._tag` | `string` | Yes |  |
| `events[] (TextSubmitted).operationId` | `string` | No |  |
| `events[] (TextSubmitted).messages` | `array<TextInput>` | Yes |  |
| `events[] (TextSubmitted).messages[].content` | `string` | Yes |  |
| `events[] (Stopped)._tag` | `string` | Yes |  |
| `events[] (Stopped).operationId` | `string` | No |  |
| `events[] (SessionSuggestionResolved)._tag` | `string` | Yes |  |
| `events[] (SessionSuggestionResolved).suggestionId` | `string` | Yes |  |
| `events[] (SessionSuggestionResolved).outcome` | `string` | Yes |  |
| `events[] (SessionSuggestionResolved).sessionId` | `string \| null` | No | TypeID with prefix "asess_" (format-validated). |
| `events[] (SessionSuggestionResolved).claimId` | `string` | No |  |
| `events[] (SessionSuggestionResolved).operationId` | `string` | No |  |
| `events[] (SessionSuggestionClaimRequested)._tag` | `string` | Yes |  |
| `events[] (SessionSuggestionClaimRequested).suggestionId` | `string` | Yes |  |
| `events[] (SessionSuggestionClaimRequested).claimId` | `string` | Yes |  |
| `events[] (SessionSuggestionClaimRequested).placement` | `string` | Yes |  |
| `events[] (SessionSuggestionClaimRequested).sessionId` | `string` | Yes | TypeID with prefix "asess_" (format-validated). |
| `events[] (SessionSuggestionClaimRequested).operationId` | `string` | No |  |
| `events[] (SessionSuggestionClaimReleased)._tag` | `string` | Yes |  |
| `events[] (SessionSuggestionClaimReleased).suggestionId` | `string` | Yes |  |
| `events[] (SessionSuggestionClaimReleased).claimId` | `string` | Yes |  |
| `events[] (SessionSuggestionClaimReleased).error` | `string` | No |  |
| `events[] (SessionSuggestionClaimReleased).operationId` | `string` | No |  |
| `events[] (Resumed)._tag` | `string` | Yes |  |
| `events[] (Resumed).operationId` | `string` | No |  |
| `events[] (Cancelled)._tag` | `string` | Yes |  |
| `events[] (Cancelled).operationId` | `string` | No |  |
| `events[] (Cancelled).queueEntryId` | `number` | Yes |  |
| `events[] (QueueCancelled)._tag` | `string` | Yes |  |
| `events[] (QueueCancelled).operationId` | `string` | No |  |
| `events[] (Steered)._tag` | `string` | Yes |  |
| `events[] (Steered).operationId` | `string` | No |  |
| `events[] (Steered).queueEntryId` | `number` | Yes |  |
| `events[] (QueueFolded)._tag` | `string` | Yes |  |
| `events[] (QueueFolded).operationId` | `string` | No |  |
| `events[] (QueueFolded).queueEntryId` | `number` | Yes |  |
| `events[] (Rewound)._tag` | `string` | Yes |  |
| `events[] (Rewound).operationId` | `string` | No |  |
| `events[] (Rewound).messageId` | `number` | Yes |  |
| `events[] (Rewound).restoreWorkspace` | `boolean` | No |  |
| `events[] (BranchSwitched)._tag` | `string` | Yes |  |
| `events[] (BranchSwitched).operationId` | `string` | No |  |
| `events[] (BranchSwitched).branchId` | `number` | Yes |  |
| `events[] (Regenerated)._tag` | `string` | Yes |  |
| `events[] (Regenerated).operationId` | `string` | No |  |
| `events[] (Regenerated).messageId` | `number` | Yes |  |
| `events[] (Retried)._tag` | `string` | Yes |  |
| `events[] (Retried).operationId` | `string` | No |  |
| `events[] (Edited)._tag` | `string` | Yes |  |
| `events[] (Edited).operationId` | `string` | No |  |
| `events[] (Edited).messageId` | `number` | Yes |  |
| `events[] (Edited).parts` | `array<any>` | Yes |  |
| `events[] (QueueEdited)._tag` | `string` | Yes |  |
| `events[] (QueueEdited).operationId` | `string` | No |  |
| `events[] (QueueEdited).queueEntryId` | `number` | Yes |  |
| `events[] (QueueEdited).message` | `any` | Yes |  |
| `events[] (QueueEdited).releaseHold` | `boolean` | No |  |
| `events[] (QueueHeld)._tag` | `string` | Yes |  |
| `events[] (QueueHeld).operationId` | `string` | No |  |
| `events[] (QueueHeld).index` | `integer` | Yes |  |
| `events[] (QueueHeld).strategy` | `string \| null` | No |  |
| `events[] (QueueReleased)._tag` | `string` | Yes |  |
| `events[] (QueueReleased).operationId` | `string` | No |  |
| `events[] (QueueReleased).index` | `integer` | Yes |  |
| `events[] (QueueEntryHeld)._tag` | `string` | Yes |  |
| `events[] (QueueEntryHeld).operationId` | `string` | No |  |
| `events[] (QueueEntryHeld).queueEntryId` | `number` | Yes |  |
| `events[] (QueueEntryHeld).strategy` | `string \| null` | No |  |
| `events[] (QueueEntryHeld).reason` | `string \| null` | No |  |
| `events[] (QueueEntryReleased)._tag` | `string` | Yes |  |
| `events[] (QueueEntryReleased).operationId` | `string` | No |  |
| `events[] (QueueEntryReleased).queueEntryId` | `number` | Yes |  |
| `events[] (QueueEntryReleased).wake` | `boolean` | No |  |
| `events[] (QueueMoved)._tag` | `string` | Yes |  |
| `events[] (QueueMoved).operationId` | `string` | No |  |
| `events[] (QueueMoved).queueEntryId` | `number` | Yes |  |
| `events[] (QueueMoved).to` | `integer` | Yes |  |
| `events[] (ToolResultSubmitted)._tag` | `string` | Yes |  |
| `events[] (ToolResultSubmitted).operationId` | `string` | No |  |
| `events[] (ToolResultSubmitted).results` | `array<object>` | Yes |  |
| `events[] (ToolResultSubmitted).results[] (object).toolCallId` | `string` | Yes |  |
| `events[] (ToolResultSubmitted).results[] (object).state` | `string` | Yes |  |
| `events[] (ToolResultSubmitted).results[] (object).errorText` | `string` | Yes |  |
| `events[] (ToolResultSubmitted).results[] (object).toolCallId` | `string` | Yes |  |
| `events[] (ToolResultSubmitted).results[] (object).state` | `string` | Yes |  |
| `events[] (ToolResultSubmitted).results[] (object).output` | `any` | Yes |  |
| `events[] (SecretAskOutcomeSubmitted)._tag` | `string` | Yes |  |
| `events[] (SecretAskOutcomeSubmitted).operationId` | `string` | No |  |
| `events[] (SecretAskOutcomeSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (SecretAskOutcomeSubmitted).mode` | `string` | Yes |  |
| `events[] (SecretAskOutcomeSubmitted).name` | `string` | No |  |
| `events[] (SecretAskOutcomeSubmitted).persisted` | `boolean` | Yes |  |
| `events[] (SecretAskOutcomeSubmitted).status` | `string` | Yes |  |
| `events[] (QuestionAnswerSubmitted)._tag` | `string` | Yes |  |
| `events[] (QuestionAnswerSubmitted).operationId` | `string` | No |  |
| `events[] (QuestionAnswerSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (QuestionAnswerSubmitted).status` | `string` | Yes |  |
| `events[] (QuestionAnswerSubmitted).answers` | `array<object>` | Yes |  |
| `events[] (QuestionAnswerSubmitted).answers[].question` | `string` | Yes |  |
| `events[] (QuestionAnswerSubmitted).answers[].answer` | `string \| array<string>` | Yes |  |
| `events[] (DetachedInteractionSubmitted)._tag` | `string` | Yes |  |
| `events[] (DetachedInteractionSubmitted).operationId` | `string` | No |  |
| `events[] (DetachedInteractionSubmitted).toolCallId` | `string` | Yes |  |
| `events[] (DetachedInteractionSubmitted).toolName` | `string` | Yes |  |
| `events[] (DetachedInteractionSubmitted).resolution` | `any` | Yes |  |
| `events[] (ToolApprovalResponded)._tag` | `string` | Yes |  |
| `events[] (ToolApprovalResponded).operationId` | `string` | No |  |
| `events[] (ToolApprovalResponded).responses` | `array<object>` | Yes |  |
| `events[] (ToolApprovalResponded).responses[].approvalId` | `string` | Yes |  |
| `events[] (ToolApprovalResponded).responses[].toolCallId` | `string` | Yes |  |
| `events[] (ToolApprovalResponded).responses[].approved` | `boolean` | Yes |  |
| `events[] (ToolApprovalResponded).responses[].reason` | `string` | No |  |
| `events[] (MessagesSubmitted)._tag` | `string` | Yes |  |
| `events[] (MessagesSubmitted).operationId` | `string` | No |  |
| `events[] (MessagesSubmitted).messages` | `array<any>` | Yes |  |
| `events[] (MessagesSubmitted).behavior` | `string \| null` | No |  |
| `events[] (MessagesSubmitted).queue` | `object` | No |  |
| `events[] (MessagesSubmitted).queue.index` | `integer` | No |  |
| `events[] (MessagesSubmitted).queue.hold` | `boolean` | No |  |
| `events[] (MessageReactionSet)._tag` | `string` | Yes |  |
| `events[] (MessageReactionSet).operationId` | `string` | No |  |
| `events[] (MessageReactionSet).messageId` | `string` | Yes |  |
| `events[] (MessageReactionSet).emoji` | `string` | Yes |  |
| `events[] (MessageReactionSet).active` | `boolean` | Yes |  |
| `events[] (ModelConfigChanged)._tag` | `string` | Yes |  |
| `events[] (ModelConfigChanged).operationId` | `string` | No |  |
| `events[] (ModelConfigChanged).config` | `object` | Yes |  |
| `events[] (ModelConfigChanged).config.modelId` | `string` | Yes |  |
| `events[] (ModelConfigChanged).config.reasoning` | `string` | Yes |  |
| `events[] (ModelConfigChanged).config.speed` | `string \| null` | No |  |
| `events[] (SubscriptionPin)._tag` | `string` | Yes |  |
| `events[] (SubscriptionPin).operationId` | `string` | No |  |
| `events[] (SubscriptionPin).provider` | `string` | Yes |  |
| `events[] (SubscriptionPin).connectionId` | `string` | Yes |  |
| `events[] (ModeChanged)._tag` | `string` | Yes |  |
| `events[] (ModeChanged).operationId` | `string` | No |  |
| `events[] (ModeChanged).mode` | `string \| null` | Yes |  |
| `events[] (ModeChanged).ifUnset` | `boolean` | No | Apply only while the session has no active and no displaced mode. Reconciliation pushes (e.g. guide posture healing) use it so a re-assertion can never clobber a live mode such as plan. |
| `events[] (AllowedModesChanged)._tag` | `string` | Yes |  |
| `events[] (AllowedModesChanged).operationId` | `string` | No |  |
| `events[] (AllowedModesChanged).modes` | `array<string> \| null` | Yes |  |
| `events[] (CompactionRequested)._tag` | `string` | Yes |  |
| `events[] (CompactionRequested).operationId` | `string` | No |  |
| `events[] (CompactionRequested).instructions` | `string` | No |  |
| `events[] (CompactionRequested).attemptId` | `string \| null` | No |  |
| `events[] (GoalSubmitted)._tag` | `string` | Yes |  |
| `events[] (GoalSubmitted).operationId` | `string` | No |  |
| `events[] (GoalSubmitted).message` | `any` | Yes |  |
| `events[] (GoalSubmitted).tokenBudget` | `integer \| null` | Yes |  |
| `events[] (GoalSubmitted).behavior` | `string \| null` | No |  |
| `events[] (GoalEdited)._tag` | `string` | Yes |  |
| `events[] (GoalEdited).operationId` | `string` | No |  |
| `events[] (GoalEdited).objective` | `string \| null` | No |  |
| `events[] (GoalEdited).budget` | `object` | No |  |
| `events[] (GoalEdited).budget.tokenBudget` | `integer \| null` | Yes |  |
| `events[] (GoalEdited).revision` | `integer` | Yes |  |
| `events[] (GoalPauseRequested)._tag` | `string` | Yes |  |
| `events[] (GoalPauseRequested).operationId` | `string` | No |  |
| `events[] (GoalResumeRequested)._tag` | `string` | Yes |  |
| `events[] (GoalResumeRequested).operationId` | `string` | No |  |
| `events[] (GoalCleared)._tag` | `string` | Yes |  |
| `events[] (GoalCleared).operationId` | `string` | No |  |
| `visibility` | `string \| null` | No | Read audience of the new session. When omitted, inherits the originating session audience for spawned sessions; otherwise defaults to `organization`. |

## Responses

### `200` (`application/json`)

An agent session

Schema: `Session`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique session identifier |
| `organizationId` | `string` | Yes | Organization this session belongs to |
| `teamId` | `string \| null` | Yes | Team this session belongs to |
| `createdBy` | `string \| null` | No |  |
| `status` | `string` | Yes | Runtime status of the session. `provisioning` means setup is in flight, `idle` means no turn is running, `working` means a turn is in flight, and `failed` means provisioning failed terminally. Lifecycle (archive/restore) is signaled by archivedAt, not status. |
| `type` | `string` | Yes | Immutable session kind assigned at creation. |
| `statusDetail` | `SessionStatusDetail \| null` | No | Who or what unblocks an idle session (`user`, `session` or `event`; absent when nothing is awaited), an open-text kind refining it (`question`, `plan-review`, `approval`, `reply`, `done`, `error`, ...), and a short user-facing label. `error` marks a recoverable root-turn failure while the coarse runtime status remains idle; `failed` is reserved for terminal runtime failure. Readers must tolerate unknown kinds: the closed `waitingOn` bucket alone decides attention treatment. |
| `statusDetail.waitingOn` | `string` | No |  |
| `statusDetail.kind` | `string` | No |  |
| `statusDetail.label` | `string` | No |  |
| `archivedAt` | `string \| null` | Yes | When the session was archived, or null if not archived |
| `machineId` | `string \| null` | No | Explicitly borrowed machine, when attached to an existing workspace. Null does not mean the session has no machine: owned, forked and inherited machines are resolved separately. Read GET /v1/sessions/{id}/machine/info for caller-visible stored effective machine metadata, not live guest liveness. |
| `forkedFrom` | `object \| null` | No |  |
| `forkedFrom.sessionId` | `string` | Yes | TypeID with prefix "asess_". |
| `forkedFrom.messageId` | `integer` | Yes |  |
| `forkedFrom.machine` | `string \| object` | No | 'shared' (default) uses the parent's effective machine. 'fork' copies that machine, including its filesystem, memory, and running processes; the parent pauses briefly. { machineId } uses that existing machine without copying it; its owning session must be writable, unarchived, and not failed. The child inherits that session’s environment and repositories; it is private if either session is private. |
| `forkedFrom.machine (object).machineId` | `string` | Yes | TypeID with prefix "mach_". |
| `projectId` | `string \| null` | No | TypeID with prefix "proj_". |
| `environmentId` | `string \| null` | No | TypeID with prefix "env_". |
| `parentSessionId` | `string \| null` | No | TypeID with prefix "asess_". |
| `name` | `string` | Yes | Human-readable display name for the session |
| `isMineOrShared` | `boolean` | No | Whether the current viewer created this session or is in its collaborator roster. Browsing classification only, not an access grant. |
| `visibility` | `string` | No |  |
| `createdAt` | `string` | Yes |  |
| `updatedAt` | `string` | Yes |  |
| `lastRepliedAt` | `string \| null` | No |  |
| `lastUsedAt` | `string` | Yes |  |
| `lastActivityAt` | `string \| null` | No |  |
| `tagIds` | `array<string>` | No | Ids of the tags applied to this item, in ascending id order. Resolve names and colors from the organization's tag list (`GET /v1/tags`). |
| `pullRequestIds` | `array<string>` | No |  |
| `collaborators` | `array<SessionItemCollaborator>` | No |  |
| `collaborators[].userId` | `string` | Yes | TypeID with prefix "user_". |
| `collaborators[].lastActiveAt` | `string` | Yes |  |
| `repositories` | `array<SessionItemRepository>` | No |  |
| `repositories[].repositoryId` | `string` | Yes | TypeID with prefix "repo_". |
| `repositories[].provider` | `string` | Yes | Git provider the repository is mirrored from. |
| `repositories[].owner` | `string` | Yes |  |
| `repositories[].name` | `string` | Yes |  |
| `slackChannels` | `array<SessionItemSlackChannel>` | No |  |
| `slackChannels[].id` | `string` | Yes | TypeID with prefix "cthr_". |
| `slackChannels[].channelId` | `string \| null` | Yes |  |
| `slackChannels[].threadTs` | `string \| null` | Yes |  |
| `slackChannels[].slackTeamId` | `string \| null` | Yes |  |
| `slackChannels[].muted` | `boolean` | Yes |  |
| `machine` | `SessionItemMachine \| null` | No |  |
| `machine.id` | `string` | Yes | TypeID with prefix "mach_". |
| `machine.sessionId` | `string` | Yes | TypeID with prefix "asess_". |
| `machine.status` | `string` | Yes | Provider compute lifecycle for a session machine. `pending` means no attachable compute exists yet, `active` means the provider confirmed attachable compute, and `error` means provisioning failed. |
| `machine.statusDetail` | `string` | Yes | Workspace-setup detail layered over `status`. `provisioning` until attachable compute exists, `preparing` while repository setup runs in the background (file transfer already works), `ready` when setup settled and agent tools may run (a failed setup script still settles ready — the failure is delivered as a session notice and mirrored in `lastError`), `error` when provisioning failed fatally. |
| `machine.ownerArchived` | `boolean` | No |  |
| `machine.expiresAt` | `string \| null` | Yes |  |
| `machine.lastError` | `string \| null` | Yes |  |

Example:

```json
{
  "id": "string",
  "organizationId": "string",
  "teamId": "string",
  "createdBy": "string",
  "status": "pending",
  "type": "default",
  "statusDetail": {
    "waitingOn": "user",
    "kind": "string",
    "label": "string"
  },
  "archivedAt": "string",
  "machineId": "string",
  "forkedFrom": {
    "sessionId": "asess_01jd8z3k5q0b6f2m4r7t9v1x3c",
    "messageId": 0,
    "machine": "shared"
  },
  "projectId": "proj_01jd8z3k5q0b6f2m4r7t9v1x3c",
  "environmentId": "env_01jd8z3k5q0b6f2m4r7t9v1x3c",
  "parentSessionId": "asess_01jd8z3k5q0b6f2m4r7t9v1x3c",
  "name": "Ship the new dashboard",
  "isMineOrShared": true,
  "visibility": "private",
  "createdAt": "string",
  "updatedAt": "string",
  "lastRepliedAt": "string",
  "lastUsedAt": "string",
  "lastActivityAt": "string",
  "tagIds": [
    "stag_01jd8z3k5q0b6f2m4r7t9v1x3c"
  ],
  "pullRequestIds": [
    "pr_01jd8z3k5q0b6f2m4r7t9v1x3c"
  ],
  "collaborators": [
    {
      "userId": "user_01jd8z3k5q0b6f2m4r7t9v1x3c",
      "lastActiveAt": "string"
    }
  ]
}
```

### `400` (`application/json`)

DetachedInteractionRejectedError | SessionRepositoryInvalidError

Schema: `DetachedInteractionRejectedError | SessionRepositoryInvalidError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `$ (DetachedInteractionRejectedError)._tag` | `string` | Yes |  |
| `$ (DetachedInteractionRejectedError).message` | `string` | Yes |  |
| `$ (SessionRepositoryInvalidError)._tag` | `string` | Yes |  |
| `$ (SessionRepositoryInvalidError).repositoryId` | `string` | Yes |  |

Example:

```json
{
  "_tag": "DetachedInteractionRejectedError",
  "message": "Reply with a one-line greeting."
}
```

### `401` (`application/json`)

AuthenticationError

Schema: `AuthenticationError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `reason` | `string` | Yes |  |
| `description` | `string` | No |  |

Example:

```json
{
  "_tag": "AuthenticationError",
  "reason": "invalid_session",
  "description": "string"
}
```

### `402` (`application/json`)

OrganizationUnsubscribedError

Schema: `OrganizationUnsubscribedError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `code` | `string` | Yes |  |

Example:

```json
{
  "_tag": "OrganizationUnsubscribedError",
  "code": "ORGANIZATION_UNSUBSCRIBED"
}
```

### `403` (`application/json`)

FeatureFlagDisabledError | UnauthorizedError | IdentityMismatchError | RequestedOrganizationError

Schema: `FeatureFlagDisabledError | UnauthorizedError | IdentityMismatchError | ...`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `$ (FeatureFlagDisabledError)._tag` | `string` | Yes |  |
| `$ (FeatureFlagDisabledError).flag` | `string` | Yes |  |
| `$ (FeatureFlagDisabledError).organizationId` | `string` | Yes |  |
| `$ (FeatureFlagDisabledError)._tag` | `string` | Yes |  |
| `$ (FeatureFlagDisabledError).flag` | `string` | Yes |  |
| `$ (FeatureFlagDisabledError).organizationId` | `string` | Yes |  |
| `$ (UnauthorizedError)._tag` | `string` | Yes |  |
| `$ (UnauthorizedError).entity` | `string` | Yes |  |
| `$ (UnauthorizedError).action` | `string` | Yes |  |
| `$ (IdentityMismatchError)._tag` | `string` | Yes |  |
| `$ (RequestedOrganizationError)._tag` | `string` | Yes |  |
| `$ (RequestedOrganizationError).reason` | `string \| null` | Yes |  |

Example:

```json
{
  "_tag": "FeatureFlagDisabledError",
  "flag": "subscription-pooling",
  "organizationId": "string"
}
```

### `404` (`application/json`)

EnvironmentNotFoundError | BrowserNotFoundError

Schema: `EnvironmentNotFoundError | BrowserNotFoundError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `$ (EnvironmentNotFoundError)._tag` | `string` | Yes |  |
| `$ (EnvironmentNotFoundError).id` | `string` | Yes | TypeID with prefix "env_". |
| `$ (BrowserNotFoundError)._tag` | `string` | Yes |  |
| `$ (BrowserNotFoundError).id` | `string` | Yes | TypeID with prefix "brw_". |

Example:

```json
{
  "_tag": "EnvironmentNotFoundError",
  "id": "env_01jd8z3k5q0b6f2m4r7t9v1x3c"
}
```

### `422` (`application/json`)

ModelUnavailableError

Schema: `ModelUnavailableError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `modelId` | `string` | Yes |  |
| `reason` | `object` | Yes | Why a model cannot run for the acting user. |
| `reason (object).kind` | `string` | Yes |  |
| `reason (object).kind` | `string` | Yes |  |
| `reason (object).kind` | `string` | Yes |  |
| `reason (object).setBy` | `string` | Yes |  |
| `reason (object).kind` | `string` | Yes |  |
| `reason (object).provider` | `string` | Yes |  |
| `reason (object).kind` | `string` | Yes |  |
| `reason (object).provider` | `string` | Yes |  |

Example:

```json
{
  "_tag": "ModelUnavailableError",
  "modelId": "string",
  "reason": {
    "kind": "unknown"
  }
}
```

### `429` (`application/json`)

RateLimitExceededError

Schema: `RateLimitExceededError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `resource` | `string` | Yes | Rate-limited resource bucket the request was counted against. |
| `retryAfter` | `number` | Yes |  |

Example:

```json
{
  "_tag": "RateLimitExceededError",
  "resource": "string",
  "retryAfter": 1
}
```

### `500` (`application/json`)

InternalError

Schema: `InternalError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |

Example:

```json
{
  "_tag": "InternalError"
}
```

## Example Request

### cURL

```bash
curl -X POST 'https://api.thecompany.company/v1/sessions' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d @- <<'JSON'
{
  "name": "string",
  "model": {
    "modelId": "string",
    "reasoning": "off"
  },
  "environmentId": "string"
}
JSON
```

### TypeScript

```typescript
const response = await fetch('https://api.thecompany.company/v1/sessions', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "string",
  "model": {
    "modelId": "string",
    "reasoning": "off"
  },
  "environmentId": "string"
}),
});
if (!response.ok) {
  throw new Error('HTTP ' + response.status);
}
const data = await response.json();
```
