Skip to content
Available today

TypeScript SDK

The official library for Node.js 22 or later. One call creates a task, another waits for the decision, and a helper checks the callback's signature before you act. Retries and idempotency are built in.

Where it fits

  1. TypeScript SDK
  2. TaskToHuman
  3. The person who decides
  4. Signed decision back to your code

What it does

  • createTask, getTask, listTasks (or every page with listAllTasks) and cancelTask, plus task types, humans and the files a person sent.
  • waitForDecision checks the task until a person decides, for scripts, tests and short agent turns; in production, a callback brings the decision.
  • verifyCallback checks the TTH-Signature header against the raw body and returns the task. A missing secret throws, so the check can't be switched off by accident.
  • No runtime dependencies, ESM with type declarations, an Idempotency-Key on every create and safe retries. Open source under the Apache License 2.0.

Set it up

  1. Run npm install @tasktohuman/sdk in your server project.

  2. Create an API key for the workspace, a test key first, and keep it in TTH_API_KEY. Use it on your server only.

  3. Create a task with createTask, then act on the verified callback, or wait with waitForDecision.

// npm install @tasktohuman/sdkimport { TaskToHuman } from "@tasktohuman/sdk";const tth = new TaskToHuman({ apiKey: process.env.TTH_API_KEY });const task = await tth.createTask(  {    task_type: "approve_refund",    title: "Refund €249 to order #4821?",    payload: { order_id: "4821", amount: 249, reason: "Arrived damaged" },    callback_url: "https://shop.example.com/hooks/tasktohuman",    deadline_minutes: 120,  },  { idempotencyKey: "refund-4821" }, // a retry with the same key returns the same task);// task.state is "notified"; the decision comes to callback_url, signed.

Put a human where it matters.

Start with one task type and one person to answer it.

Your humans answer from a link, no account needed.