Flows
Flow files, saved flows and their versions, and flow runs.
Every path is under /api/v1; see the API for authenticating, errors and rate
limits, and the schemas for the bodies.
The project's flow runs, newest first (run:read)
GET /api/v1/projects/{project}/flow-runs
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
limit |
query | integer |
cursor |
query | string: next_cursor of the previous page |
Answers:
200: OK, object with the fields below
| Field | Type | Description |
|---|---|---|
flow_runs |
array of FlowRun, required | |
next_cursor |
string |
Errors: 400, 403, 404 (how errors look).
Start a flow run (run:create)
POST /api/v1/projects/{project}/flow-runs
Checks the whole flow file and, for every step, that the caller may create its run, then
starts the first stage. Later steps are created as the caller. 422 invalid for a bad file
or step. With a concurrency group that has an active flow run it starts queued, or
with policy skip it isn't started: 409 concurrency_busy.
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
Body (application/json): object.
| Field | Type | Description |
|---|---|---|
file |
string, required | The flow file (YAML, at most 64 KiB). |
includes |
map of string | The files file includes, nested ones too, by their .forge/ path, as forge flow run reads them from the checkout. Without them the file can't include. |
name |
string | Overrides the file's name. |
params |
map of any | Values for the flow's parameters by name; numbers and booleans may be JSON numbers and booleans or text. |
Answers:
201: Started, FlowRun
Errors: 400, 403, 404, 409, 422, 429 (how errors look).
A flow run with its steps (run:read on its project)
GET /api/v1/flow-runs/{flowRun}
| Parameter | In | Description |
|---|---|---|
flowRun |
path | ID |
Answers:
200: OK, FlowRun
Errors: 404 (how errors look).
Cancel a flow run (run:cancel)
POST /api/v1/flow-runs/{flowRun}/cancel
Cancels the running steps' runs (and drops their pending retries); the steps not started
end cancelled, if: always() ones too. 409 flow_run_finished when it has ended.
| Parameter | In | Description |
|---|---|---|
flowRun |
path | ID |
Answers:
200: The flow run after the request, FlowRun
Errors: 403, 404, 409 (how errors look).
Re-run an ended flow run's failed steps, or one step (run:create)
POST /api/v1/flow-runs/{flowRun}/rerun
Makes the flow run's next attempt: the steps that failed (and weren't allowed to), were rejected or were cancelled, or the one in step, run again with every
step that waits for them; the others are carried over with their runs, outputs and
artifacts. A needed step whose artifacts expired runs again too. Skipped steps are looked
at again. A failed matrix step re-runs its failed instances, a failed flow step its child's
failed steps. 409 not_rerunnable (with why) when it hasn't ended, nothing failed, the
step doesn't exist, or it is a flow step's child (re-run the parent).
| Parameter | In | Description |
|---|---|---|
flowRun |
path | ID |
Body (application/json): object.
| Field | Type | Description |
|---|---|---|
step |
string | The step to run again; empty or absent: the failed ones. |
Answers:
200: The flow run, queued again as its next attempt, FlowRun
Errors: 403, 404, 409 (how errors look).
The project's stored flows by name (project:read)
GET /api/v1/projects/{project}/flows
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
Answers:
200: OK, object with the fields below
| Field | Type | Description |
|---|---|---|
flows |
array of FlowSummary, required |
Errors: 403, 404 (how errors look).
Save a new stored flow as version 1 (flow:write)
POST /api/v1/projects/{project}/flows
The file is checked like forge flow check. A project has at most 200.
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
Body (application/json): FlowInput.
Answers:
201: Created, Flow
Errors: 400, 403, 404, 409, 422 (how errors look).
Check a flow file for an editor (project:read)
POST /api/v1/projects/{project}/flows/check
Checks the file like forge flow check (templates are only named, not looked up). A file
with a problem is still 200, with problem; otherwise the parameters and stages it read.
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
Body (application/json): object.
| Field | Type | Description |
|---|---|---|
file |
string, required |
Answers:
200: Checked, object with the fields below
| Field | Type | Description |
|---|---|---|
parameters |
array of TemplateParam, required | |
problem |
object | |
stages |
array of object, required |
Errors: 400, 403, 404 (how errors look).
A stored flow at its latest or a given version (project:read)
GET /api/v1/flows/{flow}
| Parameter | In | Description |
|---|---|---|
flow |
path | ID |
version |
query | integer |
Answers:
200: OK, Flow
Errors: 400, 404 (how errors look).
Save a stored flow again (flow:write)
PUT /api/v1/flows/{flow}
A changed file or description adds a version; versions never change. A changed name only renames. Saving the same content changes nothing.
| Parameter | In | Description |
|---|---|---|
flow |
path | ID |
Body (application/json): FlowInput.
Answers:
200: The flow at its (new) latest version, Flow
Errors: 400, 403, 404, 409, 422 (how errors look).
Delete a stored flow and its versions; its flow runs keep what they ran (flow:write)
DELETE /api/v1/flows/{flow}
| Parameter | In | Description |
|---|---|---|
flow |
path | ID |
Answers:
204: Deleted
Errors: 403, 404 (how errors look).
A stored flow's versions, newest first (project:read)
GET /api/v1/flows/{flow}/versions
| Parameter | In | Description |
|---|---|---|
flow |
path | ID |
Answers:
200: OK, object with the fields below
| Field | Type | Description |
|---|---|---|
versions |
array of TemplateVersion, required |
Errors: 404 (how errors look).
Start a flow run of a stored flow (run:create)
POST /api/v1/flows/{flow}/runs
Like starting a flow run from a file, with the flow's file at that version; the flow run
records the flow and version and is named after the flow unless name is given.
| Parameter | In | Description |
|---|---|---|
flow |
path | ID |
Body (application/json): object.
| Field | Type | Description |
|---|---|---|
name |
string | The flow run's name; the flow's name if empty. |
params |
map of any | Values for the flow's parameters by name; numbers and booleans may be JSON numbers and booleans or text. |
version |
integer | The version to start; 0 or absent: the latest. |
Answers:
201: Started, FlowRun
Errors: 400, 403, 404, 409, 422, 429 (how errors look).