Task types and fields
A task type is the template for one kind of request: the fields a task carries, what the human is asked, who answers and what happens next.
What a task type holds#
You create task types in the app, under Task types. Each belongs to one workspace and has:
| Setting | What it does |
|---|---|
| Key | What integrations send as task_type, unique in the workspace: lower-case letters, digits, _ and -, 2 to 63 characters (approve_refund). |
| Name | Shown to humans, and the task's title when the request sends none. |
| Kind | Approval (approve, reject, or approve with edits) or follow-up (someone takes it on, then marks it done or hands it back). |
| Instructions | What the human is asked to do, shown on the task page. |
| Fields | The data each task carries. See Fields. |
| Chain | Who is asked, in order, and how long each has. A step of an approval type can ask several people and need N of their approvals (consensus steps, routing.quorum). A step can also leave its human open, to be named when each task is created (open steps); an open step can need N approvals too, from people named when each task is created. See Escalation chains. |
| Chain override | Off by default. When on, a task created through the API may send its own chain, which replaces the task type's for that task (send your own chain, routing.chain_override). |
| If nobody answers | The default action. |
| Deadline | An optional overall deadline for new tasks (a request's deadline_minutes wins). |
| Callback URL | Where the outcome is posted (a request's callback_url wins). See Callbacks. |
| Payload | The standard callback body, or your own JSON from a template, on plans that include it. See Custom payload. |
| GitHub Actions | A GitHub workflow to start when a task finishes, by default only when a person approves. See GitHub Actions. |
| Webhook URL | A URL that turns any posted JSON into a task, with its field mapping. See Webhook intake. |
Editing a task type never changes tasks that already exist: a task keeps the chain, default action and timers it was created with.
Fields#
A field has a key (lower-case letters, digits and _, starting with a letter, up to 40 characters), a label the human sees, a type and up to four switches. A task type has up to 50 fields.
| Type | JSON value | Rules |
|---|---|---|
text | string | Up to 1,000 characters. |
long_text | string | Up to 20,000 characters, for drafts and descriptions. |
number | number | Any JSON number. A number sent as a string ("249") is refused. |
boolean | true or false | Shown as yes or no. |
email | string | One @, no spaces, up to 254 characters. |
url | string | An absolute http or https address, up to 1,000 characters. javascript:, data: and other schemes are refused (field_invalid). |
| Switch | Effect |
|---|---|
| Required | The task is refused without it (field_required). A null value counts as missing. |
| Sensitive | Never placed in emails, previews, subjects, logs or error messages; shown only on the task page, to the human. Use it for customer data, account numbers and anything personal. |
| Editable | The human may change the value before approving (decision.action: "edited", the new values in decision.payload). Needs the page.edit feature. |
| Clickable | email and url fields only, on by default ("clickable": false turns it off). The value is shown as a link on the task page, in the app's inbox and in the task detail. See Links in fields. |
Links in fields#
A clickable field becomes a link only when its value is safe to open:
- An
emailvalue becomes amailto:link when it is a plain address (no spaces, and none of?,&,#or%, so it can't add a copy recipient or a message body). - A
urlvalue becomes a link only when it starts withhttps://(in any letter case) and has no user name or password in it. Anhttp://address is accepted in the payload but stays plain text. - The text shown is always the address itself. A long address is cut short on screen with an ellipsis; the whole address shows when you point at it. A host written in another script (
bücher.example) is shown in its ASCII form (xn--bcher-kva.example), so look-alike letters can't pass for a site you know. - Web links open in a new tab, without passing on the page address, and are marked
nofollow. - Emails to humans never contain links built from field values, and sensitive fields are never in emails at all.
- The request email and its reminder show the task type's instructions and the fields that are neither sensitive nor web addresses, one
Label: valueline each (up to 20 fields, 300 characters per value). Mark a field sensitive to keep it on the task page only.
Human inputs#
With the page.custom_fields feature, a task type can ask the person for up to 10 inputs when they answer: short or long text, a number, a choice from a list, a tick box, or files. Each one can be required and asked on some answers only (for example a reason code on reject, a photo on approve; a follow-up's inputs are asked on done). The task keeps the inputs its type had when it was created. Inputs are not asked on a consensus step: each person there only votes.
- What the person fills in reaches you in the decision (
decision.fields, anddecision.attachmentsfor files), never in an email. - Files: up to 5 per input and 10 per task, each up to 10 MB unless support set another size. Accepted: PDF, PNG, JPEG, GIF, WebP, HEIC, plain text and CSV (UTF-8), DOCX, XLSX, PPTX, ODT and ODS, checked by name and content. HTML, SVG, archives, executables and macro files are refused. Files are encrypted where they are stored and deleted with their task. They are not virus-scanned.
- A file uploaded but not sent with an answer is deleted after 24 hours, or once the task ends.
- Storage: the files of all your tasks share your plan's attachment storage (
limit.attachment_storage_mb, shown on your Plan page and on the pricing page; support can raise it for your organization). Owners, admins and billing members get an email at 80% and when it is full. When it is full, new uploads are refused withattachment_storage_fulland the person is told they can still answer without a file if it is optional. Files go when their tasks leave your task history, or when you erase the human who uploaded them. Nothing is deleted just because storage is full; but if the organization stays over its allowance (after a storage add-on ends or a downgrade), the files of its oldest finished tasks may be removed until it fits, at the earliest 30 days after the first email about it (removed files). - After a downgrade, nothing is asked any more; the task type keeps its inputs and can still be edited, but not given new ones.
How a payload is checked#
payloadmust be a JSON object of at most 64 KB (payload_not_object,payload_too_large_bytes).- When the task type has fields, the payload may contain only those: an unknown key is
field_unknown, a wrong typefield_invalid, a text over its limitfield_too_long. - A task type without fields accepts any JSON object.
- Every problem is reported under
errorsaspayload.<field>, with a code and a message, never with the value.
curl https://api.tasktohuman.com/v1/tasks \
-H "Authorization: Bearer $TTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"task_type": "approve_refund",
"payload": {
"order_id": "4821",
"amount": "249"
}
}'const response = await fetch("https://api.tasktohuman.com/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TTH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
task_type: "approve_refund",
payload: {
order_id: "4821",
amount: "249",
},
}),
});
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']}",
},
json={
"task_type": "approve_refund",
"payload": {
"order_id": "4821",
"amount": "249",
},
},
timeout=10,
)
print(response.status_code, response.json())HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "Some fields need your attention.",
"status": 400,
"code": "validation_failed",
"errors": {
"payload.amount": [
{
"code": "field_invalid",
"message": "This value doesn't match the field's type."
}
]
},
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"
}History#
Every task type keeps a history of who changed what: open the task type in the app, then open History. Each save or action is one entry, newest first, with the member who made it and what changed:
- the name, key, kind, instructions, default action, time to finish and default deadline (old and new value; for the instructions only that they changed);
- fields added, removed or changed, by key;
- the chain: steps added, removed or changed (who is asked, the wait, the reminder), and whether a task may replace it;
- the callback URL set, changed or removed, with the names of the task type's custom headers that now go to the new address. The address is shown without its query string, and a path longer than two segments is cut after the second (
https://hooks.example.com/hooks/catch/…): when only the hidden part changed, the entry says that the path or the query changed; - custom headers added, replaced or deleted, by name only, and the callback URL being confirmed for your organization's headers;
- the custom payload template set, changed or removed, with a fingerprint and the length of the text, never the text;
- the GitHub Actions destination set, changed or removed (repository, what to start, workflow, branch or tag, event type and input names, never fixed texts), and its token added, removed, or cleared by a change to those settings, never the token;
- the webhook mapping, a new webhook URL, and archiving.
- the human groups a step uses: who was added to or removed from the group, and the group being renamed. These entries name the member who changed the group, and every task type that uses the group (and is not archived) gets one.
The history never holds a secret: no header value, no GitHub token, no webhook URL, no query string of a callback URL and no more than the start of its path. Nobody can edit or delete an entry. Up to 200 entries of each task type are kept: past that the oldest go first, and the entries about custom headers, the address they are sent to, and the GitHub destination and its token go last, so renaming a task type many times cannot push them out. Anyone who can see the task type can read its history; another member's address is shown only to those who can see the member list, and our support staff appear as "TaskToHuman support". A member who has since left your organization appears as "A former member"; if you need to know who changed a callback URL that custom headers are sent to, our support can tell you.
The history covers the task type's own settings and the human groups its steps use. Changing a human's name or address, or archiving a human (who then leaves their groups), changes who is asked without changing the task type or a group, and is not recorded here.
Humans#
Humans are the people a chain names: a name, an email address and, optionally, a language and a time zone (without them the workspace's defaults apply, then the organization's; the time zone is used for the dates in their emails). A human needs no account and never signs in. Your plan sets how many different humans you can use each monthly period (limit.humans): an archived human, or an address you changed, keeps its place until the period ends (unless it was a mistake fixed within 24 hours, before any message was sent), and the same address counts once. Answering tasks always uses a humans place and managing always uses a member seat: a member with the Human role, or any other member with "Also receives tasks" ticked (the default, except for read-only members), is kept as a human in each of their workspaces, sees their tasks in their inbox in the app, and uses a humans place as well as a seat. Members and humans are added and managed together on the Humans page of the app, one at a time or in bulk. Archiving a human moves their open tasks to the next step of each chain.
Human groups#
A human group is a named list of humans of one workspace: "Finance approvers", "On-call leads". You manage groups on the Humans page of the app, with the routing.human_groups feature (see pricing). A step of a task type can point to a group instead of naming a human; whoever creates a task then names one member of that group for the step, or, on a step that needs several approvals, as many members as the step takes (open steps).
- A workspace has up to 50 groups, each with up to 200 humans. A name has 1 to 60 characters and is unique in its workspace, whatever the letter case.
- Members are active humans of the group's own workspace. A human who is archived or erased leaves every group and is not added back.
- A group that a task type's step uses can't be deleted; change those steps first. A group may be empty, but a task can't be created on a step whose group has fewer people who can be asked than the step needs: one, or the approvals needed of a consensus step (
approver_group_empty). - Changing a group never changes tasks that already exist.
Read task types and humans from the API#
Three read-only endpoints give an integration what it needs to fill in a task type's fields, name approvers or send its own chain. They answer for the key's workspace only, with a test or a live key (both see the same task types). The task types answer on every plan. GET /v1/humans needs routing.approver_at_creation or routing.chain_override and, with ?group=, routing.human_groups (403 feature_not_in_plan otherwise).
The lists are paged: limit is 1 to 100 (default 50), and when the answer's next_cursor is not null, send it as cursor to get the next page.
| Endpoint | Returns |
|---|---|
GET /v1/task-types | { "data": [ … ], "next_cursor": null }: by key, each task type's key, name, kind, steps, chain_override (whether a task may send its own chain), fields and default_deadline_minutes. A step has its number (step, from 1), its assignment (human, at_creation or group) and, on a group step, the group (id, name). A field has its key (its name in payload), label, type (text, long_text, number, boolean, email or url), and required, sensitive and editable. default_deadline_minutes is the deadline a task gets when you send none (null: no deadline). Archived task types are left out. Nothing else of a task type is shown: never its callback, webhook, instructions or humans. |
GET /v1/task-types/{key} | One task type, exactly as the list shows it. An unknown key, an archived task type or one of another workspace gives 404. Handy for tools that show a task type's fields as a form. |
GET /v1/humans | { "data": [ … ], "next_cursor": null }: the workspace's humans who can be asked (active, address not marked undeliverable), oldest first, as id and name. Never an address. With ?group=<group id>, only that group's members; an unknown group gives an empty list. |
curl "https://api.tasktohuman.com/v1/task-types?limit=1" \
-H "Authorization: Bearer $TTH_API_KEY"const response = await fetch("https://api.tasktohuman.com/v1/task-types?limit=1", {
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/task-types?limit=1",
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
{
"data": [
{
"key": "approve_refund",
"name": "Approve a refund",
"kind": "approval",
"steps": [
{
"step": 1,
"assignment": "human"
},
{
"step": 2,
"assignment": "group",
"group": {
"id": "01a1dd02-3c4b-7e19-9f0a-2b5c6d7e8f90",
"name": "Finance"
}
}
],
"chain_override": false,
"fields": [
{
"key": "order_id",
"label": "Order",
"type": "text",
"required": true,
"sensitive": false,
"editable": false
},
{
"key": "amount",
"label": "Amount (€)",
"type": "number",
"required": true,
"sensitive": false,
"editable": true
},
{
"key": "reason",
"label": "Reason",
"type": "long_text",
"required": true,
"sensitive": false,
"editable": false
},
{
"key": "customer_email",
"label": "Customer email",
"type": "email",
"required": false,
"sensitive": true,
"editable": false
}
],
"default_deadline_minutes": 1440
}
],
"next_cursor": "approve_refund"
}curl https://api.tasktohuman.com/v1/task-types/approve_refund \
-H "Authorization: Bearer $TTH_API_KEY"const response = await fetch("https://api.tasktohuman.com/v1/task-types/approve_refund", {
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/task-types/approve_refund",
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
{
"key": "approve_refund",
"name": "Approve a refund",
"kind": "approval",
"steps": [
{
"step": 1,
"assignment": "human"
},
{
"step": 2,
"assignment": "group",
"group": {
"id": "01a1dd02-3c4b-7e19-9f0a-2b5c6d7e8f90",
"name": "Finance"
}
}
],
"chain_override": false,
"fields": [
{
"key": "order_id",
"label": "Order",
"type": "text",
"required": true,
"sensitive": false,
"editable": false
},
{
"key": "amount",
"label": "Amount (€)",
"type": "number",
"required": true,
"sensitive": false,
"editable": true
},
{
"key": "reason",
"label": "Reason",
"type": "long_text",
"required": true,
"sensitive": false,
"editable": false
},
{
"key": "customer_email",
"label": "Customer email",
"type": "email",
"required": false,
"sensitive": true,
"editable": false
}
],
"default_deadline_minutes": 1440
}