Skip to main content
POST
Create Browsercode Run

Authorizations

X-Browser-Use-API-Key
string
header
required

Body

application/json

Start a new browsercode conversation OR continue an existing one.

ONE door. Omit session_id to start a new conversation (full config body). Pass session_id to continue a thread (MINIMAL body — config is inherited). Continuation never 409s on a busy session: the turn comes back queued and starts automatically when the current run finishes.

CONTINUATION RULE (enforced): passing session_id together with ANY config field (model / workspaceId / browser / judge / maxCostUsd) → 400. Config is inherited on a follow-up; start a new session to change it.

task
string
required

What you want the agent to do.

Minimum string length: 1
model
string | null

Model to run. New-conversation only — inherited on a continuation. Omit for the server default.

sessionId
string<uuid> | null

Continue this conversation. Files and config carry over; send a MINIMAL body (task + attachedFileIds). Omit to start a new conversation.

workspaceId
string<uuid> | null

ADVANCED + new-conversation only. Run in an explicit workspace to share files across sessions. Omit on the normal path.

browser
RunBrowserSettings · object | null

Browser/proxy/screen settings. New-conversation only (inherited on a follow-up).

attachedFileIds
string<uuid>[] | null

Upload ids (from POST /agents/browsercode/files) to give THIS run. Allowed on both new and continuation runs.

Maximum array length: 20
maxCostUsd

USD cap for this run. New-conversation only; null → server default.

Required range: x > 0
judge
BrowsercodeJudgeSettings · object | null

Opt-in post-run LLM judge. New-conversation only.

Response

Successful Response

Async run accepted. Poll GET /runs/{id}/status or GET /runs/{id} for progress + result.

id
string
required

Run id, e.g. "run_...".

agent
enum<string>
required

Which agent is running it.

Available options:
browser-use,
browsercode
sessionId
string<uuid>
required

The conversation this run belongs to (new or continued).

status
enum<string>
required

Initial state — 'queued' or 'running'.

Available options:
queued,
running,
completed,
failed,
stopped
workspaceId
string<uuid> | null

The run's workspace, if the agent has one (browsercode). Its files live here.

missingFileIds
string<uuid>[]

Attached upload ids that could not be confirmed in storage at creation. The run still starts.