/workflows/{wflId}/runsRun Workflow
Manually triggers a new execution run for a workflow whose trigger_type is manual, returning a run record with status: 'pending'.
Requires the PROJECT_AUTHOR role.
| wflId * | path | The workflow id ( |
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
| triggerContext | any | The run's input, which templates read as It is kept private to the run and is not returned. Default |
| HTTP | K9O Code | Description |
|---|---|---|
| 202 | The run was queued and comes back `pending`; the runner executes it in the background. Poll the run, or subscribe to `studio.workflows.runs.<workflow id>`, to follow it. | |
| 401 | K9O_INVALID_CREDENTIALS | The request was made without a valid session or bearer token. |
| 401 | K9O_SESSION_EXPIRED | Your session has expired; re-authenticate and retry. |
| 403 | K9O_ACCESS_DENIED | Manually triggering a workflow run requires the PROJECT_AUTHOR role; your current role does not grant it. |
| 404 | K9O_WORKFLOW_NOT_FOUND | No workflow with the supplied ID exists in this project. |
| data * | object | One run of a workflow: its status, each started step's state and its cost. |
| id * | string | The run id ( |
| workflowId * | string | The workflow that ran ( |
| projectId * | string | The project ( |
| status * | "pending" | "running" | "succeeded" | "failed" | "cancelled" |
Runs of one workflow go one at a time. |
| triggerContext * | any | How the run was started: The trigger's input is never returned. |
| perStepStatus * | object[] | One entry per step that has started, in the order they started. Empty for a pending run. |
| step_index | integer | The step's index in the workflow. |
| action_type | string | What the step does. |
| status | string |
|
| attempt | integer | The attempt number of a retried step; 0 otherwise. |
| started_at | string <date-time> | When the step started. |
| completed_at | string <date-time> | When the step finished. |
| parked_at | string <date-time> | When the step began waiting. |
| retry_at | string <date-time> | When a retrying parallel step tries again. |
| last_reason | string | Why the last attempt of a retrying step failed. |
| output_summary | object | A short summary of what the step did, such as a row count. It never holds the step's full output. |
| error | object | Why the step failed. Present on a failed step. |
| code * | string | The error code. |
| reason * | string | A fixed reason word. |
| costAccountingTotal * | number | The run's metered cost. |
| errorContext * | any | Why the run failed. A failed step gives its A run stopped because a collection it uses was erased gives Null unless the run failed. |
| One of: object | ||
| or: null | ||
| startedAt * | string <date-time> | When the run was started (for a scheduled run, its slot). |
| completedAt * | any | When the run ended. Null while it is pending or running. |
| One of: string <date-time> | ||
| or: null | ||
| firedBy * | string | Who or what started the run: the user's id for a manual run, |
| meta * | any | |
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.studio.workflows.trigger('wfl_demo00000001', {
triggerContext: null
})Showing example in TypeScript
{
"triggerContext": null
}{
"data": {
"id": "string",
"workflowId": "string",
"projectId": "string",
"status": "pending",
"perStepStatus": [
{
"step_index": 0,
"action_type": "string",
"status": "string",
"attempt": 0,
"started_at": "string",
"completed_at": "string",
"parked_at": "string",
"retry_at": "string",
"last_reason": "string",
"error": {
"code": "string",
"reason": "string"
}
}
],
"costAccountingTotal": 0,
"startedAt": "string",
"completedAt": "string",
"firedBy": "string"
}
}