Docs: REST API and webhooks

Kanbun REST API and webhooks

Kanbun has a JSON API under /api/v1 for scripts, integrations and automation, and outgoing webhooks that tell other systems when cards change. The machine-readable description is openapi.json (OpenAPI 3.1), also served by every instance at /api/v1/openapi.json without a token.

Authentication

  1. Open Settings, section API tokens.
  2. Give the token a name, pick Read only or Read and write, and an expiry (never, 30, 90 or 365 days).
  3. Copy the token (kbn_ followed by 64 hex characters). It is shown once; Kanbun keeps only its SHA-256 hash.

Send it in the Authorization header:

export KANBUN=https://kanbun.example.com
export TOKEN=kbn_...
curl -H "Authorization: Bearer $TOKEN" "$KANBUN/api/v1/me"

A token acts as its user, with the same permissions: it sees the boards the user is a member of (every board for admins), and board-owner actions (reordering or deleting columns, creating tags, writing automation rules) need a board owner or an admin. It stops working when it is revoked, when it expires, when the user is deactivated, or when an admin resets the user's password (which revokes all of their tokens). Mutations (POST, PATCH, DELETE) need a Read and write token; a read-only token gets 403 insufficient_scope.

The API never reads the session cookie, so it is not exposed to cross-site request forgery, and it sends no CORS headers: call it from servers and scripts, not from web pages on other origins. Creating and revoking tokens is recorded in the audit log (token.create, token.revoke).

Resources

Method Path What
GET /me The token's user and the token itself
GET /boards Boards you can open (paginated)
GET /boards/{boardId} A board with its columns and tags
GET, POST /boards/{boardId}/columns List columns, add one at the end
PATCH, DELETE /columns/{columnId} Rename, set the WIP limit, move (position); delete to the trash
GET, POST /boards/{boardId}/cards List cards (filters below, archived ones only on request, paginated), create a card
GET, PATCH, DELETE /cards/{cardId} Read, change, move, archive or restore; delete to the trash
GET, POST /cards/{cardId}/comments List comments (oldest first, paginated), add one
GET, POST /cards/{cardId}/checklist List checklist items in order, add one
PATCH, DELETE /checklist/{itemId} Tick or untick, rename, assign, set the due date, move (position); delete
GET, POST /cards/{cardId}/attachments List a card's files, upload one (multipart/form-data)
GET, DELETE /attachments/{attachmentId} An attachment's details; delete it
GET /attachments/{attachmentId}/content Download the file (?thumb=1 for the image thumbnail)
GET, POST /boards/{boardId}/tags Tags of a board, create one (owners and admins)
GET /search?q= Search cards, like the command palette (paginated)
GET, POST /boards/{boardId}/automations Automation rules of a board, add one (owners and admins)
PATCH, DELETE /automations/{ruleId} Change, enable or disable, delete a rule (owners and admins)

Card filters on GET /boards/{boardId}/cards: column (column id), assignee (user id or username), tag (tag id or exact name), updatedSince (ISO 8601 date-time), archived (see below).

Archived cards

An archived card is off the board and its counts but not deleted: it keeps its column, position, history and everything on it, and it never expires (unlike the trash). Cards have archived (boolean) and archivedAt (ISO date-time or null).

  • GET /boards/{boardId}/cards leaves archived cards out by default, so the list matches the board. archived=true lists only archived cards, archived=all both, archived=false is the default.
  • GET /cards/{cardId} returns a card whether it is archived or not.
  • PATCH /cards/{cardId} with {"archived": true} archives a card, {"archived": false} restores it to its column, in the place it had. An archived card can not be moved: a columnId or position without "archived": false answers 409 with card_archived; send both to restore and move in one request.
  • Boards have autoArchiveAfterDays (read-only here, set in board settings): cards that have been in the board's last column that many days are archived automatically, checked once an hour; null when off.
  • Archive and restore take the same rights as deleting a card (board membership).

Changes made through the API behave like the same change in the browser: card history, watchers and notifications, live updates on open boards, the trash (deleted cards and columns can be restored for 30 days) and webhooks. That includes automation rules: creating a card in a column, or moving one there with PATCH /cards/{cardId}, runs that column's rules in the same request, and the card in the response already shows what they changed.

Checklists

GET /cards/{cardId}/checklist returns { "data": [ ... ] } with the card's items in checklist order. Anyone who can open the card can read and change its checklist, as in the card panel.

