POST

承認

x-api-key
string
header
必須

ヘッダー

bma-workspace-id
string

Project scope. Required when the API key can access more than one project. Also accepted as anthropic-workspace-id; headers sent together must agree, otherwise the request is a 400 workspace_id_conflict.

Idempotency-Key
string

Replays the first result of a create; the same key with another body is 400 idempotency_key_reused, one while the first still runs 409 idempotency_key_in_use.

Required string length: 1 - 255

ボディ

application/json

The native create body plus the machine the session runs on.

machine_id
string
必須
agent_id
string

The id /v1/agents uses.

read_only
boolean
デフォルト:false
lease_seconds
integer<int32>
必須範囲: 1 <= x <= 900
keepalive_seconds
integer<int32>
デフォルト:300

Screen capture keepalive duration, applied from the open on (also while the capture is starting).

必須範囲: 60 <= x <= 3600
capabilities
object
ticket
object

Also mint the session's first ticket (as POST /v1/desktop_sessions/{desktop_session_id}/tickets with this body) and return it in the response's ticket, saving the viewer a second round trip. A retry with the same Idempotency-Key answers the same session with a newly minted ticket.

レスポンス

Success.

type
string
必須

Always desktop_session.

Allowed value: "desktop_session"
id
string
必須

Desktop session ID (dsn_...).

Pattern: ^dsn_[a-z2-7]{26}$
org_id
string
必須
Pattern: ^org_[a-z2-7]{26}$
project_id
string
必須

Project ID (proj_...).

Pattern: ^proj_[a-z2-7]{26}$
machine_id
string
必須

Machine ID (mch_...).

Pattern: ^mch_[a-z2-7]{26}$
owner_id
string
必須

Opaque authenticated principal that created the session, such as a user UUID or organization API key ID.

read_only
boolean
必須
closed
boolean
必須
state
enum<string>
必須

A screen capture answers starting until the machine confirms it publishes (then live); tickets are issued and viewers connect meanwhile and receive the track once published. A start the machine does not confirm closes the session.

利用可能なオプション:
open,
starting,
live,
closing,
closed
created_at
string<date-time>
必須
capabilities
object
必須
control
object
必須
agent_id
string

The id /v1/agents uses (never the native agt_ id).

expires_at
string<date-time>

Screen capture keepalive deadline; ticket issuance does not extend it.

ticket
object

The first ticket, only in the answer of a create request that asked for one (ticket).

close_reason
enum<string>

Why the session ended, present once it is closed. capture_refused - the machine refused to publish its screen (opening again gets the same answer until something changes on the machine); capture_unconfirmed - the machine did not confirm the start in time; capture_lost - the machine stopped renewing a running capture; expired - the keepalive passed; closed_by_user - closed through POST /v1/desktop_sessions/{desktop_session_id}/close.

利用可能なオプション:
closed_by_user,
expired,
capture_refused,
capture_unconfirmed,
capture_lost