Skip to content
中文

Respond to a human task

Submit an action (action_id), form values (values) and a comment as the calling user. Depending on the task's mode the response either decides it (status becomes completed, outcome is set, and the waiting workflow resumes with outcome as the step output) or is recorded while other assignees are awaited. When two assignees respond at once, exactly one decides and the other gets TASK_CLOSED. An agent may respond only if the workflow set allow_agent_decision. Send an Idempotency-Key to retry safely.

POST /automation/v1/human-tasks/{task_id}/respond

Authentication

Authorization: Bearer $PRAXIS_API_KEY

Request fields

Parameter Type Description
path: task_id string required; Human task ID (htask_).
header: Idempotency-Key string optional; Optional; 1–256 characters. Within 24 hours, the same key replays the first response with Idempotent-Replayed: true; a different request body returns 422; an in-flight request returns 409. minLength: 1; maxLength: 256

application/json

no additional fields.

Field Type Description
action_id string required; The chosen action ID from the task's actions, for example approve. minLength: 1
values object optional; Form values matching the task's form_schema; omit or pass {} when there is no form.
values.* (variant 5) object Recursive JSON value.
values.* (variant 6)[] null / string / number / boolean / object / JSON[] Recursive JSON value.
comment string optional; Comment of at most 4000 characters; required when the action has require_comment true. maxLength: 4000

Examples

Set these environment variables to your own resources:

: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.com/automation/v1/human-tasks/{task_id}/respond" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "action_id": "approve",
  "comment": "同意"
}'
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.respond({
  "path": {
    "id": env("RUN_ID")
  },
  "body": {
    "action_id": "approve",
    "comment": "同意"
  }
});
console.log(result);

Response

HTTP 200

Success

Header Type Description
Idempotent-Replayed boolean Present and true when replaying the first response for this key.

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_c85611f5546106a9e140fae63de3be0b0bbe2feeb9f003ec8fd1db1b6da5b900",
  "owner": "org_prxp50ywsssv6s86nhcn8yytb",
  "run_id": "run_00mvoxnjik9a1389c530fcdf94b41977428e7f06a62a11a82ca4e851ffa9db5daa2cb7901c",
  "workflow": null,
  "task_reference": "/do/0/approve",
  "wait_id": "wait_htask_c85611f5546106a9e140fae63de3be0b0bbe2feeb9f003ec8fd1db1b6da5b900",
  "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_rxp50ywsssv6s86nhcn8yytb"
    ],
    "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:19.537Z",
  "on_timeout": {
    "action": "fault"
  },
  "remind": [],
  "channels": [
    "console"
  ],
  "proposal": null,
  "status": "completed",
  "responses": [
    {
      "actor": {
        "id": "usr_rxp50ywsssv6s86nhcn8yytb",
        "kind": "human",
        "display_name": null
      },
      "action_id": "approve",
      "values": {},
      "comment": "同意",
      "via": "api",
      "at": "2026-10-26T07:26:25.460Z"
    }
  ],
  "outcome": {
    "decision": "approve",
    "values": {},
    "comment": "同意",
    "decided_by": {
      "id": "usr_rxp50ywsssv6s86nhcn8yytb",
      "kind": "human",
      "display_name": null
    },
    "responses": [
      {
        "actor": {
          "id": "usr_rxp50ywsssv6s86nhcn8yytb",
          "kind": "human",
          "display_name": null
        },
        "action_id": "approve",
        "values": {},
        "comment": "同意",
        "via": "api",
        "at": "2026-10-26T07:26:25.460Z"
      }
    ]
  },
  "created_at": "2026-10-26T07:26:19.537Z",
  "updated_at": "2026-10-26T07:26:25.460Z"
}

Errors

HTTP Codes and description
400 INVALID_PARAMS: Invalid request parameters, path, cursor, or body format. COMMENT_REQUIRED: The chosen action requires a comment (require_comment: true); retry with comment set. INVALID_ACTION: action_id is not one of the task's actions; read the task's actions for the valid ids. INVALID_VALUES: values do not match the task's form_schema (unknown field, missing required field, wrong type or out-of-range value), or comment exceeds 4000 characters.
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. AGENT_NOT_ALLOWED: The request comes from an agent (an agent session or run token) and the task did not set allow_agent_decision: true; the person must respond from the Console or with their own credential.
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.
422 IDEMPOTENCY_KEY_MISMATCH: The idempotency key was already used for different request content.
default RFC 9457 automation problem. 429 includes Retry-After.

Authentication and common errors · Retain the X-Request-Id response header for troubleshooting.