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.
| Method | Path | Purpose |
|---|---|---|
GET | /api/board | Read the columns and tasks. |
POST | /api/update | Change one task’s status, order, tags, or body. |
POST | /api/drop | Move a task relative to a visible neighbour. |
GET | /api/events | Server-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}}| Field | Meaning |
|---|---|
columns | Column names from .kanban.yml, in display order. |
tasks[].file | The task’s file name, including .md. |
tasks[].status, project, epic | The frontmatter values. Empty strings when not set. |
tasks[].tags | The frontmatter tags. null when not set. |
tasks[].order | Present only when the task has an order value. |
tasks[].dependsOn | Present only when the task has dependencies. |
tasks[].title | The card title, which is the file name without .md. |
tasks[].heading | The first Markdown H1 outside fenced code blocks. Present only when the body has one. |
tasks[].content | The Markdown body, without the frontmatter. For a CONFLICT task, the whole raw file. |
tasks[].hash | SHA-256 hash of the raw task file, encoded as hex. |
tasks[].dependencies | Dependency slugs mapped to active, archived, or missing. Present when there are dependencies. |
tasks[].cycle | True when the task belongs to a dependency cycle. Omitted otherwise. |
tasks[].parseError | Present only when the frontmatter could not be parsed. |
docsDir | The absolute path of the task folder. |
archived | An 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.
curl -X POST http://127.0.0.1:8080/api/update \ -H 'Content-Type: application/json' \ -d '{"file": "write-install-notes.md", "status": "DONE"}'| Field | Required | Meaning |
|---|---|---|
expectedHash | No | The task hash from GET /api/board. When supplied, the file must still match. |
file | Yes | The task’s file name, such as write-install-notes.md. Paths are not accepted. |
status | No | New status. Omit it, or send an empty string, to leave it unchanged. |
order | No | New order value, as a number. Omit it to leave it unchanged. |
tags | No | New tag list. Omit it to leave the tags unchanged. An empty array removes all tags. |
content | No | New 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.
| Status | When |
|---|---|
200 OK | The file was updated. |
400 Bad Request | The body is not valid JSON, file is missing or invalid, the status is CONFLICT or OTHER, or no field was sent. |
403 Forbidden | Host or Origin did not match the served address. |
405 Method Not Allowed | A write request used another HTTP method. |
409 Conflict | The file changed since expectedHash, contains Git conflict markers, or triggered the empty-file guard. |
413 Content Too Large | The request body exceeded 1 MiB. |
415 Unsupported Media Type | The request did not use application/json. |
500 Internal Server Error | Any 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: updateClients 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.