Delegate a human task
An assignee who has not responded hands their place to another user (to_user), replacing their entry in assignees.users in place, so sequential order is kept. The new user cannot already be an assignee, nor the initiator unless self-approval is allowed. The task must still be open.
POST /automation/v1/human-tasks/{task_id}/delegate
Authentication
Authorization: Bearer $PRAXIS_API_KEY
Request fields
| Parameter | Type | Description |
|---|---|---|
| path: task_id | string |
required; Human task ID (htask_). |
application/json
no additional fields.
| Field | Type | Description |
|---|---|---|
| to_user | string |
required; User ID taking over; cannot already be an assignee, nor the initiator unless self-approval is allowed. minLength: 1 |
Examples
Set these environment variables to your own resources:
| Variable | Source |
|---|---|
| RUN_ID | Run id; suspend/resume require a workflow; cancel requires a nonterminal run |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.com/automation/v1/human-tasks/{task_id}/delegate" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"to_user": "usr_docs_sample_delegate"
}'
import { createAutomationClient } from '@deepraxis/sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.com',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.humanTasks.delegate({
"path": {
"id": env("RUN_ID")
},
"body": {
"to_user": "usr_docs_sample_delegate"
}
});
console.log(result);
Response
HTTP 200
Success
application/json
| Field | Type | Description |
|---|---|---|
| id | string |
required; Human task ID (htask_), derived deterministically from the run and step; use it with retrieve, respond, cancel and delegate. The Console page is /automation/tasks/{id}. |
| owner | string |
required; ID of the organization that owns the task. |
| run_id | string |
required; ID of the workflow run (run_) that opened the task; the run continues once the task closes. |
| workflow | object / null |
required; The published workflow of the run; null for an ad hoc run. |
| workflow (variant 1).namespace | string |
required; Workflow namespace. |
| workflow (variant 1).name | string |
required; Workflow name. |
| task_reference | string |
required; JSON Pointer of the approval step in the workflow source, for example /do/1/approveRefund. |
| wait_id | string |
required; ID of the run's wait (wait_htask_); it closes only through respond, never through the run wait completion endpoint. |
| kind | "approval" |
required; Task kind; currently only approval. |
| title | string |
required; Approval title, at most 200 characters. |
| body | string |
required; Markdown details for the assignees, up to 16 KiB; empty string when not given. |
| context | null / string / number / boolean / object / JSON[] |
required; JSON context the workflow attached (for example the order), up to 32 KiB; null when not given. |
| context (variant 5).* | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| context (variant 6)[] | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| actions | object[] |
required; The 1–6 buttons an assignee chooses from; defaults to approve and reject. |
| actions[].id | string |
required; Action ID to pass as action_id to respond; starts with a lowercase letter, at most 32 characters. |
| actions[].label | string |
required; Button label. |
| actions[].style | "primary" / "danger" / "default" |
required; primary: the main button. danger: a destructive button, which is the rejection in all, quorum and sequential modes. default: a plain button. |
| actions[].require_comment | boolean |
required; When true, choosing this action requires a comment. |
| form_schema | object / null |
required; The form an assignee fills in (a JSON Schema subset - an object with at most 30 string, number, integer, boolean or enum fields); null when there is no form. |
| form_schema (variant 1).* (variant 5) | object |
Recursive JSON value. |
| form_schema (variant 1).* (variant 6)[] | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| assignees | object |
required; The assignees. no additional fields. |
| assignees.users | string[] |
required; Assignee user IDs, 1–20; sequential mode follows this order. Delegation replaces an entry in place. |
| assignees.groups | string[] |
required; Group assignment; not supported yet, always an empty array. |
| mode | "any" / "all" / "quorum" / "sequential" |
required; Decision rule. any: the first response decides. all: everyone must respond and any rejection rejects at once. quorum: quorum approvals approve, and it rejects once that many approvals are no longer possible. sequential: assignees respond in users order; any rejection rejects at once and the last approval approves. |
| quorum | integer / null |
required; Number of approvals required in quorum mode; null in other modes. |
| allow_self_approval | boolean |
required; When true, the person who started the run may respond to their own request; false by default. |
| allow_agent_decision | boolean |
required; When true, an agent (agent session or run token) may respond; false by default. |
| initiator | object |
required; The subject that started the run. no additional fields. |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" |
required; Initiator type: user, api_key, agent, run (a parent run), trigger or application. |
| initiator.id | string |
required; Initiator ID. |
| initiator.user_id | string / null |
required; The user behind the initiator (the owner of an API key or trigger), null when unknown; the self-approval rule uses it. |
| due_at | string |
required; Due time (RFC 3339); defaults to 3 days after creation, at most 30 days and never later than the run's deadline. on_timeout applies when it passes. format: "date-time" |
| on_timeout | object |
required; What happens at due_at. no additional fields. |
| on_timeout.action | "reject" / "approve" / "fault" |
required; reject: the workflow receives decision timeout:reject. approve: it receives timeout:approve. fault (default): the step raises a timeout error that try/catch can catch. |
| remind | string[] |
required; Reminder intervals (ISO 8601 durations, up to 3); stored, not yet sent in this version. |
| channels | "console" / "email"[] |
required; Notification channels: console or email; stored, delivery is not wired yet. |
| proposal | null / string / number / boolean / object / JSON[] |
required; An agent's proposal (any JSON up to 32 KiB) for the assignees to consider; null when not given. |
| proposal (variant 5).* | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| proposal (variant 6)[] | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| status | "open" / "completed" / "expired" / "cancelled" |
required; open: awaiting responses. completed: decided. expired: due_at passed. cancelled: withdrawn, including automatically when the run ended. |
| responses | object[] |
required; Responses submitted so far, in order. |
| responses[].actor | object |
required; Who responded. no additional fields. |
| responses[].actor.id | string |
required; The responder's user ID (for an agent, the user it acts for). |
| responses[].actor.kind | "human" / "agent" |
required; human: the person responded. agent: an agent responded on their behalf. |
| responses[].actor.display_name | string / null |
required; Display name; this service does not resolve names, so it is null and the Console resolves it from the user ID. |
| responses[].action_id | string |
required; The chosen action ID. |
| responses[].values | object |
required; Submitted form values; an empty object when there is no form. |
| responses[].values.* (variant 5) | object |
Recursive JSON value. |
| responses[].values.* (variant 6)[] | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| responses[].comment | string / null |
required; Comment; null when none. |
| responses[].via | "console" / "api" / "agent" |
required; Where it came from: console, api (the public API) or agent. |
| responses[].at | string |
required; Submission time (RFC 3339). format: "date-time" |
| outcome | object / null |
required; The decision, which is also the workflow step's output; null while open, and after a fault timeout or cancellation. |
| outcome (variant 1).decision | string |
required; The deciding action ID, or timeout:reject / timeout:approve when on_timeout decided. |
| outcome (variant 1).values | object |
required; Form values of the deciding response; an empty object on timeout. |
| outcome (variant 1).values.* (variant 5) | object |
Recursive JSON value. |
| outcome (variant 1).values.* (variant 6)[] | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| outcome (variant 1).comment | string / null |
required; Comment of the deciding response; null on timeout. |
| outcome (variant 1).decided_by | object / null |
required; Who decided; null on timeout. |
| outcome (variant 1).decided_by (variant 1).id | string |
required; The responder's user ID (for an agent, the user it acts for). |
| outcome (variant 1).decided_by (variant 1).kind | "human" / "agent" |
required; human: the person responded. agent: an agent responded on their behalf. |
| outcome (variant 1).decided_by (variant 1).display_name | string / null |
required; Display name; this service does not resolve names, so it is null and the Console resolves it from the user ID. |
| outcome (variant 1).responses | object[] |
required; All responses at the time the task closed. |
| outcome (variant 1).responses[].actor | object |
required; Who responded. no additional fields. |
| outcome (variant 1).responses[].actor.id | string |
required; The responder's user ID (for an agent, the user it acts for). |
| outcome (variant 1).responses[].actor.kind | "human" / "agent" |
required; human: the person responded. agent: an agent responded on their behalf. |
| outcome (variant 1).responses[].actor.display_name | string / null |
required; Display name; this service does not resolve names, so it is null and the Console resolves it from the user ID. |
| outcome (variant 1).responses[].action_id | string |
required; The chosen action ID. |
| outcome (variant 1).responses[].values | object |
required; Submitted form values; an empty object when there is no form. |
| outcome (variant 1).responses[].values.* (variant 5) | object |
Recursive JSON value. |
| outcome (variant 1).responses[].values.* (variant 6)[] | null / string / number / boolean / object / JSON[] |
Recursive JSON value. |
| outcome (variant 1).responses[].comment | string / null |
required; Comment; null when none. |
| outcome (variant 1).responses[].via | "console" / "api" / "agent" |
required; Where it came from: console, api (the public API) or agent. |
| outcome (variant 1).responses[].at | string |
required; Submission time (RFC 3339). format: "date-time" |
| created_at | string |
required; Creation time (RFC 3339). format: "date-time" |
| updated_at | string |
required; Last change time (RFC 3339). format: "date-time" |
Measured response
HTTP 200
{
"id": "htask_9343af8dea6c623372ac9143f4f693cbae34adcd48e2f6895d9f5cce688b5915",
"owner": "org_prxp50ywsssv6s86nhcn8yytb",
"run_id": "run_00mvoxntqb780f31cc95f554113bd65a13f24f0029943145c7f4d0edc9f3ec102b6fd61a50",
"workflow": null,
"task_reference": "/do/0/approve",
"wait_id": "wait_htask_9343af8dea6c623372ac9143f4f693cbae34adcd48e2f6895d9f5cce688b5915",
"kind": "approval",
"title": "报销 120 元",
"body": "差旅报销,附发票。",
"context": null,
"actions": [
{
"id": "approve",
"label": "同意",
"style": "primary",
"require_comment": false
},
{
"id": "reject",
"label": "驳回",
"style": "danger",
"require_comment": false
}
],
"form_schema": null,
"assignees": {
"users": [
"usr_docs_sample_delegate"
],
"groups": []
},
"mode": "any",
"quorum": null,
"allow_self_approval": true,
"allow_agent_decision": false,
"initiator": {
"type": "api_key",
"id": "key_rbq66f5v9vxqbk6cd702x5er",
"user_id": "usr_rxp50ywsssv6s86nhcn8yytb"
},
"due_at": "2026-10-26T08:26:32.807Z",
"on_timeout": {
"action": "fault"
},
"remind": [],
"channels": [
"console"
],
"proposal": null,
"status": "open",
"responses": [],
"outcome": null,
"created_at": "2026-10-26T07:26:32.807Z",
"updated_at": "2026-10-26T07:26:36.599Z"
}
Errors
| HTTP | Codes and description |
|---|---|
| 400 | INVALID_PARAMS: Invalid request parameters, path, cursor, or body format. |
| 403 | NOT_ASSIGNED: The caller is not an assignee of this task, it is not yet their turn in sequential mode, or (for cancel) the caller is neither the run's initiator nor an organization API key. SELF_APPROVAL: The person who started the run cannot respond to, or be delegated, their own request unless the workflow set allow_self_approval: true. |
| 404 | HUMAN_TASK_NOT_FOUND: The human task does not exist or belongs to another organization; take the htask_ ID from the human-tasks list or the run's waits. |
| 409 | TASK_CLOSED: The task is already closed (decided, expired or cancelled) or past due_at; it no longer accepts responses, delegation or cancellation. Retrieve the task to read its outcome. ALREADY_RESPONDED: The caller already responded; each assignee responds once. IDEMPOTENCY_IN_FLIGHT: A request with the same idempotency key is still in progress. |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
Authentication and common errors · Retain the X-Request-Id response header for troubleshooting.