Skip to main content
POST
/
v1
/
workflows
Create Workflow
curl --request POST \
  --url https://api.truthlocks.com/v1/workflows \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "Data Quality Pipeline",
  "steps": [
    {
      "action": "validate_schema",
      "agent_id": "550e8400-e29b-41d4-a716-446655440000",
      "parameters": {
        "strict": true
      }
    },
    {
      "action": "check_anomalies",
      "agent_id": "550e8400-e29b-41d4-a716-446655440001"
    }
  ],
  "triggers": {
    "cron": "0 */6 * * *"
  }
}
'
{
  "workflow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "steps": [
    {
      "action": "<string>",
      "agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "parameters": {}
    }
  ],
  "triggers": {},
  "created_at": "2023-11-07T05:31:56Z"
}
Creates a new workflow definition. Workflows define a directed acyclic graph (DAG) of steps that orchestrations execute in sequence. Each step specifies its type, configuration, and dependencies — enabling complex multi-step AI pipelines with deterministic execution order. Workflows are created in draft status and must be published before they can be executed. This two-phase approach allows teams to review and validate workflow definitions before they are available to agents.

Authentication

X-API-Key
string
required
API key with workflows:write scope. Alternatively, pass a Bearer JWT token in the Authorization header.
X-Tenant-ID
string
required
Tenant identifier for multi-tenant isolation.

Request

name
string
required
Human-readable workflow name. Must be unique within the tenant namespace per version.
description
string
Description of what this workflow accomplishes.
steps
object[]
required
Array of workflow step definitions. Each step contains: - name (string, required) — Unique step identifier within the workflow - type (string, required) — Step type: llm_inference, tool_call, guardrail_check, decision, transform, webhook - config (object, required) — Step-specific configuration (model, tool name, guardrail rules, etc.) - depends_on (string[]) — Array of step names that must complete before this step executes
version
string
Semantic version of the workflow (e.g. 1.0.0). Defaults to 1.0.0 if omitted.

Response

id
string
Unique workflow identifier.
name
string
Workflow name.
description
string
Workflow description.
version
string
Workflow version.
steps
array
The validated workflow step definitions.
status
string
Workflow status. Always draft on creation.
created_at
string
ISO 8601 timestamp of creation.

Authorizations

X-API-Key
string
header
required

API key for machine-to-machine authentication

Body

application/json
name
string
required

Workflow name

steps
object[]
required

Ordered workflow steps

triggers
object

Trigger conditions (cron, event, webhook)

Response

Workflow created

workflow_id
string<uuid>
name
string
steps
object[]
triggers
object
created_at
string<date-time>