Skip to content

Tasks ​

Tasks are independently managed tasks that can participate in a Chain. Chain membership does not transfer a Task's lifecycle: physical Chain cleanup detaches the Task and preserves its own files. Delete a Task separately when needed. Generated task content also remains subject to its producing run's original context permissions; moving or sharing it does not remove those limits. See Chain retention and Project context.

Tasks support multiple views: tree, matrix, calendar, and gantt. Executing a Task requires an applicable executable source.

Endpoints ​

These are the published Task API routes. Every request requires an access token; AI execution and Agent binding also require their applicable permissions.

MethodPathDescription
POST/bitsCreate a task, optionally in a Chain or Project
POST/bits/insert-allBulk create tasks
GET/bits/treeRead the flat Task graph
GET/bits/matrixRead grouped matrix tasks
GET/bits/calendarRead scheduled tasks within a required date range
GET/bits/ganttRead Project-grouped tasks within a required date range
GET/bits/gantt/:chainyIdRead one Project's tasks within a required date range
GET/bits/:idGet a task
PATCH/bits/:idUpdate a task
DELETE/bits/:idDelete a task
POST/bits/:id/executeExecute a task through AI
POST/bits/:bitId/executionsBind an Agent to a task
POST/bits/:bitId/eventsRecord a completion event
GET/chains/:chainId/eventsRead a Chain's completion events
POST/bits/:bitId/relations/connectConnect two tasks

Developer token access ​

A developer token can call these routes directly as a Bearer token when it carries the matching scope. Every other Bit route refuses a developer token with 403, whatever scopes it carries.

ScopeRoutes
bits:readGET /bits/:id, GET /bits/tree, GET /bits/calendar, GET /bits/gantt/:chainyId
bits:writePOST /bits, PATCH /bits/:id (including Project placement, completion and assignees)

A token without the required scope receives 403. Deleting or executing a Bit is not available to developer tokens; use a signed-in session for those.

Task Execution Context ​

A Task's execution can consume authorized file context. Context access rules remain effective; attaching a resource does not broaden who can read it. Direct AI execution also requires active paid subscription coverage and the applicable AI permissions. Without active coverage, the request is rejected with 403 and error code subscription_inactive.

Create Task ​

Request ​

All fields are optional. A Task can exist without a Chain or Project. The examples attach one to an existing Chain; omit chainId for a standalone task.

FieldTypeRequiredDescription
idUUIDNoOptional caller-generated ID. Retrying with the same ID returns the existing Task.
titlestringNoTitle, up to 1,024 characters.
notestringNoTask content, up to 10 MiB (10,485,760 bytes) of UTF-8 text.
pagesobject[]NoOrdered notebook, at most 200 pages. Page content takes precedence over note.
chainIdUUIDNoOptional Chain membership. A Chain holds at most 1,000 Tasks: creating one into a full Chain is refused with 422 and the error code chain_step_limit_exceeded, and nothing is created.
chainyIdUUIDNoOptional Project association.
parentIdUUIDNoParent Task for nesting.
prioritystringNop1, p2, p3, or p4.
statusstringNopending, completed, skipped, failed, archived, or deleted; defaults to pending.
publishStatestringNodraft or published; defaults to published.
scheduledDatestring or nullNoStart date, YYYY-MM-DD.
scheduledTimestring or nullNoStart time, HH:mm or HH:mm:ss.
scheduledToDatestring or nullNoEnd date, YYYY-MM-DD.
scheduledToTimestring or nullNoEnd time, HH:mm or HH:mm:ss.
isAllDaybooleanNoAll-day schedule. Defaults to true when no start time is supplied.
waitingOnstring or nullNohuman, external, system, approval, dependency, or event.
waitingExpectedBystring or nullNoISO 8601 date-time.
stageIdUUIDNoKanban stage.
stageOrderintegerNoStage position, at least zero.
x, yintegerNoLayout coordinates.
viewKeystringNoLayout view.
assigneeIdsUUID[]NoUp to 20 distinct assignee IDs (UUID v4). Supersedes the older single assigneeId.
assigneeIdUUIDNoDeprecated single-assignee field; prefer assigneeIds.

A notebook page requires id (UUID), title (up to 1,024 characters), content, and ISO 8601 createdAt and updatedAt. Its optional attachments array contains at most 200 strings. The titles and contents of all pages together hold up to 10 MiB of UTF-8 text.

When creating or updating a Task, a note, or its pages together, larger than 10 MiB is refused with 413 and error code bits.text_too_large, and a request body larger than 12 MiB with 413. Saving a large note also counts toward your account: a save that would take your notes past your account's storage allocation is refused with 403 and storage_quota_exceeded, and exceeding the hourly write budget for large notes is refused with 429 and bits.text_write_budget_exhausted, whose retryAfterSeconds says when to try again. While other large notes are being saved, the request may receive 503 with a Retry-After header; retry after that many seconds.