{
  "id": "cm...",
  "cardId": "cm...",
  "title": "Keyboard focus",
  "done": true,
  "position": 1,
  "assignee": { "id": "cm...", "username": "marta", "displayName": "Marta Nowak" },
  "dueDate": "2026-12-24",
  "completedAt": "2026-12-01T10:00:00.000Z",
  "completedBy": { "id": "cm...", "username": "marta", "displayName": "Marta Nowak" },
  "createdAt": "2026-11-30T09:00:00.000Z"
}
  • POST /cards/{cardId}/checklist adds an item: title (1 to 200 characters), and optionally assigneeId, dueDate and position (0-based; the end when left out).
  • PATCH /checklist/{itemId} changes any of title, done, assigneeId (null unassigns), dueDate (null clears) and position (the item moves there and the others make room). Only what differs is changed; a request that changes nothing sends no webhook.
  • DELETE /checklist/{itemId} deletes the item (204, not kept in the trash).

Assignees must be active members of the board (422 otherwise) and are notified, unless they assign themselves. Ticking an item is recorded in the card history. Every change shows up live on open boards and sends card.updated with checklist in changes.

Attachments

GET /cards/{cardId}/attachments returns { "data": [ ... ] } with a card's files, oldest first; GET /attachments/{attachmentId} returns one.

{
  "id": "cm...",
  "cardId": "cm...",
  "fileName": "screen.png",
  "mimeType": "image/png",
  "size": 48213,
  "width": 1280,
  "height": 800,
  "uploader": { "id": "cm...", "username": "marta", "displayName": "Marta Nowak" },
  "createdAt": "2026-12-01T10:00:00.000Z",
  "downloadUrl": "/api/v1/attachments/cm.../content",
  "thumbnailUrl": "/api/v1/attachments/cm.../content?thumb=1"
}
  • Upload with POST /cards/{cardId}/attachments and a multipart/form-data body that has the file in a field named file. The limit is ATTACHMENT_MAX_MB (default 10 MB) instead of the 1 MB JSON limit; a larger file answers 413. Files go where the app puts them (next to the database, or the S3 bucket when ATTACHMENTS_S3_BUCKET is set), PNG, JPEG and WebP images wider than 480 pixels get the same WebP thumbnail, and image types are taken from the bytes (a file that only claims to be an image is stored as application/octet-stream). If the storage can not be reached the API answers 503 with storage_unavailable and nothing is saved.
  • Download with GET /attachments/{attachmentId}/content (the downloadUrl): the original bytes, as a download with the original file name. HTML, SVG, XML, JavaScript and PDF are sent as application/octet-stream. ?thumb=1 (the thumbnailUrl, set for large images) gives the WebP thumbnail, or the original until it exists. Both need the bearer token, like every other path.
  • Delete with DELETE /attachments/{attachmentId} (204): the uploader, a board owner or an admin can, like in the card panel. The file and its thumbnail are removed from storage.

Anyone who can open the card can list, download and upload. Uploads and deletions are recorded in the card history, show up live and send card.updated with attachments in changes.

GET /search?q=... searches cards the way the command palette does: titles, descriptions and comments in the full-text index (SQLite FTS5 or PostgreSQL text search), accent-insensitive (lodz finds "Łódź"), every word required and matched as the start of a word. Only boards the user can open are searched (every board for admins); archived boards are left out, archived cards are found and marked archived. The best match comes first, a title match above a description or comment match. The result is a page (limit, cursor, see Pagination):

{
  "data": [
    {
      "id": "cm...",
      "boardId": "cm...",
      "boardName": "Website relaunch",
      "columnId": "cm...",
      "columnName": "In progress",
      "title": "Responsive navigation",
      "archived": false,
      "snippet": "…collapse the navigation into a menu on phones…",
      "highlights": [{ "start": 14, "end": 24 }]
    }
  ],
  "next": null
}

