Skip to content

HTTP API Endpoints

The Zart HTTP API server (zart-server) exposes a REST interface for scheduling executions, delivering events, and querying status — enabling any language or system to integrate with Zart workflows.

http://localhost:7700/api/v1

All endpoints return JSON. All request bodies must be Content-Type: application/json.


Schedule a new workflow execution.

Request:

{
"task": "onboarding",
"data": { "user_id": "u123", "email": "user@example.com" },
"idempotency_key": "signup-u123"
}
FieldTypeRequiredDescription
taskstringyesRegistered task handler name
dataobjectyesInput data (must match handler’s Data type)
idempotency_keystringnoStable ID — duplicate calls with same key are safe

Response 201 Created:

{
"execution_id": "exec-7f3a9b2c",
"task": "onboarding",
"status": "pending",
"created_at": "2026-04-04T10:23:11Z"
}

Get the current status of an execution.

Response 200 OK:

{
"execution_id": "exec-7f3a9b2c",
"task": "onboarding",
"status": "running",
"steps_completed": 2,
"current_step": "provision-resources",
"waiting_for_event": null,
"started_at": "2026-04-04T10:23:15Z",
"completed_at": null,
"output": null,
"error": null
}

Status values:

StatusDescription
pendingScheduled, waiting for a worker to claim it
runningCurrently being processed by a worker
waitingDurably paused — sleeping or waiting for event
completedFinished successfully
failedExhausted retries or returned an error
cancelledExplicitly cancelled

List executions with optional filtering.

Query parameters:

ParameterTypeDescription
statusstringFilter by status
taskstringFilter by task name
limitintegerMax results (default: 50, max: 500)
offsetintegerPagination offset
orderasc | descSort by created_at (default: desc)

Example:

GET /api/v1/executions?status=running&task=onboarding&limit=20

Response 200 OK:

{
"executions": [
{
"execution_id": "exec-7f3a9b2c",
"task": "onboarding",
"status": "running",
"started_at": "2026-04-04T10:23:15Z"
}
],
"total": 1,
"limit": 20,
"offset": 0
}

Long-poll for execution completion. Blocks until the execution completes or the timeout expires.

Query parameters:

ParameterTypeDescription
timeoutintegerSeconds to wait (default: 30, max: 3600)

Response 200 OK (completed):

{
"execution_id": "exec-7f3a9b2c",
"status": "completed",
"output": { "customer_id": "cus_abc123" },
"completed_at": "2026-04-04T10:24:30Z"
}

Response 202 Accepted (still running after timeout):

{
"execution_id": "exec-7f3a9b2c",
"status": "running",
"message": "Timeout reached. Execution is still running."
}

Cancel a pending or running execution.

Response 200 OK:

{
"execution_id": "exec-7f3a9b2c",
"status": "cancelled"
}

Deliver an event to an execution that is waiting for it via ctx.wait_for_event().

Request:

{
"approved": true,
"reviewer": "jane@example.com",
"notes": "Looks good, proceed."
}

The request body becomes the event payload. It must be valid JSON and match the expected type in the workflow.

Response 200 OK:

{
"status": "delivered",
"execution_id": "exec-7f3a9b2c",
"event_name": "manager-approval"
}

Response 404 Not Found — execution does not exist.

Response 409 Conflict — execution is not waiting for this event.


All error responses follow the same shape:

{
"error": {
"code": "execution_not_found",
"message": "No execution found with ID exec-7f3a9b2c"
}
}

Error codes:

CodeHTTP StatusDescription
execution_not_found404Execution ID does not exist
task_not_registered422Task name has no registered handler
invalid_data422Request body failed validation
not_waiting_for_event409Execution is not in a waiting state for that event
execution_already_exists409Idempotency key conflicts with a different task
internal_error500Unexpected server error

The HTTP API will support bearer token authentication:

Authorization: Bearer your-api-token

Tokens are configured via the server’s configuration file or environment variables.