# Tasks ## Create a task `$ handinger tasks create` **post** `/api/tasks` Run a new task against an existing worker and wait for the result. Send a `taskId` of a prior task to add a follow-up turn instead of starting a fresh task. Send `multipart/form-data` to attach files; the bytes are bootstrapped into the worker's workspace before the task starts. The task runs to completion on the server even if the connection drops; subscribe to task webhooks for long-running tasks. ### Parameters - `--input: string` - `--budget: optional "low" or "standard" or "high" or "unlimited"` Compute budget the worker is allowed to spend on the task. Defaults to `standard`. - `--task-id: optional string` Optional client-provided task id. Reuse this id to add turns to an existing task. - `--worker-id: optional string` Worker id the task belongs to. If omitted, a new worker is created on-the-fly using the input as instructions. ### Returns - `worker: object { id, created_at, error, 13 more }` - `id: string` - `created_at: number` - `error: unknown` - `files: array of object { filename, mediaType, url, size }` - `filename: string` - `mediaType: string` - `url: string` - `size: optional number` - `incomplete_details: unknown` - `messages: array of unknown` - `metadata: map[unknown]` - `object: "worker"` - `output: array of object { id, content, role, 2 more }` - `id: string` - `content: array of object { text, type }` - `text: string` - `type: "output_text"` - `role: "assistant"` - `status: "completed"` - `type: "message"` - `output_text: string` - `running: boolean` - `sources: array of object { id, title, type, url }` - `id: string` - `title: string` - `type: "url"` - `url: string` - `status: "running" or "completed" or "pending"` - `"running"` - `"completed"` - `"pending"` - `structured_output: map[unknown]` - `url: string` Web URL of the worker in the Handinger dashboard. - `usage: optional object { durationMs }` - `durationMs: optional number` ### Example ```cli handinger tasks create \ --api-key 'My API Key' \ --input "What's the weather today in Barcelona?" ``` #### Response ```json { "id": "id", "created_at": 0, "error": null, "files": [ { "filename": "filename", "mediaType": "mediaType", "url": "https://example.com", "size": 0 } ], "incomplete_details": null, "messages": [ {} ], "metadata": { "foo": "bar" }, "object": "worker", "output": [ { "id": "id", "content": [ { "text": "text", "type": "output_text" } ], "role": "assistant", "status": "completed", "type": "message" } ], "output_text": "output_text", "running": true, "sources": [ { "id": "id", "title": "title", "type": "url", "url": "url" } ], "status": "running", "structured_output": { "foo": "bar" }, "url": "https://v3.handinger.com/worker/wrk_vk81XUHKHG-qr4", "usage": { "durationMs": 0 } } ``` ## Retrieve a task `$ handinger tasks retrieve` **get** `/api/tasks/{taskId}` Retrieve a single task. ### Parameters - `--task-id: string` Task id returned by the create task endpoint. ### Returns - `TaskGetResponse: object { task }` - `task: object { id, completedAt, createdAt, 8 more }` - `id: string` - `completedAt: string` - `createdAt: string` - `createdByUserId: string` - `organizationId: string` - `status: "pending" or "running" or "completed" or 2 more` - `"pending"` - `"running"` - `"completed"` - `"error"` - `"aborted"` - `title: string` - `totals: object { credits, durationMs, turnCount }` Aggregate credit spend, elapsed wall-clock, and number of turns across the task. - `credits: number` - `durationMs: number` - `turnCount: number` - `triggeredBy: "api" or "email" or "schedule" or "ui"` - `"api"` - `"email"` - `"schedule"` - `"ui"` - `url: string` Web URL of the task in the Handinger dashboard. - `workerId: string` ### Example ```cli handinger tasks retrieve \ --api-key 'My API Key' \ --task-id tsk_01HZY31W2SZJ8MJ2FQTR3M1K9D ``` #### Response ```json { "task": { "id": "tsk_2Z-YWz3hFq6VlW", "completedAt": "2026-05-11T09:14:48.000Z", "createdAt": "2026-05-11T09:14:22.000Z", "createdByUserId": "usr_7yh-91XzM2nQ4", "organizationId": "org_8s1Df9aLp-1z", "status": "completed", "title": "Weather report for Barcelona", "totals": { "credits": 42, "durationMs": 25812, "turnCount": 1 }, "triggeredBy": "api", "url": "https://v3.handinger.com/worker/wrk_vk81XUHKHG-qr4/task/tsk_2Z-YWz3hFq6VlW", "workerId": "wrk_vk81XUHKHG-qr4" } } ``` ## List task turns `$ handinger tasks list-turns` **get** `/api/tasks/{taskId}/turns` List the individual turns for a task in execution order. ### Parameters - `--task-id: string` Task id returned by the create task endpoint. ### Returns - `task_turn_list: object { items, taskId }` - `items: array of Turn` - `id: string` - `completedAt: string` - `credits: number` - `durationMs: number` - `files: array of object { filename, mediaType, url, size }` Files published by this turn. - `filename: string` - `mediaType: string` - `url: string` - `size: optional number` - `input: string` - `inputTokens: number` - `outputText: string` - `outputTokens: number` - `role: string` - `seq: number` - `startedAt: string` - `status: string` - `structuredOutput: map[unknown]` Structured JSON payload when the worker is configured with an output schema. `null` otherwise. - `taskId: string` - `taskId: string` ### Example ```cli handinger tasks list-turns \ --api-key 'My API Key' \ --task-id tsk_01HZY31W2SZJ8MJ2FQTR3M1K9D ``` #### Response ```json { "items": [ { "id": "trn_4Hq-9Vk2pLm8Rx", "completedAt": "2026-05-11T09:14:48.000Z", "credits": 42, "durationMs": 25812, "files": [ { "filename": "filename", "mediaType": "mediaType", "url": "https://example.com", "size": 0 } ], "input": "What's the weather today in Barcelona?", "inputTokens": 1842, "outputText": "It's currently 21°C and sunny in Barcelona with a light breeze from the south-east.", "outputTokens": 312, "role": "assistant", "seq": 0, "startedAt": "2026-05-11T09:14:22.000Z", "status": "completed", "structuredOutput": { "temperatureCelsius": "bar", "conditions": "bar" }, "taskId": "tsk_2Z-YWz3hFq6VlW" } ], "taskId": "tsk_2Z-YWz3hFq6VlW" } ``` ## Archive a task `$ handinger tasks delete` **delete** `/api/tasks/{taskId}` Archive a task so it stops appearing in `GET /tasks` results. Turns and files are retained for audit purposes. Only the worker creator can archive a task. ### Parameters - `--task-id: string` Task id returned by the create task endpoint. ### Returns - `delete_task_response: object { archived }` - `archived: boolean` ### Example ```cli handinger tasks delete \ --api-key 'My API Key' \ --task-id tsk_01HZY31W2SZJ8MJ2FQTR3M1K9D ``` #### Response ```json { "archived": true } ``` ## Domain Types ### Create Task - `create_task: object { input, budget, taskId, workerId }` - `input: string` - `budget: optional "low" or "standard" or "high" or "unlimited"` Compute budget the worker is allowed to spend on the task. Defaults to `standard`. - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `taskId: optional string` Optional client-provided task id. Reuse this id to add turns to an existing task. - `workerId: optional string` Worker id the task belongs to. If omitted, a new worker is created on-the-fly using the input as instructions. ### Delete Task Response - `delete_task_response: object { archived }` - `archived: boolean` ### Task - `task: object { id, completedAt, createdAt, 8 more }` - `id: string` - `completedAt: string` - `createdAt: string` - `createdByUserId: string` - `organizationId: string` - `status: "pending" or "running" or "completed" or 2 more` - `"pending"` - `"running"` - `"completed"` - `"error"` - `"aborted"` - `title: string` - `totals: object { credits, durationMs, turnCount }` Aggregate credit spend, elapsed wall-clock, and number of turns across the task. - `credits: number` - `durationMs: number` - `turnCount: number` - `triggeredBy: "api" or "email" or "schedule" or "ui"` - `"api"` - `"email"` - `"schedule"` - `"ui"` - `url: string` Web URL of the task in the Handinger dashboard. - `workerId: string` ### Task Turn List - `task_turn_list: object { items, taskId }` - `items: array of Turn` - `id: string` - `completedAt: string` - `credits: number` - `durationMs: number` - `files: array of object { filename, mediaType, url, size }` Files published by this turn. - `filename: string` - `mediaType: string` - `url: string` - `size: optional number` - `input: string` - `inputTokens: number` - `outputText: string` - `outputTokens: number` - `role: string` - `seq: number` - `startedAt: string` - `status: string` - `structuredOutput: map[unknown]` Structured JSON payload when the worker is configured with an output schema. `null` otherwise. - `taskId: string` - `taskId: string` ### Turn - `turn: object { id, completedAt, credits, 12 more }` - `id: string` - `completedAt: string` - `credits: number` - `durationMs: number` - `files: array of object { filename, mediaType, url, size }` Files published by this turn. - `filename: string` - `mediaType: string` - `url: string` - `size: optional number` - `input: string` - `inputTokens: number` - `outputText: string` - `outputTokens: number` - `role: string` - `seq: number` - `startedAt: string` - `status: string` - `structuredOutput: map[unknown]` Structured JSON payload when the worker is configured with an output schema. `null` otherwise. - `taskId: string`