Quickstart
From nothing to your first decision. Test tasks notify only you, so you can try everything without bothering anyone.
1. Create a task type#
In the app, open Task types and create one. A task type is the template for one kind of request. The examples on this site use a refund approval:
- Key
approve_refund: what your code sends astask_type. - Fields
order_id(text, required),amount(number, required),reason(long text) andcustomer_email(email, marked sensitive). - Chain: who answers first and who steps in when they don't. Add yourself as a human to start (the examples below call you Ana).
More in Task types and fields.
2. Create a test API key#
Open API & webhooks, then API keys, and create a key in test mode. It starts with tth_test_ and is shown once. Store it as an environment variable, so it never ends up in your code:
export TTH_API_KEY="tth_test_…"Test tasks notify only you, whoever the task type names, and never count toward your usage. See Test mode.
3. Check the key#
key.mode says test:
curl https://api.tasktohuman.com/v1/me \
-H "Authorization: Bearer $TTH_API_KEY"const response = await fetch("https://api.tasktohuman.com/v1/me", {
headers: {
Authorization: `Bearer ${process.env.TTH_API_KEY}`,
},
});
const body = await response.json();
console.log(response.status, body);import os
import requests
response = requests.get(
"https://api.tasktohuman.com/v1/me",
headers={
"Authorization": f"Bearer {os.environ['TTH_API_KEY']}",
},
timeout=10,
)
print(response.status_code, response.json())HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"organization": {
"id": "01a1dcb7-3aaf-7b52-9557-611799ccefc1",
"name": "Lumen Outdoor"
},
"workspace": {
"id": "01a1dcb7-3ab8-7bb2-b72a-95c34c3fa302",
"name": "Shop"
},
"key": {
"id": "01a1dcbc-0d4e-7f21-9c3a-5b8e1f7a2d64",
"prefix": "tth_test_3Rw7NcYb",
"mode": "test"
}
}4. Send a task#
curl https://api.tasktohuman.com/v1/tasks \
-H "Authorization: Bearer $TTH_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: refund-test" \
-d '{
"task_type": "approve_refund",
"title": "Refund €249 to order #4821?",
"payload": {
"order_id": "4821",
"amount": 249,
"reason": "Arrived damaged",
"customer_email": "marta@example.com"
},
"deadline_minutes": 120
}'const response = await fetch("https://api.tasktohuman.com/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TTH_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "refund-test",
},
body: JSON.stringify({
task_type: "approve_refund",
title: "Refund €249 to order #4821?",
payload: {
order_id: "4821",
amount: 249,
reason: "Arrived damaged",
customer_email: "marta@example.com",
},
deadline_minutes: 120,
}),
});
const body = await response.json();
console.log(response.status, body);import os
import requests
response = requests.post(
"https://api.tasktohuman.com/v1/tasks",
headers={
"Authorization": f"Bearer {os.environ['TTH_API_KEY']}",
"Idempotency-Key": "refund-test",
},
json={
"task_type": "approve_refund",
"title": "Refund €249 to order #4821?",
"payload": {
"order_id": "4821",
"amount": 249,
"reason": "Arrived damaged",
"customer_email": "marta@example.com",
},
"deadline_minutes": 120,
},
timeout=10,
)
print(response.status_code, response.json())The answer is 201 Created with the task, which is now notified. "test": true marks it as a test task:
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
Location: /v1/tasks/01a1e3a9-1f52-7d3b-8e64-2a9c5d0b7e31
{
"id": "01a1e3a9-1f52-7d3b-8e64-2a9c5d0b7e31",
"state": "notified",
"task_type": "approve_refund",
"title": "Refund €249 to order #4821?",
"test": true,
"owner": {
"id": "01a1dcba-b57a-7aa2-b6b1-05d81545c2ba",
"name": "Ana"
},
"expires_at": "2026-11-16T11:19:20.7134083Z",
"created_at": "2026-11-16T09:19:20.7134083Z",
"finished_at": null,
"escalations": 0,
"decision": null
}You get the email. Open the link and approve or reject.
5. Get the decision#
Either add a callback URL to the task type (or send callback_url with the task) and receive the outcome as a signed POST, explained in Callbacks and signatures, or ask for the task:
curl https://api.tasktohuman.com/v1/tasks/01a1e3a9-1f52-7d3b-8e64-2a9c5d0b7e31 \
-H "Authorization: Bearer $TTH_API_KEY"const response = await fetch("https://api.tasktohuman.com/v1/tasks/01a1e3a9-1f52-7d3b-8e64-2a9c5d0b7e31", {
headers: {
Authorization: `Bearer ${process.env.TTH_API_KEY}`,
},
});
const body = await response.json();
console.log(response.status, body);import os
import requests
response = requests.get(
"https://api.tasktohuman.com/v1/tasks/01a1e3a9-1f52-7d3b-8e64-2a9c5d0b7e31",
headers={
"Authorization": f"Bearer {os.environ['TTH_API_KEY']}",
},
timeout=10,
)
print(response.status_code, response.json())HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "01a1e3a9-1f52-7d3b-8e64-2a9c5d0b7e31",
"state": "resolved",
"task_type": "approve_refund",
"title": "Refund €249 to order #4821?",
"test": true,
"owner": null,
"expires_at": "2026-11-16T11:19:20.713Z",
"created_at": "2026-11-16T09:19:20.713Z",
"finished_at": "2026-11-16T09:19:54.377Z",
"escalations": 0,
"decision": {
"action": "approved",
"by": {
"id": "01a1dcba-b57a-7aa2-b6b1-05d81545c2ba",
"name": "Ana"
},
"at": "2026-11-16T09:19:54.377Z",
"automatic": false,
"reason": null,
"comment": "Photos confirm the damage.",
"payload": null
},
"payload": {
"order_id": "4821",
"amount": 249,
"reason": "Arrived damaged",
"customer_email": "marta@example.com"
},
"payload_sha256": "77d21b5d074a3fa4dca6ed88891f798696041c64eca3e26e7d5d3a7f91d747ef"
}decision.action is approved, and decision.automatic is false because a person decided. That's the whole loop.
Next steps#
- Switch to a live key (
tth_live_…) when you are ready: tasks then go to the humans the task type names. - Learn the states and the decision your code acts on.
- Verify callback signatures before acting on them.
- Writing TypeScript or Python? The SDKs (
npm install @tasktohuman/sdk,pip install tasktohuman) create the task, wait for the decision and verify the callback for you. They are open source, in the tasktohuman-integrations repository. - No code at all? Every task type has a webhook URL.