POST

Authorizations

x-api-key
string
header
required

Headers

Idempotency-Key
string
required

Required; 1 to 255 visible ASCII characters, unique per fork. Within 24 hours the same key with the same request replays the first answer (the same fork, nothing copied again); the same key with another source or body is 400 idempotency_key_reused, and one sent while the first request still runs is 409 idempotency_key_in_use. A refused request (400, 403, 404, 413) or a 5xx/529 failure does not keep the key.

Required string length: 1 - 255

Path Parameters

session_id
string
required

The ses_ ID of the session to fork (the source), in the request's workspace. It may be archived; a deleted session is 404.

Body

application/json

Where to cut the source's conversation, and the fork's own title, metadata and vaults. Every member is optional; an empty body is {}, and any other member is refused (400 invalid_field). At most one of through_input_id and before_input_id. With neither, the fork takes the conversation through the last ended turn that has no unfinished turn before it (an empty conversation when the source has no turn or its first turn has not ended). A turn has ended when it completed, failed or was canceled.

through_input_id
string

The bma_input_id (ain_…) of the user.message that opened a turn of the source; the fork includes that whole turn (its steering messages and every agent event of it). That turn and every earlier turn must have ended. Not combinable with before_input_id.

before_input_id
string

The bma_input_id (ain_…) of the user.message that opened a turn of the source; the fork ends just before that turn, to ask again from there. The named turn may be queued, running or ended; every earlier turn must have ended. Not combinable with through_input_id.

title
string

The fork's title. Omitted or null, it is the source's title followed by " (fork)", or no title when the source has none; an empty string gives no title.

metadata
object

The fork's metadata (string values). Omitted or null, it is {}; the source's metadata is never inherited.

vault_ids
string[]

The vaults (vlt_…) the fork may use. Omitted or null, the source's vaults; [] attaches none. Every vault, given or inherited, is checked for the caller as on create; an unknown vault or one outside the workspace is 404 vault_not_found, an archived one 400.

Response

The new session (idle), the same shape as the answer of POST /v1/sessions, with bma_forked_from.

A Managed Agents session.

id
string
required

ID of the session (ses_ followed by 26 lowercase base32 characters).

agent
object
required

The agent the session runs, snapshotted when the session was created: the agent version with the session's own model and system overrides and its skills with every version resolved. It never changes afterwards.

archived_at
string | null
required

When the session was archived (RFC 3339, UTC); null while it is not archived.

budget
object | null
required

Always null on BMA, which does not support session budgets.

created_at
string
required

When the session was created (RFC 3339, UTC, up to microsecond precision).

environment_id
string
required

ID of the environment the session runs in (env_, or mch_ for a machine environment); an empty string when the session was created without one.

metadata
object
required

The session's key-value metadata, {} when it has none.

outcome_evaluations
object[]
required

Always an empty list on BMA, which does not support outcomes.

resources
object[]
required

What the session mounts, in the order it was mounted: file and memory_store resources. BMA never mounts github_repository resources.

A resource mounted in a session: a file or a memory_store. BMA never mounts github_repository resources.

stats
object
required

Timing statistics in seconds. active_seconds: the time the session's turns ran, less the time they waited for a tool confirmation or custom tool result; time queued behind an earlier turn is not counted. duration_seconds: the time since the session was created, frozen when it terminated or was archived.

status
enum<string>
required

idle (no turn runs, also while the agent waits for a tool confirmation or custom tool result), running (a turn is queued or runs) or terminated (archived). BMA never reports rescheduling.

Available options:
rescheduling,
running,
idle,
terminated
title
string | null
required

The session's title; null while it has none. An untitled session may be titled automatically after its first answered turn.

type
string
required

Always session.

Allowed value: "session"
updated_at
string
required

When the session last changed (RFC 3339, UTC, up to microsecond precision).

usage
object
required

Cumulative usage of the session's model requests, updated when a turn ends: token counts, cache creation tokens and the list cost in US cents.

vault_ids
string[]
required

Vaults (vlt_ IDs) the session was created with, in order; empty when none.

deployment_id
string | null

The deployment whose run created the session; null for sessions created through this API.