Skip to content
cloudhostDocs
API reference

Workflows

Durable runs of a function's workflow export, step by step. A finished step never runs again after a crash or a deploy; steps retry on their own; a run sleeps for months or waits for an event. Started over the API, with idempotency keys.

GET/v1/workflows/config

Whether workflows are served#

available: whether runs can be started and read here.

Credential
An API key or a dashboard session
Roles
Any role

Response

200object

  • availableboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/workflows/config" \
  -H "Authorization: Bearer $KEY"
GET/v1/workflows/runs

The team's runs#

Every project's runs, oldest first, or one project's with project.

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • any
  • statusstringquery

    only runs in this state

    one of running, sleeping, waiting, completed, failed, cancelled

  • functionstringquery

    only this function's runs (its name or id; in the team's list <project>/<name>)

  • any
  • any

Response

200object

  • runsWorkflowRun[]
    • idstring

      run_…

    • functionstring

      the function whose workflow it runs (null once that function is deleted)

    • kindstring
    • projectobject
    • versionstring

      the deployment it started on; it keeps it across later deploys

    • statusstring

      one of running, sleeping, waiting, completed, failed, cancelled

    • inputany
    • outputany
    • errorstring
    • idempotency_keystring
    • stepsinteger

      finished steps

    • currentstring

      the step being retried, slept or waited

    • attemptinteger

      failed attempts of the current step

    • wake_atstring (date-time)
    • wait_forstring

      the event type a waiting run waits for

    • created_atstring (date-time)
    • updated_atstring (date-time)
  • next_cursorstring

Errors

StatusDescription
400Bad request: bad_param, bad_cursor
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

Example

curl "https://api.ibel.ai/v1/workflows/runs" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/workflows/runs

A project's runs#

The runs of the project's functions, oldest first.

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • any
  • anyrequired
  • statusstringquery

    only runs in this state

    one of running, sleeping, waiting, completed, failed, cancelled

  • functionstringquery

    only this function's runs (its name or id; in the team's list <project>/<name>)

  • any
  • any

Response

200object

  • runsWorkflowRun[]
    • idstring

      run_…

    • functionstring

      the function whose workflow it runs (null once that function is deleted)

    • kindstring
    • projectobject
    • versionstring

      the deployment it started on; it keeps it across later deploys

    • statusstring

      one of running, sleeping, waiting, completed, failed, cancelled

    • inputany
    • outputany
    • errorstring
    • idempotency_keystring
    • stepsinteger

      finished steps

    • currentstring

      the step being retried, slept or waited

    • attemptinteger

      failed attempts of the current step

    • wake_atstring (date-time)
    • wait_forstring

      the event type a waiting run waits for

    • created_atstring (date-time)
    • updated_atstring (date-time)
  • next_cursorstring

Errors

StatusDescription
400Bad request: bad_param, bad_cursor, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

Example

curl "https://api.ibel.ai/v1/projects/my-api/workflows/runs" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/workflows/runs

Start a run#

Starts the workflow of one of the project's functions with input. With an idempotency_key already used, the same run is answered (200, created: false).

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • any
  • anyrequired

Request bodyapplication/json

  • functionstringrequired

    the function's name in the project (any case) or its id

  • inputany

    any JSON value, given to the workflow as its event

  • idempotency_keystring

    1 to 128 letters, digits, ., :, _ or -; a start with a key used before answers that run

Response

200WorkflowRunThe run started before with this idempotency key

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)

201WorkflowRun

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)
  • createdboolean

Errors

StatusDescription
400Bad request: bad_function, bad_idempotency_key, bad_request, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, account_blocked
404Not found: not_found
409Conflict: not_deployed (the function has no live version)
413Too large: too_large
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

Example

curl -X POST "https://api.ibel.ai/v1/projects/my-api/workflows/runs" \
  -H "Authorization: Bearer $KEY" \
  -d '{"function":"…"}'
GET/v1/projects/{project}/workflows/runs/{id}

One run#

Its state, input, output, error and the step it is on.

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • any
  • idstringpathrequired

    the run's id (run_…)

  • anyrequired

Response

200WorkflowRun

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)

Errors

StatusDescription
400Bad request: bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

Example

curl "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/workflows/runs/{id}/history

A run's history#

Every line of the run's history in order (started, each step and retry with its attempt and error, sleeps, waits, events, the end) and each finished step's result.

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • any
  • idstringpathrequired

    the run's id (run_…)

  • anyrequired
  • any
  • any

Response

200object

  • runWorkflowRun
  • historyWorkflowEntry[]
  • resultsobject

    each finished step's result, by the step's name

  • next_cursorstring

Errors

StatusDescription
400Bad request: bad_cursor, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

Example

curl "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903/history" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/workflows/runs/{id}/events

Send an event to a run#

An event for a step that waits for its type; one that arrives early is kept for it. The same id twice is kept once (stored: false).

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • any
  • idstringpathrequired

    the run's id (run_…)

  • anyrequired

Request bodyapplication/json

  • typestringrequired

    1 to 128 letters, digits, ., :, _ or -

  • idstring

    the event's own id, the same characters (default a new one)

  • payloadany

    any JSON value

Response

200object

  • runstring
  • typestring
  • idstring
  • storedboolean

Errors

StatusDescription
400Bad request: bad_event, bad_request, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404Not found: not_found
409Conflict: run_finished
413Too large: too_large
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

Example

curl -X POST "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903/events" \
  -H "Authorization: Bearer $KEY" \
  -d '{"type":"…"}'
POST/v1/projects/{project}/workflows/runs/{id}/cancel

Cancel a run#

Stops the run: no further step starts.

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • any
  • idstringpathrequired

    the run's id (run_…)

  • anyrequired

Response

200WorkflowRun

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)

Errors

StatusDescription
400Bad request: bad_environment
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404Not found: not_found
409Conflict: run_finished
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

Example

curl -X POST "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903/cancel" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/workflows/usage

Runs and steps used#

Runs started and steps run per day by the project's functions, and their cost at list price once a step has a price (priced).

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • any
  • daysintegerquery

    how many days back (default 30, at most 90)

    1–90

Response

200object

  • daysinteger
  • runsinteger
  • stepsinteger
  • per_dayobject[]
  • metersobject[]
  • list_rialsinteger
  • pricedboolean

Errors

StatusDescription
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/projects/my-api/workflows/usage" \
  -H "Authorization: Bearer $KEY"
GET/v1/workflows/usage

The team's runs and steps#

Runs started and steps run per day by every project's functions added up (the team view), or one project's with project, and their cost at list price once a step has a price (priced). project in the answer is the project asked for, or null.

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • any
  • daysintegerquery

    how many days back: 1 to 90 (default 30)

    1–90 · default 30

Response

200object

  • daysinteger
  • runsinteger
  • stepsinteger
  • per_dayobject[]
  • metersobject[]
  • list_rialsinteger
  • pricedboolean

Errors

StatusDescription
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found (no such project)
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/workflows/usage" \
  -H "Authorization: Bearer $KEY"