Skip to main content

Directory tree

Retrieve the directory tree as a JSON array.
string
default:"/"
Root path to list. Omit to list the entire knowledge base.
array
Array of tree nodes.
string
Full path relative to root.
string
File or directory name.
boolean
Whether this node is a directory.
integer
File size in bytes (0 for directories).
array
Nested tree nodes (directories only).

Read a file

Retrieve raw markdown content. The response includes an ETag header containing the git blob SHA for optimistic locking.
string
required
File path relative to the knowledge root.
When a path in the knowledge root is a symbolic link, resolve its target without following into arbitrary filesystem paths outside the guard:
Returns plain text body with the symlink target. 404 when the path does not exist; 400 when the path exists but is not a symlink.

Write a file

Create or update a file. The request body is raw markdown. KiwiFS creates a git commit for each write.
string
required
File path relative to the knowledge root.
string
Git commit author attribution (e.g. agent:my-agent).
string
Lineage tracking (e.g. run:run-249).
string
ETag from a previous read. If the file has changed since your read, the server returns 409 Conflict.
If you pass If-Match and the file has been modified since your read, the server returns 409 Conflict with an error message. Fetch the latest version, merge your changes, and retry.

Delete a file

Delete a file and create a git commit recording the deletion.
string
required
File path to delete.

Bulk write

Write multiple files in a single git commit. This is more efficient than individual writes and keeps your git history clean.
string
Git commit author attribution.
Use bulk writes when importing data or making batch updates. All files are committed atomically in a single git commit.

Upload assets

Upload binary files (images, PDFs, etc.) as multipart form data.
The response returns the asset path you can reference in markdown:

Table of contents

Get the heading outline for a file.
string
required
File path to extract headings from.

Append to a file

Append content to an existing file without reading it first.
string
required
File path to append to.
string
default:"\\n"
String inserted between existing content and new content.
Append is useful for agent logs, episodic memory, and audit trails where you want to add content without read-modify-write cycles.

Rename a file

Rename or move a file. Wiki links pointing to the old path are automatically updated.
string
required
Old file path.
string
required
New file path.
Rewrite wiki links in other files that point to the old path.

Rename a directory

Move an entire directory and update all internal links.
string
required
Old directory path.
string
required
New directory path.

Templates

List and read page templates stored in .kiwi/templates/.

List templates

Read a template

Resolve [[wiki-links]] to their canonical file paths and permalinks.
Last modified on May 14, 2026