Stevora

Workflow Definitions

Create and manage workflow definitions

Workflow Definitions

A workflow definition is a versioned blueprint that describes the steps your workflow will execute. Definitions are immutable once created -- to change a workflow, create a new definition with an incremented version.

Create a Workflow Definition

POST /v1/workflow-definitions

Creates a new workflow definition in your workspace.

Request Body

FieldTypeRequiredDescription
namestringYesName of the workflow (1-200 characters)
versionstringYesVersion identifier (1-50 characters)
descriptionstringNoDescription of the workflow (max 1000 characters)
stepsStep[]YesArray of step definitions (at least one)

Step Types

Each step in the steps array must include a type field. The available types are:

TypeDescription
taskExecute a named handler function
waitPause for a duration or until a timestamp
conditionBranch based on an expression
external_eventWait for an external signal
llmCall an LLM with tool support and guardrails
approvalRequest human approval before continuing

Example Request

curl -X POST https://api.stevora.dev/v1/workflow-definitions \
  -H "x-api-key: stv_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "customer-onboarding",
    "version": "1.0.0",
    "description": "Automated customer onboarding with AI research",
    "steps": [
      {
        "type": "task",
        "name": "enrich-company",
        "handler": "enrichCompanyData",
        "config": { "source": "clearbit" }
      },
      {
        "type": "llm",
        "name": "generate-welcome-email",
        "model": "gpt-4o",
        "messages": [
          { "role": "user", "content": "Write a welcome email for {{companyName}}" }
        ],
        "temperature": 0.7,
        "maxTokens": 500
      },
      {
        "type": "approval",
        "name": "review-email",
        "contentKey": "welcomeEmail",
        "prompt": "Review the generated welcome email before sending"
      },
      {
        "type": "task",
        "name": "send-email",
        "handler": "sendEmail"
      }
    ]
  }'

Response 201 Created

{
  "success": true,
  "data": {
    "id": "wfdef_abc123",
    "workspaceId": "ws_xyz789",
    "name": "customer-onboarding",
    "version": "1.0.0",
    "description": "Automated customer onboarding with AI research",
    "steps": [ ... ],
    "createdAt": "2026-04-02T12:00:00.000Z",
    "updatedAt": "2026-04-02T12:00:00.000Z"
  }
}

Error Responses

StatusCodeCause
400VALIDATION_ERRORInvalid or missing fields in the request body
401AUTH_ERRORMissing or invalid API key

List Workflow Definitions

GET /v1/workflow-definitions

Returns all workflow definitions in your workspace.

Example Request

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

Response 200 OK

{
  "success": true,
  "data": [
    {
      "id": "wfdef_abc123",
      "workspaceId": "ws_xyz789",
      "name": "customer-onboarding",
      "version": "1.0.0",
      "description": "Automated customer onboarding with AI research",
      "steps": [ ... ],
      "createdAt": "2026-04-02T12:00:00.000Z",
      "updatedAt": "2026-04-02T12:00:00.000Z"
    }
  ]
}

Error Responses

StatusCodeCause
401AUTH_ERRORMissing or invalid API key

Get a Workflow Definition

GET /v1/workflow-definitions/:id

Returns a single workflow definition by ID.

Path Parameters

ParameterTypeDescription
idstringThe workflow definition ID

Example Request

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

Response 200 OK

{
  "success": true,
  "data": {
    "id": "wfdef_abc123",
    "workspaceId": "ws_xyz789",
    "name": "customer-onboarding",
    "version": "1.0.0",
    "description": "Automated customer onboarding with AI research",
    "steps": [
      {
        "type": "task",
        "name": "enrich-company",
        "handler": "enrichCompanyData",
        "config": { "source": "clearbit" }
      }
    ],
    "createdAt": "2026-04-02T12:00:00.000Z",
    "updatedAt": "2026-04-02T12:00:00.000Z"
  }
}

Error Responses

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