API Documentation
The STELLWERK API provides programmatic access to execute flows and retrieve results. All endpoints return JSON and require authentication via API key.
Authentication
RequiredThere are two authentication contexts. Production access for external clients always uses an API key.
API Key (Machine-to-Machine)
Provide an API key via the Authorization header (preferred) or X-API-Key header. The key determines the tenant context.
Authorization: Bearer your_api_key_here
# or alternatively
X-API-Key: your_api_key_here
Session + CSRF
When the signed-in web dashboard calls the API (same-origin), Rails session + CSRF token are used. Do not build external integrations using this path.
X-Tenant-ID header-based unauthenticated access has been removed. Always send an API key outside the dashboard.
Request Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes* | Bearer token for API key authentication |
| X-API-Key | Alt | Alternative to Authorization header |
| Content-Type | Yes | Must be application/json |
| X-CSRF-Token | Session | Required only for session-based requests from web app |
* Either Authorization or X-API-Key is required for API access.
List Flows
GETReturns a list of all active flows for the authenticated tenant, ordered by most recently updated.
Response
// 200 OK
{
"flows": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Pricing Calculator",
"slug": "pricing-calculator",
"description": "Calculate dynamic pricing based on parameters",
"status": "active",
"created_at": "2025-07-08T10:00:00Z",
"updated_at": "2025-07-08T14:30:00Z"
}
]
}
Response Fields
-
idUUID identifier for the flow -
slugURL-friendly identifier (can be used in place of ID) -
statusAlways "active" for this endpoint (draft/archived flows are excluded)
Get Flow Details
GETRetrieve details for a specific flow. You can reference the flow by either its UUID or its slug.
Response
// 200 OK
{
"flow": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Pricing Calculator",
"slug": "pricing-calculator",
"description": "Calculate dynamic pricing based on parameters",
"status": "active",
"metadata": {
"version": "1.2",
"category": "pricing"
},
"nodes_count": 5,
"created_at": "2025-07-08T10:00:00Z",
"updated_at": "2025-07-08T14:30:00Z"
}
}
Additional Fields
-
metadataCustom key-value data attached to the flow (JSONB) -
nodes_countNumber of nodes in the flow graph
Execute Flow
POSTExecute a flow with the provided input parameters. The flow engine evaluates all nodes and returns the computed outputs.
Request Body
{
"inputs": {
"quantity": 10,
"unit_price": 25.50,
"customer_tier": "gold"
}
}
Note: The API also accepts params as an alternative key to inputs.
Success Response
{
"flow": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Pricing Calculator",
"slug": "pricing-calculator"
},
"inputs": {
"quantity": 10,
"unit_price": 25.50,
"customer_tier": "gold"
},
"result": {
"type": "flow_evaluation",
"flow_id": "550e8400-e29b-41d4-a716-446655440000",
"flow_name": "Pricing Calculator",
"flow_slug": "pricing-calculator",
"execution_status": "success",
"outputs": {
"subtotal": 255.00,
"discount": 25.50,
"total": 229.50
},
"context": {
"quantity": 10,
"unit_price": 25.50,
"customer_tier": "gold",
"discount_rate": 0.1
},
"applied_nodes": ["start_1", "calc_price", "calc_discount", "end_1"],
"errors": []
},
"requirements": {
"declared_types": {
"quantity": "integer",
"unit_price": "number",
"customer_tier": "string"
},
"required_without_defaults": ["quantity", "unit_price"]
},
"executed_at": "2025-07-08T14:35:22Z"
}
Response Fields
result object
-
outputsFinal computed values from EndNode(s) -
contextAll variables in scope after execution (inputs + computed) -
applied_nodesList of node IDs that were executed (in order) -
execution_status"success" or "failed"
requirements object
-
declared_typesType declarations from the StartNode input schema -
required_without_defaultsInput names that are required and have no default value
Execution Error
{
"success": false,
"error": "Flow execution failed",
"details": {
"flow_id": "550e8400-e29b-41d4-a716-446655440000",
"flow_name": "Pricing Calculator",
"execution_status": "failed",
"errors": [
"Required input missing: quantity",
"Invalid type for unit_price: expected number"
]
}
}
Quota Exceeded
{
"success": false,
"error": "execution_quota_exceeded",
"details": {
"message": "Monthly execution quota reached for your plan.",
"plan": "starter",
"limit": 10000
}
}
Test Cases
Flows can have associated test cases for validation. These endpoints allow you to manage and run test cases programmatically.
List Test Cases
GET /api/v1/flows/:flow_id/test_cases
Get Test Case
GET /api/v1/flows/:flow_id/test_cases/:id
Create Test Case
POST /api/v1/flows/:flow_id/test_cases
Update Test Case
PATCH /api/v1/flows/:flow_id/test_cases/:id
Delete Test Case
DELETE /api/v1/flows/:flow_id/test_cases/:id
Run Test Case
POST /api/v1/flows/:flow_id/test_cases/:id/run
Executes the flow with the test case's predefined inputs and compares the result against expected outputs.
Error Responses
Bad Request
{
"error": "Missing parameter: inputs"
}
Unauthorized
{
"error": "Authentication required"
}
Payment Required
{
"success": false,
"error": "execution_quota_exceeded",
"details": { "message": "Monthly execution quota reached for your plan." }
}
Not Found
{
"error": "Record not found"
}
Unprocessable Entity
{
"success": false,
"error": "Flow execution failed",
"details": {
"errors": ["Required input missing: quantity"]
}
}
cURL Examples
Base URLs
- Production:
https://api.stellwerk.io - Development:
http://localhost:3000
List Flows
curl \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ https://api.stellwerk.io/api/v1/flows
Get Flow Details
curl \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ https://api.stellwerk.io/api/v1/flows/pricing-calculator
Execute Flow
curl -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":{"quantity":10,"unit_price":25.50}}' \
https://api.stellwerk.io/api/v1/flows/pricing-calculator/execute
Using X-API-Key Header
curl \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ https://api.stellwerk.io/api/v1/flows