Skip to content
Select themeSelect language

`POST /api/scripts/{id}/run` — dispatch a standalone-script run (#626 C3 / §13). Reuses the existing `services::scripts::dispatch` Wasm executor verbatim; resolves + tenancy-checks the script via `resolve_script` (an id from another workspace is indistinguishable from an unknown id → 404).

POST
/api/scripts/{id}/run
curl --request POST \
--url https://example.com/api/scripts/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/run \
--header 'Content-Type: application/json' \
--data '{ "input": "example" }'
id
required
string format: uuid
Media typeapplication/json

POST /api/scripts/{id}/run body. input is exposed to the script as the global input; it is passed straight to the executor and NEVER persisted (it can carry secrets/PII), mirroring the MCP script.run arg. Absent → null.

object
input
Examplegenerated
{
"input": "example"
}

Run dispatched; poll the run for the result

Media typeapplication/json

POST /api/scripts/{id}/run body — the dispatched run id + its initial status. The run is created running and executes on a spawned task (fire-and-forget): the script’s actual result lands later on the kind='script' run row, which the UI fetches by polling — it is NOT returned here.

object
bound_resources
required
Array<string>
run_id
required
string format: uuid
script_id
required
string format: uuid
script_slug
required
string
status
required
string
Examplegenerated
{
"bound_resources": [
"example"
],
"run_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"script_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"script_slug": "example",
"status": "example"
}

Permission denied

Media typeapplication/json

The canonical JSON body of every error response — the single source of truth the frontend binds to. Every AppError serializes as this exact shape, and the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is what the frontend error schema is generated from, so there is no hand-written error schema on either end.

object
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden bad_request unprocessable precondition_failed conflict method_not_allowed rate_limited quota_exceeded database_error docker_error vault_error internal_error
details
One of:
null
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
Example
{
"code": "not_found"
}

Unknown script id / wrong workspace

Media typeapplication/json

The canonical JSON body of every error response — the single source of truth the frontend binds to. Every AppError serializes as this exact shape, and the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is what the frontend error schema is generated from, so there is no hand-written error schema on either end.

object
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden bad_request unprocessable precondition_failed conflict method_not_allowed rate_limited quota_exceeded database_error docker_error vault_error internal_error
details
One of:
null
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
Example
{
"code": "not_found"
}