Skip to content

Run a function version by id

POST
/v1/t/adapters/edge/functions/by-id/{id}
curl --request POST \
--url https://example.com/v1/t/adapters/edge/functions/by-id/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "variables": { "additionalProperty": "example" }, "args": { "additionalProperty": "example" } }'

The route the Iris backend uses to run a brick. A failed run (the code throws, timeout, memory limit) is still 200 with ok: false and error. Only a missing version and a broken request get another status.

Permission

This operation needs the permission tenant:scenario_template:manage.

id
required
string format: uuid

Version id, a UUID

X-Tenant-Sid
string

Names the target tenant.

By principal:

  • A tenant-scoped principal may omit it.
  • A principal with no tenant of its own names one here.

Refused when:

  • A tenant-scoped principal sends a value naming any other tenant.
  • A principal with no tenant of its own omits it.
Media typeapplication/json
object
variables

Scenario variables. Read in the code with storage.get(key) and passed to the handler as the second argument.

object
key
additional properties
One of:
string | null
args

Passed to the handler as the first argument. Iris sends {}.

object
key
additional properties
One of:
string | null
Examplegenerated
{
"variables": {
"additionalProperty": "example"
},
"args": {
"additionalProperty": "example"
}
}

The run finished. ok: true when the handler returned, ok: false with error when it threw or the sandbox stopped it.

Media typeapplication/json
object
ok
required
boolean
return
required

What the handler returned. A string as is, an object or array as JSON, null and undefined as an empty string, the rest via String().

string
variables
required

Only the keys the run wrote with storage.set, every value as a string (objects as JSON, null and undefined as an empty string). Iris writes them back into the scenario variables.

object
key
additional properties
string
stdout
required

console.log lines, cut at 1 KiB with ... [truncated]

string
stderr
required

console.error lines plus the thrown message, cut at 1 KiB

string
error

Present only when ok is false

string
execution_time
required

Milliseconds, including the bundle download

integer
Examples
{
"ok": true,
"return": "{\"greeting\":\"Hello, Ann\"}",
"variables": {
"greeted": "true"
},
"stdout": "greeting Ann",
"stderr": "",
"execution_time": 84
}

Domain error. A failed bundle comes as 400 with err_code: INTERNAL_SERVER_ERROR. On a run route a bundle that could not be rebuilt is this 400 too.

Media typeapplication/json
object
ok
required
boolean
error
required
string
err_code
required
string
Allowed values: UNAUTHORIZED FORBIDDEN NOT_FOUND BAD_REQUEST INTERNAL_SERVER_ERROR VALIDATION_ERROR
Example
{
"ok": false,
"err_code": "UNAUTHORIZED"
}

Unauthorized

Forbidden

No version with these keys in the account

Media typeapplication/json
object
ok
required
boolean
error
required
string
err_code
required
string
Allowed values: UNAUTHORIZED FORBIDDEN NOT_FOUND BAD_REQUEST INTERNAL_SERVER_ERROR VALIDATION_ERROR
Example
{
"ok": false,
"error": "Function not found",
"err_code": "NOT_FOUND"
}

The body, query or path params did not pass the zod schema

Media typeapplication/json
object
ok
required
boolean
error
required
string
Allowed values: Validation failed
issues
required

Zod issues as is

Array<object>
object
code
required
string
path
required
Array
message
required
string
Example
{
"ok": false,
"error": "Validation failed"
}

Unexpected error, for example a database or a disk failure. The body has err_code: INTERNAL_SERVER_ERROR.

Media typeapplication/json
object
ok
required
boolean
error
required
string
err_code
required
string
Allowed values: UNAUTHORIZED FORBIDDEN NOT_FOUND BAD_REQUEST INTERNAL_SERVER_ERROR VALIDATION_ERROR
Example
{
"ok": false,
"err_code": "UNAUTHORIZED"
}

Bad gateway (upstream adapter error)