Skip to content

HTTP API

HTTP API

The web board is a single page that talks to mk over a small JSON API. You can use the same endpoints from scripts. They serve the port that mk prints when it starts, usually http://127.0.0.1:8080. Use the printed host and port. If sending an Origin header, use the same origin as the request URL.

These endpoints have no authentication. See Network access before you expose the port.

MethodPathPurpose
GET/api/boardRead the columns and tasks.
POST/api/updateChange one task’s status, order, tags, or body.
POST/api/dropMove a task relative to a visible neighbour.
GET/api/eventsServer-Sent Events stream of changes.
GET/The web board page.

Read the board

GET /api/board returns the current state. The response is built from a snapshot of the task folder.

{
"columns": ["TODO", "IN PROGRESS", "DONE"],
"tasks": [
{
"file": "write-install-notes.md",
"status": "TODO",
"project": "MK",
"epic": "SETUP",
"order": 1,
"tags": ["docs"],
"dependsOn": ["design-task"],
"title": "write-install-notes",
"heading": "Write install notes",
"content": "# Write install notes\n\nAdd the install steps...",
"hash": "5c71b6416ea0eec842b20204ad70d11ee6e3fc5455f28fc3bf80513f583aacd7",
"dependencies": {"design-task": "active"}
}
],
"docsDir": "/home/you/project/docs",
"archived": {"old-task.md": true}
}
FieldMeaning
columnsColumn names from .kanban.yml, in display order.
tasks[].fileThe task’s file name, including .md.
tasks[].status, project, epicThe frontmatter values. Empty strings when not set.
tasks[].tagsThe frontmatter tags. null when not set.
tasks[].orderPresent only when the task has an order value.
tasks[].dependsOnPresent only when the task has dependencies.
tasks[].titleThe card title, which is the file name without .md.
tasks[].headingThe first Markdown H1 outside fenced code blocks. Present only when the body has one.
tasks[].contentThe Markdown body, without the frontmatter. For a CONFLICT task, the whole raw file.
tasks[].hashSHA-256 hash of the raw task file, encoded as hex.
tasks[].dependenciesDependency slugs mapped to active, archived, or missing. Present when there are dependencies.
tasks[].cycleTrue when the task belongs to a dependency cycle. Omitted otherwise.
tasks[].parseErrorPresent only when the frontmatter could not be parsed.
docsDirThe absolute path of the task folder.
archivedAn object whose keys are the .md file names directly in the archive folder (archive_dir, default archive), each set to true. Empty when nothing is archived, and null when the archive folder cannot be read.

A file that contains Git conflict markers has status set to CONFLICT. See Special cards.

Update a task

POST /api/update changes one task file. Write requests require Content-Type: application/json and accept up to 1 MiB of JSON.

Terminal window
curl -X POST http://127.0.0.1:8080/api/update \
-H 'Content-Type: application/json' \
-d '{"file": "write-install-notes.md", "status": "DONE"}'
FieldRequiredMeaning
expectedHashNoThe task hash from GET /api/board. When supplied, the file must still match.
fileYesThe task’s file name, such as write-install-notes.md. Paths are not accepted.
statusNoNew status. Omit it, or send an empty string, to leave it unchanged.
orderNoNew order value, as a number. Omit it to leave it unchanged.
tagsNoNew tag list. Omit it to leave the tags unchanged. An empty array removes all tags.
contentNoNew Markdown body. Omit it to leave the body unchanged. An empty string empties the body.

Send at least one of status, order, tags, or content. The request updates only the fields you send, and it keeps the rest of the frontmatter.

CONFLICT and OTHER are reserved status values.

On success, the response is 200 OK with no body. The ETag header contains the new quoted hex hash for use in subsequent guarded saves. Errors are plain text.

StatusWhen
200 OKThe file was updated.
400 Bad RequestThe body is not valid JSON, file is missing or invalid, the status is CONFLICT or OTHER, or no field was sent.
403 ForbiddenHost or Origin did not match the served address.
405 Method Not AllowedA write request used another HTTP method.
409 ConflictThe file changed since expectedHash, contains Git conflict markers, or triggered the empty-file guard.
413 Content Too LargeThe request body exceeded 1 MiB.
415 Unsupported Media TypeThe request did not use application/json.
500 Internal Server ErrorAny other failure, such as a file with invalid frontmatter.

The next GET /api/board shows a successful update immediately.

Move a task

POST /api/drop takes the moving file and the target column’s status. Send beforeFile to drop above a visible card, or lastVisibleFile to drop after the last visible card. Omit both when the destination has no visible cards. You can also send the moving file’s expectedHash.

MK resolves the order against the entire destination column, including hidden cards. A drop after an unordered card can assign order values to other cards in the column in the same batch. A stale moving file or neighbour returns 409.

Live updates

GET /api/events opens a Server-Sent Events stream. When a task file or .kanban.yml changes, the server sends:

data: update

Clients respond by fetching /api/board again. Several changes in quick succession can produce one message, so treat the message as “something changed” and not as a list of changes.

Fields the API does not accept

The store has more write options than the API exposes. The API does not accept the TUI-only fields for removing keys or for undo. Those are described in Board store.