An all-day schedule does not include times. A timed schedule supplies the start date/time and end date/time, with the end no earlier than the start. Without a start date, leave every schedule date/time unset.

Response ​

Selected fields from the created Task; IDs and revisions are illustrative. Detail responses also include edit capability, publication, assignment and completion metadata.

json
{
  "data": {
    "id": "00000000-0000-4000-8000-000000000001",
    "title": "Study verb conjugations - present tense",
    "chainId": "00000000-0000-4000-8000-000000000010",
    "note": "Focus on regular -ar, -er, -ir verb conjugations",
    "priority": "p2",
    "status": "pending",
    "parentId": null,
    "scheduledDate": "2030-03-18",
    "scheduledTime": null,
    "scheduledToDate": "2030-03-18",
    "scheduledToTime": null,
    "isAllDay": true,
    "pages": [],
    "createdBy": { "kind": "human", "agentId": null },
    "revision": 1
  }
}

createdBy records who created the Task. The server sets it when the Task is created and it never changes: a create or update request that sends createdBy is refused with 400. kind is, for example, human for a person using Chainabit or the API, chao_automated for Chao working without an agent, or mcp_client for an external app connected through MCP. agentId is null when the creator is not an agent.

Code Examples ​

The examples already use the API address. Set TOKEN to your access token and CHAIN_ID to the data.id returned by Create Chain. Chain membership is optional; remove that field when creating an independent Task.

curl -X POST https://api.chainabit.com/api/v1/bits \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Study verb conjugations - present tense",
  "chainId": "'"$CHAIN_ID"'",
  "note": "Focus on regular -ar, -er, -ir verb conjugations",
  "priority": "p2",
  "scheduledDate": "2030-03-18",
  "scheduledToDate": "2030-03-18",
  "isAllDay": true
}'

Bulk Create Tasks ​

Request ​

Supply titles for simple title-only creation or bits for complete create objects. Each array accepts at most 40 entries. Optional top-level chainId and chainyId apply common membership to the batch; omit them for independent tasks. If the batch would take the Chain past 1,000 Tasks, the whole request is refused with 422 and the error code chain_step_limit_exceeded, and no task is inserted.

Response ​

For three newly inserted tasks:

json
{
  "data": {
    "insertedCount": 3,
    "insertedIds": [
      "00000000-0000-4000-8000-000000000002",
      "00000000-0000-4000-8000-000000000003",
      "00000000-0000-4000-8000-000000000004"
    ],
    "skippedTitles": [],
    "duplicates": []
  }
}

Code Examples ​

These examples reuse CHAIN_ID from Create Task.

curl -X POST https://api.chainabit.com/api/v1/bits/insert-all \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "chainId": "'"$CHAIN_ID"'",
  "bits": [
    {
      "title": "Practice listening comprehension"
    },
    {
      "title": "Write 5 sentences in Spanish"
    },
    {
      "title": "Read a news article in Spanish"
    }
  ]
}'

Tree View ​

Request ​

Authenticated read of the Task graph. The response is a flat bits array plus relations, rather than nested children arrays.

Response ​

json
{
  "data": {
    "bits": [
      {
        "id": "00000000-0000-4000-8000-000000000001",
        "title": "Study verb conjugations - present tense",
        "parentId": null,
        "childCount": 0,
        "status": "pending",
        "priority": "p2"
      }
    ],
    "relations": []
  },
  "meta": {
    "limit": 20,
    "offset": 0,
    "total": 1,
    "hasNextPage": false
  }
}

Code Examples ​

curl "https://api.chainabit.com/api/v1/bits/tree" \
  -H "Authorization: Bearer $TOKEN"

Matrix View ​

Response ​

Quadrant names are grouping labels. They do not execute or delete a task.

json
{
  "data": {
    "matrix": {
      "DO": [],
      "SCHEDULE": [
        {
          "id": "00000000-0000-4000-8000-000000000001",
          "title": "Study verb conjugations - present tense",
          "priority": "p2"
        }
      ],
      "DELEGATE": [],
      "DELETE": [],
      "INBOX": [],
      "ARCHIVE": []
    },
    "totals": {
      "all": 1,
      "byQuadrant": {
        "DO": 0,
        "SCHEDULE": 1,
        "DELEGATE": 0,
        "DELETE": 0,
        "INBOX": 0,
        "ARCHIVE": 0
      }
    }
  },
  "meta": {
    "limit": 20,
    "offset": 0,
    "total": 1,
    "hasNextPage": false
  }
}

Code Examples ​

curl "https://api.chainabit.com/api/v1/bits/matrix" \
  -H "Authorization: Bearer $TOKEN"

Calendar View ​

Request ​

from and to are required ISO date-times or YYYY-MM-DD dates. Optional chainyId restricts the read to a Project.