snippet is plain text around the match in the description or a comment (null when only the title matched), and highlights are the matched words in it as [start, end) offsets in UTF-16 code units (what JavaScript's slice uses). A missing or blank q, or one over 200 characters, answers 422; a q with no letters or digits gives an empty page. To find boards by name, filter GET /boards.

Automation rules

GET /boards/{boardId}/automations returns { "data": [ ... ] } with every rule of the board, oldest first (the order they run in). Every board member can read them; board owners and admins can also write them, here or in board settings.

{
  "id": "cm...",
  "boardId": "cm...",
  "name": "Done cleanup",
  "trigger": "cardEntersColumn",
  "columnId": "cm...",
  "actions": [{ "type": "completeChecklist" }, { "type": "removeTag", "tagId": "cm..." }],
  "enabled": true,
  "createdAt": "2026-11-19T10:00:00.000Z",
  "updatedAt": "2026-11-19T10:00:00.000Z"
}

trigger is cardEntersColumn (with columnId) or deadlinePassed (columnId is null). Actions: assign (userIds), unassignAll, addTag and removeTag (tagId), setPriority (priority), setDeadline (days: today, in UTC, plus that many days), clearDeadline and completeChecklist for column rules; moveToColumn (columnId) and addTag for deadline rules.

Writing rules needs a Read and write token and a board owner or an admin (403 forbidden for other members):

  • POST /boards/{boardId}/automations adds a rule. The body is the shape above without id, boardId, createdAt and updatedAt: name (1 to 80 characters), trigger, columnId (for cardEntersColumn), actions (1 to 10, only the trigger's own types) and enabled (default true). A board can have 50 rules; the 51st answers 409 limit_reached.
  • PATCH /automations/{ruleId} changes any of those fields; send {"enabled": false} to switch a rule off. The rule after the change must be valid as a whole, so switching trigger usually needs new actions too. actions replaces the whole list.
  • DELETE /automations/{ruleId} deletes it (204).

An unknown trigger or action, an action that does not fit the trigger, or a missing columnId answers 422 validation_failed with the problems in details. Columns, tags and people the rule names must be on the board (people as active members); otherwise the answer is 422 with details listing what is missing, as { "columnIds": [...], "tagIds": [...], "userIds": [...] }. Every write is recorded in the audit log as automation.create, automation.update or automation.delete, the same as from board settings, with via: "api" and the token id in the details.

Tags

GET /boards/{boardId}/tags lists a board's tags in their order. POST /boards/{boardId}/tags creates one at the end, with name (1 to 40 characters) and color (#rrggbb, the # is optional): board owners and admins, like in board settings. Names are unique per board, ignoring case: a name that is already there answers 409 tag_exists with the existing tag's id in details.tagId, so a script can reuse it. Put tags on cards with PATCH /cards/{cardId} and tagIds.

Examples

List boards and read one with its columns:

curl -H "Authorization: Bearer $TOKEN" "$KANBUN/api/v1/boards"
curl -H "Authorization: Bearer $TOKEN" "$KANBUN/api/v1/boards/BOARD_ID"

Create a card at the top of a column:

curl -X POST "$KANBUN/api/v1/boards/BOARD_ID/cards" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"columnId":"COLUMN_ID","title":"Renew the certificate","priority":"high","deadline":"2026-12-31","position":0}'

Move it to another column and assign it (assigneeIds and tagIds replace the whole set):

curl -X PATCH "$KANBUN/api/v1/cards/CARD_ID" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"columnId":"DONE_COLUMN_ID","assigneeIds":["USER_ID"]}'

Archive it, list the board's archived cards, and restore it:

curl -X PATCH "$KANBUN/api/v1/cards/CARD_ID" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"archived":true}'
curl -H "Authorization: Bearer $TOKEN" "$KANBUN/api/v1/boards/BOARD_ID/cards?archived=true"
curl -X PATCH "$KANBUN/api/v1/cards/CARD_ID" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"archived":false}'

Create a tag, or reuse the one already there:

curl -X POST "$KANBUN/api/v1/boards/BOARD_ID/tags" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"Bug","color":"#dc2626"}'
# 201 with the tag, or 409 {"error":{"code":"tag_exists","details":{"tagId":"cm..."}}}

Add a checklist item, then tick it:

curl -X POST "$KANBUN/api/v1/cards/CARD_ID/checklist" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"title":"Update the DNS records","dueDate":"2026-12-20"}'
curl -X PATCH "$KANBUN/api/v1/checklist/ITEM_ID" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"done":true}'

Upload a file to a card and download it again (curl -F sends multipart/form-data):

curl -X POST "$KANBUN/api/v1/cards/CARD_ID/attachments" \
  -H "Authorization: Bearer $TOKEN" -F "file=@screenshot.png"
curl -H "Authorization: Bearer $TOKEN" -o screenshot.png "$KANBUN/api/v1/attachments/ATTACHMENT_ID/content"

Search every board you can open:

curl -G -H "Authorization: Bearer $TOKEN" "$KANBUN/api/v1/search" --data-urlencode "q=certificate renew"

