Create session
POST
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./v1/sessionsAuthorization
header
Authorization: Bearer <token>
An access token from Settings → Access tokens, with the scopes this call needs. Authentication
Request body
application/json · required
idstring | nullasess_…). 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.namestring- Length
- at most 255
modelobjectbrowserIdstring | nullenvironmentIdstring | nullrepositoriesarray<SessionRepositoryPick>- Items
- at most 20
eventsarray<object | TextSubmitted | Stopped | ...>- Items
- 1 to 20
visibilitystring | nullorganization.- Value in
- "private" | "organization"
Responses
An agent sessionapplication/json
idstringrequiredorganizationIdstringrequiredteamIdstring | nullrequiredcreatedBystring | nullstatusstringrequiredprovisioning 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.- Value in
- "pending" | "idle" | "running" | "failed"
typestringrequired- Value in
- "default" | "review" | "memory" | "agent" | "assistant" | "background"
statusDetailSessionStatusDetail | nulluser, 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.archivedAtstring | nullrequiredmachineIdstring | nullforkedFromobject | nullprojectIdstring | nullenvironmentIdstring | nullparentSessionIdstring | nullnamestringrequiredisMineOrSharedbooleanvisibilitystring- Value in
- "private" | "organization"
createdAtstringrequiredupdatedAtstringrequiredlastRepliedAtstring | nulllastUsedAtstringrequiredlastActivityAtstring | nulltagIdsarray<string>GET /v1/tags).pullRequestIdsarray<string>collaboratorsarray<SessionItemCollaborator>repositoriesarray<SessionItemRepository>slackChannelsarray<SessionItemSlackChannel>machineSessionItemMachine | null