Response ​

A flat array of scheduled Tasks, with pagination metadata:

json
{
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000001",
      "title": "Study verb conjugations - present tense",
      "scheduledDate": "2030-03-18",
      "scheduledToDate": "2030-03-18",
      "scheduledTime": null,
      "scheduledToTime": null,
      "isAllDay": true
    }
  ],
  "meta": {
    "limit": 20,
    "offset": 0,
    "total": 1,
    "hasNextPage": false
  }
}

Code Examples ​

curl "https://api.chainabit.com/api/v1/bits/calendar?from=2030-03-01&to=2030-03-31" \
  -H "Authorization: Bearer $TOKEN"

Gantt View ​

Request ​

from and to are required ISO date-times or YYYY-MM-DD dates. The Project-scoped variant uses /bits/gantt/:chainyId, where chainyId is a readable Project's ID. Both reads apply the same date range.

Response ​

The global response groups tasks by Project. Independent tasks appear in a group whose id is null. The scoped read returns one Project group.

json
{
  "data": [
    {
      "id": null,
      "title": "No Project",
      "status": null,
      "visibility": null,
      "colorHex": null,
      "targetDate": null,
      "bits": [
        {
          "id": "00000000-0000-4000-8000-000000000001",
          "title": "Study verb conjugations - present tense",
          "chainyId": null,
          "parentId": null,
          "status": "pending",
          "isAllDay": true,
          "scheduledDate": "2030-03-18",
          "scheduledTime": null,
          "scheduledToDate": "2030-03-18",
          "scheduledToTime": null,
          "completedAt": null
        }
      ]
    }
  ],
  "meta": {
    "limit": 50,
    "offset": 0,
    "total": 1,
    "hasNextPage": false
  }
}

Code Examples ​

curl "https://api.chainabit.com/api/v1/bits/gantt?from=2030-03-01&to=2030-03-31" \
  -H "Authorization: Bearer $TOKEN"

For a Project-scoped read, set CHAINY_ID from Create Project:

curl "https://api.chainabit.com/api/v1/bits/gantt/$CHAINY_ID?from=2030-03-01&to=2030-03-31" \
  -H "Authorization: Bearer $TOKEN"

Task Completion Events ​

Record self-attested completion evidence for an accessible Task. An event does not change the Task's status or make the task independently verified. The service derives the current authorized Chain membership, including no membership for a standalone Task.

Endpoints ​

MethodPathDescriptionAuth
GET/chains/:chainId/eventsList accessible completion events for a ChainJWT
POST/bits/:bitId/eventsRecord self-attested completion evidenceJWT

Record Completion Event ​

Request ​

FieldTypeRequiredDescription
sourcestringYesClient source label, 1–64 characters; these examples use user.
signatureHashstringYesClient signature, 1–256 characters. It does not grant verification.
chainIdUUID or nullNoOptional assertion of the Task's current Chain membership. Omit to derive it. A supplied mismatch is rejected.
periodIdUUIDNoPeriod belonging to the Task's current Chain. Not applicable to standalone Tasks.
previousEventHashstringNoPrevious client signature, 1–256 characters.
completedAtstringNoISO 8601 timestamp; defaults to the current time.
evidenceMetadataobjectNoClient evidence, such as notes. This does not grant verification.

Response ​

Selected returned fields; this endpoint uses the following field names:

json
{
  "data": {
    "id": "00000000-0000-4000-8000-000000000050",
    "bit_id": "00000000-0000-4000-8000-000000000001",
    "chain_id": "00000000-0000-4000-8000-000000000010",
    "completed_at": "2030-03-17T14:30:00.000Z",
    "source": "user",
    "signature_hash": "study-session-2030-03-17",
    "evidence_metadata": {
      "notes": "Completed the present tense study session"
    }
  }
}

Code Examples ​

Set BIT_ID to the data.id from Create Task. These examples work with a standalone Task or one associated with a Chain.

curl -X POST https://api.chainabit.com/api/v1/bits/$BIT_ID/events \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "user",
    "signatureHash": "study-session-2030-03-17",
    "completedAt": "2030-03-17T14:30:00Z",
    "evidenceMetadata": {
      "notes": "Completed the present tense study session"
    }
  }'

List Events for a Chain ​

Set CHAIN_ID to the Chain whose events you can access. Optional limit accepts 1–50, and offset starts at zero. Results are ordered by completion time, newest first.

Response ​

Selected fields of the returned event array:

json
{
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000050",
      "bit_id": "00000000-0000-4000-8000-000000000001",
      "chain_id": "00000000-0000-4000-8000-000000000010",
      "completed_at": "2030-03-17T14:30:00.000Z",
      "source": "user",
      "signature_hash": "study-session-2030-03-17"
    }
  ]
}

Code Examples ​

