Stevora

Workflow Runs

Start and manage workflow executions

Workflow Runs

A workflow run is a single execution of a workflow definition. Each run tracks its own state, step progress, and output independently.

Create a Workflow Run

POST /v1/workflow-runs

Starts a new execution of a workflow definition. If you provide an idempotencyKey that matches an existing run, the existing run is returned instead of creating a duplicate.

Request Body

FieldTypeRequiredDescription
definitionIdstringYesID of the workflow definition to execute
inputobjectNoKey-value input data passed to the workflow (defaults to {})
idempotencyKeystringNoUnique key to prevent duplicate runs (max 255 characters)

Example Request

curl -X POST https://api.stevora.dev/v1/workflow-runs \
  -H "x-api-key: stv_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "definitionId": "wfdef_abc123",
    "input": {
      "companyName": "Acme Corp",
      "contactEmail": "jane@acme.com"
    },
    "idempotencyKey": "onboard-acme-2026-04-02"
  }'

Response 201 Created

Returned when a new run is created:

{
  "success": true,
  "data": {
    "id": "wfrun_def456",
    "workspaceId": "ws_xyz789",
    "definitionId": "wfdef_abc123",
    "status": "PENDING",
    "input": {
      "companyName": "Acme Corp",
      "contactEmail": "jane@acme.com"
    },
    "output": null,
    "idempotencyKey": "onboard-acme-2026-04-02",
    "createdAt": "2026-04-02T12:00:00.000Z",
    "updatedAt": "2026-04-02T12:00:00.000Z"
  }
}

Response 200 OK

Returned when the idempotencyKey matches an existing run (no new run created):

{
  "success": true,
  "data": {
    "id": "wfrun_existing",
    "status": "RUNNING",
    ...
  }
}

Error Responses

StatusCodeCause
400VALIDATION_ERRORMissing definitionId or invalid fields
401AUTH_ERRORMissing or invalid API key
404NOT_FOUNDReferenced workflow definition not found

List Workflow Runs

GET /v1/workflow-runs

Returns a paginated list of workflow runs in your workspace.

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number (min 1)
pageSizeinteger20Results per page (1-100)
statusstring--Filter by status: PENDING, RUNNING, WAITING, PAUSED, COMPLETED, FAILED, CANCELLED
definitionIdstring--Filter by workflow definition ID

Example Request

curl "https://api.stevora.dev/v1/workflow-runs?status=RUNNING&pageSize=10" \
  -H "x-api-key: stv_your_api_key"

Response 200 OK

{
  "success": true,
  "data": [
    {
      "id": "wfrun_def456",
      "workspaceId": "ws_xyz789",
      "definitionId": "wfdef_abc123",
      "status": "RUNNING",
      "input": { "companyName": "Acme Corp" },
      "output": null,
      "createdAt": "2026-04-02T12:00:00.000Z",
      "updatedAt": "2026-04-02T12:01:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "pageSize": 10,
    "total": 1,
    "totalPages": 1
  }
}

Error Responses

StatusCodeCause
400VALIDATION_ERRORInvalid query parameters
401AUTH_ERRORMissing or invalid API key

Get a Workflow Run

GET /v1/workflow-runs/:id

Returns the current state of a single workflow run.

Path Parameters

ParameterTypeDescription
idstringThe workflow run ID

Example Request

curl https://api.stevora.dev/v1/workflow-runs/wfrun_def456 \
  -H "x-api-key: stv_your_api_key"

Response 200 OK

{
  "success": true,
  "data": {
    "id": "wfrun_def456",
    "workspaceId": "ws_xyz789",
    "definitionId": "wfdef_abc123",
    "status": "RUNNING",
    "input": { "companyName": "Acme Corp" },
    "output": null,
    "currentStepIndex": 1,
    "createdAt": "2026-04-02T12:00:00.000Z",
    "updatedAt": "2026-04-02T12:01:00.000Z"
  }
}

Error Responses

StatusCodeCause
401AUTH_ERRORMissing or invalid API key
404NOT_FOUNDRun does not exist or belongs to another workspace

Cancel a Workflow Run

POST /v1/workflow-runs/:id/cancel

Cancels a running or waiting workflow. Completed, failed, and already-cancelled runs cannot be cancelled.

Path Parameters

ParameterTypeDescription
idstringThe workflow run ID

Example Request

curl -X POST https://api.stevora.dev/v1/workflow-runs/wfrun_def456/cancel \
  -H "x-api-key: stv_your_api_key"

Response 200 OK

{
  "success": true,
  "data": {
    "id": "wfrun_def456",
    "status": "CANCELLED",
    "updatedAt": "2026-04-02T12:05:00.000Z"
  }
}

Error Responses

StatusCodeCause
401AUTH_ERRORMissing or invalid API key
404NOT_FOUNDRun not found
409CONFLICTRun is not in a cancellable state

Resume a Workflow Run

POST /v1/workflow-runs/:id/resume

Resumes a workflow that is waiting for an external signal. Use this to deliver signals to runs paused at external_event or wait steps.

Path Parameters

ParameterTypeDescription
idstringThe workflow run ID

Request Body

FieldTypeRequiredDescription
signalTypestringYesThe signal type the step is waiting for
payloadobjectNoData to deliver with the signal (defaults to {})

Example Request

curl -X POST https://api.stevora.dev/v1/workflow-runs/wfrun_def456/resume \
  -H "x-api-key: stv_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "signalType": "payment.confirmed",
    "payload": {
      "transactionId": "txn_98765",
      "amount": 499.00
    }
  }'

Response 200 OK

{
  "success": true,
  "data": {
    "id": "wfrun_def456",
    "status": "RUNNING",
    "updatedAt": "2026-04-02T12:10:00.000Z"
  }
}

Error Responses

StatusCodeCause
400VALIDATION_ERRORMissing signalType or invalid fields
401AUTH_ERRORMissing or invalid API key
404NOT_FOUNDRun not found
409CONFLICTRun is not in a waiting state

Retry a Workflow Run

POST /v1/workflow-runs/:id/retry

Retries a failed workflow run from the step that failed. The run must be in FAILED status.

Path Parameters

ParameterTypeDescription
idstringThe workflow run ID

Example Request

curl -X POST https://api.stevora.dev/v1/workflow-runs/wfrun_def456/retry \
  -H "x-api-key: stv_your_api_key"

Response 200 OK

{
  "success": true,
  "data": {
    "id": "wfrun_def456",
    "status": "RUNNING",
    "updatedAt": "2026-04-02T12:15:00.000Z"
  }
}

Error Responses

StatusCodeCause
401AUTH_ERRORMissing or invalid API key
404NOT_FOUNDRun not found
409CONFLICTRun is not in FAILED status

Run Statuses

StatusDescription
PENDINGRun has been created but execution has not started
RUNNINGRun is actively executing steps
WAITINGRun is paused at an external_event or wait step
PAUSEDRun is paused at an approval step
COMPLETEDAll steps finished successfully
FAILEDA step failed after exhausting retries
CANCELLEDRun was cancelled via the API