Skip to content

Workflow runs ​

Endpoints to control runs of workflow agents. Workflows are started with POST /v1/agents/{slug}/runs and cancelled with POST /v1/runs/{id}/cancel.

Retry a run ​

http
POST /v1/runs/{id}/retry

Scope: agents:run. No body. Re-executes a failed workflow run from its failed node(s): those nodes and everything downstream run again; nodes that succeeded keep their outputs.

Response 202:

json
{ "runId": "…", "status": "running" }
StatusCodeWhen
409NOT_A_WORKFLOW_RUNthe run is not a workflow run
409RUN_NOT_RETRYABLEthe run is not failed
409RUN_ENDED_AT_FAIL_NODEthe run ended at a fail node (params.nodeId): a retry would end there again
404NOT_FOUNDunknown run
ts
await hevkar.runs.retry(runId);

Decide an approval ​

http
POST /v1/runs/{id}/approvals/{nodeId}

Scope: workflows:approve (not implied by agents:run). Approves or rejects the approval node nodeId of a waiting run.

Body fieldTypeDescription
decisionapprove | rejectrequired; follows the approved or rejected edge
dataanyreplaces the node's output (the reviewed data)
commentstring (≤ 5000)stored with the decision

Response 200: { "runId": "…", "status": "running" } (the run's status after the decision).

StatusCodeWhen
404APPROVAL_NOT_FOUNDno approval is waiting at this node
400VALIDATION_FAILEDinvalid body
bash
curl "$HEVKAR_BASE_URL/v1/runs/$RUN_ID/approvals/review" \
  -H "Authorization: Bearer $HEVKAR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"decision": "reject", "comment": "Amount does not match the order"}'
ts
await hevkar.runs.approve(runId, 'review', {
  decision: 'reject',
  comment: 'Amount does not match',
});

Send an event ​

http
POST /v1/runs/{id}/events

Scope: workflows:approve (not implied by agents:run). Resumes a wait node in event mode that waits for this name.

Body fieldTypeDescription
namestring (1–200)required; the node's eventName
dataanybecomes the wait node's output

Response 200: { "runId": "…", "status": "running" }.

StatusCodeWhen
409EVENT_NOT_EXPECTEDno wait node of the run is waiting for name
bash
curl "$HEVKAR_BASE_URL/v1/runs/$RUN_ID/events" \
  -H "Authorization: Bearer $HEVKAR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "payment.received", "data": {"amount": 120}}'
ts
await hevkar.runs.sendEvent(runId, { name: 'payment.received', data: { amount: 120 } });

WorkflowNodeRun ​

Returned in nodes of GET /v1/runs/{id} and GET /v1/runs/{id}/steps.

FieldTypeDescription
iduuid
nodeIdstringthe node's id in the graph
nodeTypestring | nullthe node type (null if the node is no longer in the graph)
iterationinteger0 for the node; map items are index + 1, loop iterations 1, 2, …
statusstringpending, running, waiting, succeeded, failed, skipped, cancelled
inputanyevaluated input (agent input, HTTP request, items, ...)
outputany
handlestring | nullthe output handle followed (urgent, approved, error, ...); null = main output
attemptsintegertries so far
childRunIduuid | nullthe child run of an agent node, map item or loop iteration
error{code, message} | null
startedAtstring | null
finishedAtstring | null

WorkflowWait ​

Returned in waits of GET /v1/runs/{id}/steps.

FieldTypeDescription
iduuid
nodeIdstring
kindstringapproval, event or timer
eventNamestring | nullevents
messagestring | nullapprovals
resumeAtstring | nulltimers: when the run resumes; approvals and events: when the timeout edge is taken
createdAtstring
resolvedAtstring | null
resolvedBystring | nulluser:<id>, api_key:<id> or system
resolutionanythe decision or event

Hevkar public API v1