Add an automation rule that tidies up cards moved to Done:

curl -X POST "$KANBUN/api/v1/boards/BOARD_ID/automations" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"Done cleanup","trigger":"cardEntersColumn","columnId":"DONE_COLUMN_ID","actions":[{"type":"completeChecklist"},{"type":"removeTag","tagId":"TAG_ID"}]}'

Cards changed in the last hour that are tagged "Bug":

curl -G -H "Authorization: Bearer $TOKEN" "$KANBUN/api/v1/boards/BOARD_ID/cards" \
  --data-urlencode "tag=Bug" --data-urlencode "updatedSince=2026-11-18T09:00:00Z"

Comment on a card (@username mentions notify people):

curl -X POST "$KANBUN/api/v1/cards/CARD_ID/comments" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"body":"Deployed to staging."}'

To retry a comment safely (for example after a timeout), send an Idempotency-Key header with a key you chose for that comment, such as a UUID (1 to 100 letters, digits or _ . : -). The first request answers 201; a repeat with the same key on the same card answers 200 with the same comment and notifies nobody again. A key another user already used on that card answers 409.

curl -X POST "$KANBUN/api/v1/cards/CARD_ID/comments" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a0e-8f8a-4c55-9a43-0d6f3c1b7e21" \
  -d '{"body":"Deployed to staging."}'

Deadlines are calendar dates: send and receive YYYY-MM-DD (an ISO date-time is accepted and its UTC date used). null clears a field. Card position 0 is the top of the column; moving to another column without a position puts the card at the end.

Pagination

List endpoints that can grow return a page:

{ "data": [ ... ], "next": "bzo1MA" }

limit sets the page size (1 to 100, default 50). Pass next as cursor to get the following page; next is null on the last page. Treat the cursor as opaque.

curl -H "Authorization: Bearer $TOKEN" "$KANBUN/api/v1/boards/BOARD_ID/cards?limit=100&cursor=bzo1MA"

Columns, tags, checklist items, attachments and automation rules are returned in one piece as { "data": [ ... ] }. GET /search is paginated.

Errors

Every error has the same shape and a matching HTTP status:

{ "error": { "code": "validation_failed", "message": "The request body or query is not valid.", "details": [{ "path": "title", "message": "Too small: expected string to have >=1 characters" }] } }
Status code When
400 bad_request The body is not a JSON object, or an upload has no file field
400 invalid_idempotency_key The Idempotency-Key header is malformed
401 unauthorized Missing, malformed, unknown, expired or revoked token, or a deactivated user
403 forbidden No access to the board, or an owner-only action
403 insufficient_scope A read-only token tried to change something
404 not_found No such board, column, card, checklist item, attachment, rule or endpoint
409 card_archived Moving an archived card without restoring it
409 idempotency_key_conflict Another user already used this Idempotency-Key on this card
409 tag_exists The board already has a tag with this name; details.tagId is its id
409 limit_reached The board already has 50 automation rules
413 payload_too_large JSON body over 1 MB, or an uploaded file over ATTACHMENT_MAX_MB
415 unsupported_media_type Body not sent as application/json (or multipart/form-data for uploads)
422 validation_failed Invalid input; details lists the fields
429 rate_limited Too many requests, see below
500 internal_error A bug; the server log has the details
503 storage_unavailable The attachment storage (disk or S3) could not store the file; nothing was saved

Rate limits

Each token may make API_RATE_LIMIT requests per minute (default 120). Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix seconds). Over the limit the API answers 429 with a Retry-After header in seconds. Repeated failed authentications from one IP address are limited too (60 per minute).

The limiter is in memory, per process, like the rest of Kanbun's single-process design (src/lib/limiter.ts; another store can be plugged in with setLimiter()).

Webhooks

Board owners and admins add webhooks in the board's Settings, section Webhooks: a payload URL and the events to send. Kanbun shows the signing secret once, when the webhook is added.

Events:

Event When
card.created A card is created (in the board, from a template, from a checklist item, by a schedule or through the API)
card.updated Title, description, priority, deadline, assignees, tags or the position within its column change, a checklist item is added, changed, ticked, moved or deleted (also when an automation rule marks the checklist done), or a file is attached or removed; changes lists which (title, description, priority, deadline, assignees, tags, position, checklist, attachments)
card.moved A card is moved to another column; from and to name the columns. Reordering within a column is a card.updated with position in changes
card.deleted A card is moved to the trash, on its own or with its column. When its column was deleted, the payload has reason: "column.deleted" and column (columnId, columnName); one event is sent per card
card.archived A card is archived, by someone (actor) or by the board's auto-archive (actor null, reason: "autoArchive" and days)
card.unarchived An archived card is restored to its column
comment.created Someone comments on a card; the payload has comment
ping The Send test button

