Get a short-lived task browser token

Obtain short-lived identity proof for the browser connection of an existing task you own. This does not create a replacement environment or start a new browser.

POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agent-runtime-tasks/{task_id}/browser/token

Before you call this API

Prepare current product identity and workspace ID. The task must belong to the current user, have conversation context, be admitted for sandbox tools, and have its original browser available. Current agent-use permission must remain valid.

Request parameters

curl -X POST "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/agent-runtime-tasks/$TASK_ID/browser/token" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" --data '{}'

Parameter

Type

Description

workspace_id

string

Workspace owning your task.

task_id

string

Original run task ID.

Product identity header

string

The example uses a personal access token from the current environment.

Body

object

No business fields; the example sends {}.

Successful response

{
  "code": 0,
  "data": {
    "token": "moi-browser-token-v1.example",
    "expires_at": "2026-11-12T04:01:00Z"
  }
}

Field or response item

Type

Description

code

integer

0 on success.

data.token

string

Short-lived opaque proof, passed as a WebSocket subprotocol rather than in the URL.

data.expires_at

string

RFC3339 expiration time. Current proof validity is 60 seconds; connections still reauthorize.

Cache-Control

HTTP header

Successful responses use no-store.

Error responses

HTTP / code

Condition

400 / 2

Invalid browser parameters.

401 / 6

Invalid identity proof, or stream proof does not match the path.

403 / 5

Current authorization denied, or stream Origin/subprotocol requirements unmet.

404 / 3

Task inaccessible, owned by another user, or missing required context.

409 / 15

Existing browser is not running; details.reason=BROWSER_NOT_RUNNING.

410 / 3

Original environment ended or expired; details.reason=BROWSER_SESSION_ENDED.

503 / 15

Browser runtime dependencies unavailable, or task state unusable.

500 / 1

Other internal failure.

After 101 upgrade, ordinary HTTP JSON errors no longer apply. Periodic recheck failures may close the connection. See environments and errors for recovery.

Product authentication may also use string code/msg. The numeric errors above do not enumerate every authentication envelope.

Last updated on