Skip to content

Chain workflows ​

A Chain describes executable work. It can run instructions directly or coordinate executable tasks. An ordinary checklist is not sufficient to produce a successful workflow run.

If you only need to create and complete a work item, use the task tutorial. Use a Chain when the work needs an execution lifecycle.

Documented operations ​

These operations use a JWT Bearer token and the applicable workspace permissions and entitlements.

MethodPathPurpose
POST/chainsCreate an instruction-backed Chain
GET/chains/:idRead one authorized Chain
GET/chains/:id/bit-treeInspect the workflow's task graph
POST/chains/:id/trigger-runRequest a workflow run

Create an instruction-backed Chain ​

Use clear instructions that describe an output the system can produce. This example leaves execution manual:

CHAIN_RESPONSE="$(curl --fail-with-body -sS -X POST "https://api.chainabit.com/api/v1/chains" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title":"Launch review summary","instructions":"Draft a concise launch-readiness checklist with sections for documentation, testing, and support."}')"
printf '%s\n' "$CHAIN_RESPONSE" | jq .
export CHAIN_ID="$(printf '%s\n' "$CHAIN_RESPONSE" | jq -er '.data.id')"

Set TOKEN as described in prerequisites. Creation is subject to access and input validation; inspect a refusal before continuing. Instructions you send are saved as written and assessed before the Chain's first run, not at creation.

FieldRequirement
titleRequired, nonblank, at most 150 characters.
instructionsRequired, nonblank, at most 32,000 characters. Must describe executable work.
descriptionOptional explanatory text, at most 500 characters. It does not replace instructions.
idOptional caller-generated UUID for retrying the same creation.
chainyIdOptional authorized Project UUID in the same account and workspace.
scheduleOptional recurring schedule; see scheduling.

Inspect the Chain ​

curl --fail-with-body -sS "https://api.chainabit.com/api/v1/chains/$CHAIN_ID" \
  -H "Authorization: Bearer $TOKEN" | jq .

Keep the returned Chain identity. Reading a Chain does not start a run. Use the execution guide to inspect its graph and request a run.

Project association ​

A Chain can belong to at most one Project, or remain standalone. Include chainyId when creating it to associate it with an authorized Project in the same account and workspace.

Association does not grant access to that Project or authorize its tools. Moving or sharing generated content does not remove its original context restrictions.

Authorized Project context ​

When a Chain uses Project context, the system checks current access. Project instructions and knowledge are context for the task; they do not authorize new tools, spending, or external actions. A run must retain the access required for the resources it uses.

Execution requirements ​

The system validates the executable source and the caller's execution authority before each run. Changed or invalid instructions, missing task execution sources and insufficient access can refuse execution. A successful create response is not a promise that every future run will be admitted.

An instruction-backed Chain does not need an Agent. The tools a run may use come from the Chain's access settings, which a person manages in Chainabit. When the instructions need tools and those settings grant none, every run is refused with 422 chain_authorization_required until a tool is granted; see when a run is refused.

For task-based workflows, each executable task needs its applicable execution source. Task execution explains the separate AI execution capability.

Scheduling ​

You can include a schedule at Chain creation:

json
{
  "title": "Weekly launch review",
  "instructions": "Draft a concise launch-readiness checklist with sections for documentation, testing, and support.",
  "schedule": {
    "cron": "0 9 * * 1",
    "timezone": "Europe/Istanbul"
  }
}

Use a numeric five-field cron and an IANA timezone. The example requests Mondays at 09:00 in that timezone. Scheduling can result in recurring AI usage; omit it for a manual workflow. A schedule never supplies missing permissions or execution authority.

Read trigger concepts before configuring recurring work.

Trash and retention ​

Chain lifecycle operations in the product are separate from task deletion. Shared resources and independently managed tasks have their own access and retention rules. Do not use Chain cleanup as a substitute for managing those resources deliberately.

Admission failures ​

A request such as “remind me to learn vocabulary” describes a human activity; instructions such as “produce a vocabulary list with definitions” describe an output the system can generate. If a run is refused because of the instructions, inspect the error's guidance and revise the work itself. Repeating an unchanged request does not repair invalid instructions.

Built with purpose. chainabit.com