Skip to content
dhanu docs
Browse pages

API reference

Run a workflow

POST /api/pub/v1/workflows/{workflowId}/run, fill a workflow's fields and start the task it composes.

POSThttps://api.dhanu.ai/api/pub/v1/workflows/{workflowId}/run

Fills the workflow’s fields and starts the task its prompt composes, assigned to the workflow’s suggested staff member when it has one. Values are validated server-side against the stored field definitions; a missing required field or a value of the wrong type is invalid_workflow_values with an issues list.

Request

Path parameterTypeRequiredNotes
workflowIdstringYes
FieldTypeRequiredNotes
valuesobjectYesOne entry per field key; required fields must be present.
curl -X POST https://api.dhanu.ai/api/pub/v1/workflows/$WORKFLOW_ID/run \
  -H "Authorization: Bearer $DHANU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "values": { "topic": "Q3 results", "audience": "board" } }'
const task = await dhanu.workflows.run(workflowId, { topic: "Q3 results", audience: "board" });
task = dhanu.workflows.run(workflow_id, {"topic": "Q3 results", "audience": "board"})

Response

202 Accepted: the task, as on create a task.

Errors

CodeStatusMeaning
invalid_api_key401The bearer key is missing or unknown.
api_key_revoked401The key was revoked.
api_key_expired401The key passed its expiry date.
api_key_ip_not_allowed403The caller's IP is outside the key's allowlist.
developer_access_revoked403The key's creator lost developer access in the workspace.
api_key_project_scope403The key covers no active projects, or projectId is outside its scope.
invalid_request_body422The body did not match the schema; error.issues names each field.
not_found404No such resource in the key's workspace.
invalid_workflow_values422The workflow values do not satisfy the workflow's fields; error.issues names each one.