Create and complete a task
Create a small work item, read it back, update it, and mark it complete. This tutorial uses a standalone task, so you do not need to create a project or workflow first.
Tasks use the API resource /bits. Keep that path and the returned field names unchanged when using the current product label “Task.”
Prerequisites
- An interactive access token for your Chainabit account.
curlandjqin a POSIX shell.- Permission to create and edit work in the selected workspace.
Complete prerequisites and set TOKEN in the same terminal. For a Business workspace, use the account and workspace selection required by your integration.
Task lifecycle
Create → Read → Update → Complete → Delete tutorial data.
The example edits your own new task. Use the captured ID throughout; never paste another person's resource ID into a delete request.
Step 1: Create a task
The note field stores the task's written content. A create request does not accept a description field.
TASK_RESPONSE="$(curl --fail-with-body -sS -X POST "https://api.chainabit.com/api/v1/bits" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"title":"Review the launch checklist","note":"Check the setup instructions and examples."}')"
printf '%s\n' "$TASK_RESPONSE" | jq .
export BIT_ID="$(printf '%s\n' "$TASK_RESPONSE" | jq -er '.data.id')"Expect 201 Created. The response includes the new task under data. Selected fields look like this; your UUID will differ:
{
"data": {
"id": "00000000-0000-4000-8000-000000000001",
"title": "Review the launch checklist",
"note": "Check the setup instructions and examples.",
"status": "pending",
"chainId": null,
"chainyId": null
}
}The shell command captures the real data.id as BIT_ID. If creation fails, inspect the error before continuing.
To associate a new task with a project, include its UUID in chainyId at creation. For all supported fields, see the task reference.
Step 2: Read the task
curl --fail-with-body -sS "https://api.chainabit.com/api/v1/bits/$BIT_ID" \
-H "Authorization: Bearer $TOKEN" | jq .Expect 200 OK. Check that data.id matches BIT_ID and data.title matches the title you submitted.
Step 3: Update its content
curl --fail-with-body -sS -X PATCH "https://api.chainabit.com/api/v1/bits/$BIT_ID" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"title":"Review and test the launch checklist","note":"Also follow the quickstart in a clean terminal."}' | jq .Expect 200 OK and the updated title and note. A PATCH supplies only the fields being changed; it is not a replacement of the whole task.
Step 4: Complete the task
curl --fail-with-body -sS -X PATCH "https://api.chainabit.com/api/v1/bits/$BIT_ID" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"completed"}' | jq .Expect 200 OK and data.status equal to completed. Completing a task is different from asking AI to execute it; this tutorial does not start an AI run.
Step 5: Delete your tutorial task
This removes the task you just created. Skip it if you want to keep that task.
curl --fail-with-body -sS -X DELETE "https://api.chainabit.com/api/v1/bits/$BIT_ID" \
-H "Authorization: Bearer $TOKEN" | jq .The endpoint returns 200 OK with a JSON result:
{"data":{"deleted":true}}It does not return 204 No Content. Check the body before reporting success in your own client.
If a request fails
| Symptom | Check |
|---|---|
401 | The token is valid, unexpired, and an interactive access token accepted by this route. |
403 | You have permission in the selected account and workspace. A token alone does not grant a workspace role. |
400 | Field names and types match the reference. Use note, not description; use returned UUIDs. |
404 | The ID came from your create response and the request uses the same workspace context. |
What you built
A complete task workflow using the same resource ID from creation through deletion. Your application can use the same sequence to display work and reflect changes from confirmed API responses.
Next steps
Explore Projects, task views and assignment, or Chains when you need executable workflows.