Changes made by an automation rule send the same events as a person's change, with automation in the payload: { "ruleId": "cm...", "ruleName": "Done cleanup", "runId": "cm..." }. actor is the person whose action set the rule off, or null for deadline rules (run by the server). A rule's changes come as their own card.updated (and card.moved, for a deadline rule's move) after the event of the action that set them off.

Each delivery is a POST with a JSON body:

{
  "event": "card.moved",
  "id": "0b6f4a8e-1c1f-4a3a-9d0e-5e3f1d2c7a10",
  "deliveredAt": "2026-11-18T10:15:00.000Z",
  "board": { "id": "cm...", "name": "Website relaunch" },
  "card": { "id": "cm...", "boardId": "cm...", "columnId": "cm...", "title": "Responsive navigation", "position": 0, "priority": "high", "deadline": null, "assignees": [], "tags": [], "...": "..." },
  "actor": { "id": "cm...", "username": "marta", "displayName": "Marta Nowak" },
  "from": { "columnId": "cm...", "columnName": "In progress" },
  "to": { "columnId": "cm...", "columnName": "Done" }
}

and these headers:

  • X-Kanbun-Event: the event name
  • X-Kanbun-Delivery: a unique id per delivery (also id in the body), useful to drop duplicates
  • X-Kanbun-Signature: sha256= and the hex HMAC-SHA256 of the raw body, keyed with the signing secret
  • User-Agent: Kanbun-Webhook/1.0

Verifying the signature

Compute the HMAC over the raw request body (before parsing JSON) and compare in constant time. Node.js with Express:

import crypto from "node:crypto";
import express from "express";

const SECRET = process.env.KANBUN_WEBHOOK_SECRET; // whsec_...
const app = express();

app.post("/hooks/kanbun", express.raw({ type: "application/json" }), (req, res) => {
  const expected = "sha256=" + crypto.createHmac("sha256", SECRET).update(req.body).digest("hex");
  const given = req.get("X-Kanbun-Signature") ?? "";
  const ok = given.length === expected.length && crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
  if (!ok) return res.status(401).end();

  const event = JSON.parse(req.body.toString("utf8"));
  console.log(event.event, event.card?.title);
  res.status(204).end();
});

app.listen(3000);

Delivery, retries and failures

  • Every delivery is stored in the database before it is sent (an outbox), then sent in the background, so a slow receiver never slows down the person making the change and a restart loses nothing: deliveries still waiting are sent when the server is back. With several instances, any instance can send a waiting delivery; each attempt is claimed in the database first, so only one instance sends it.
  • Delivery is at least once. If the server stops after the receiver got the request but before the answer was recorded, the attempt is made again about a minute later. Use X-Kanbun-Delivery (or id in the body), which stays the same on every attempt, to drop duplicates. Deliveries are not guaranteed to arrive in order; sort by deliveredAt if order matters.
  • Each attempt times out after 10 seconds. A 2xx response counts as delivered; redirects are not followed. Failed attempts are retried, 3 attempts in total: the second about 5 seconds after the first, the third about 30 seconds after the second. 4xx answers other than 408 and 429 are not retried. The Send test ping is tried once.
  • After 10 failed deliveries in a row the webhook is switched off. Turn it back on in board settings once the receiver is fixed.
  • Board settings list the last 20 finished deliveries per webhook, and any still waiting, with the result, status code, duration and attempts.
  • Adding and deleting webhooks is recorded in the audit log (webhook.create, webhook.delete), and so are adding, changing (including switching on or off) and deleting automation rules (automation.create, automation.update, automation.delete), from board settings or the API.

Allowed addresses

Webhook URLs must be http or https, without user name or password. By default Kanbun refuses to deliver to loopback, private, link-local (including cloud metadata at 169.254.169.254), carrier-grade NAT, multicast and other reserved addresses, for IPv4 and IPv6. Host names are resolved at delivery time and every address is checked inside the connection, so DNS tricks can not slip past the check.

To post to receivers on your own network (a self-hosted automation server, for example), set WEBHOOK_ALLOW_PRIVATE=1 in the environment. Only do this if you trust every board owner on the instance, since they could then make the server send requests to internal services.