curl https://api.chainabit.com/api/v1/chains/$CHAIN_ID/events \
  -H "Authorization: Bearer $TOKEN"

Task Execution Profiles ​

An execution profile binds an authorized Agent instance to a Task. It defines execution mode and limits. Creating the binding does not itself execute the Task.

Endpoints ​

MethodPathDescriptionAuth
POST/bits/:bitId/executionsCreate an Agent execution bindingJWT + Agent management permission

Create Execution Profile ​

Request ​

FieldTypeRequiredDescription
agentInstanceIdUUIDYesAn Agent instance you are permitted to bind.
executionModestringNoauto or scheduled_agent; defaults to auto.
modelIdUUIDNoEntitled model override. Otherwise an active default is selected.
featureKeystringNoApplicable billing feature.
retryPolicyobjectNoRetry configuration.
timeoutSecondsintegerNoTimeout, at least zero.
maxRetriesintegerNoRetry limit, at least zero.
priorityintegerNoExecution priority, at least zero.
isActivebooleanNoWhether the binding is active.
acknowledgeBilledUnattendedbooleanWith scheduled_agenttrue, sent after the person has seen that the Agent will run the Task on its own and that those runs are billed. See Billed unattended execution.

Set BIT_ID from Create Task and AGENT_INSTANCE_ID to an Agent instance you are permitted to manage. GET /agents/instances/available returns available instances with their id; binding one also requires the applicable Task, Agent and workspace permissions.

Billed unattended execution ​

scheduled_agent lets the Agent run the Task on its own, without you present, and those runs are billed. The request succeeds only from a signed-in session that sends acknowledgeBilledUnattended: true after the person has seen that notice. Without it, or from a caller that cannot show the notice (the Chainabit CLI and MCP clients), the API answers 403 with the error code approval_required and creates nothing. The person approves it in the Chainabit web app, or asks Chao to do it. auto is not affected.

json
{
  "error": {
    "code": "approval_required",
    "message": "Show the billed unattended notice and confirm it before continuing.",
    "details": { "implications": ["runs_unattended", "runs_are_billed"] }
  }
}

A request that confirms the notice:

curl -X POST https://api.chainabit.com/api/v1/bits/$BIT_ID/executions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "agentInstanceId": "'"$AGENT_INSTANCE_ID"'",
  "executionMode": "scheduled_agent",
  "acknowledgeBilledUnattended": true,
  "isActive": true
}'

Response ​

Selected returned fields; this endpoint uses the following field names:

json
{
  "data": {
    "id": "00000000-0000-4000-8000-000000000020",
    "bit_id": "00000000-0000-4000-8000-000000000001",
    "agent_instance_id": "00000000-0000-4000-8000-000000000030",
    "execution_mode": "auto",
    "retry_policy": {},
    "timeout_seconds": null,
    "max_retries": 0,
    "priority": 100,
    "is_active": true
  }
}

Code Examples ​

curl -X POST https://api.chainabit.com/api/v1/bits/$BIT_ID/executions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "agentInstanceId": "'"$AGENT_INSTANCE_ID"'",
  "executionMode": "auto",
  "isActive": true
}'

Task Relations ​

Define a directed relationship between two accessible Tasks. A blocking relation can prevent its target from proceeding. Blocking dependency, sequence, and conditional relations require both Tasks to belong to the same Chain, or both to be standalone. Relationships that create a dependency cycle are rejected.

Endpoints ​

MethodPathDescriptionAuth
POST/bits/:bitId/relations/connectConnect two TasksJWT

Connect Two Tasks ​

Request ​

FieldTypeRequiredDescription
fromBitIdUUIDYesSource Task; use the same ID in the path.
toBitIdUUIDYesTarget Task.
relationTypestringYesdependency, sequence, parallel, conditional, ai_trigger, or reference; these examples use dependency.
isBlockingbooleanNoWhether the relationship blocks its target; defaults to true.
weightintegerNoOptional relationship weight.
metadataobjectNoOptional relationship metadata.

BIT_ID identifies the source and TARGET_BIT_ID identifies another accessible Task.

Response ​

json
{
  "data": {
    "id": "00000000-0000-4000-8000-000000000040",
    "fromBitId": "00000000-0000-4000-8000-000000000001",
    "toBitId": "00000000-0000-4000-8000-000000000002",
    "relationType": "dependency",
    "isBlocking": true,
    "createdAt": "2030-03-17T12:00:00.000Z",
    "updatedAt": "2030-03-17T12:00:00.000Z"
  }
}

Code Examples ​

curl -X POST https://api.chainabit.com/api/v1/bits/$BIT_ID/relations/connect \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "fromBitId": "'"$BIT_ID"'",
  "toBitId": "'"$TARGET_BIT_ID"'",
  "relationType": "dependency",
  "isBlocking": true
}'

Built with purpose. chainabit.com