Space visibility is separate: it opens read endpoints for the whole space. See Publishing for when to use each.
Publish a page
Setpublished: true in the page’s frontmatter, and published_at if the page has never been published.
string
Git commit author attribution.
string
required
Page path.
404 if the page does not exist and 409 if it changed during the request.
string
Page path.
boolean
Always
true.string
First publish time (RFC 3339). Republishing keeps the original value.
string
Relative URL of the published page.
Unpublish a page
Setpublished: false. The published_at field stays for history.
string
Git commit author attribution.
string
required
Page path.
404 if the page does not exist and 409 if it changed during the request.
Bulk publish or unpublish
Publish or unpublish many pages in a single git commit. Both endpoints take the same body and return the same shape.string
Git commit author attribution.
string[]
required
Page paths. Duplicates are ignored, and a leading
/ is stripped.400 if paths is empty or contains an empty string. Pages that are missing or fail to update are reported in errors rather than failing the whole request.
boolean
true for publish, false for unpublish.integer
Number of paths in the request.
integer
Pages whose frontmatter changed.
integer
Unique paths that needed no change or failed.
object[]
One entry per page that is now in the requested state, with
path, published, published_at, and public_url as in Publish a page.object[]
Pages that could not be updated, each with
path and error. Omitted when empty.Get publish status
Return whether one page is published.string
required
Page path.
404 if the page does not exist.
string
Page path.
boolean
Whether the page is published.
string
First publish time, if the page was ever published.
string
Relative public URL. Only present while published.
integer
Views of the published page since the server started counting.
0 when view tracking is off.List published pages
Return every published markdown page, newest first.integer
Number of published pages.
object[]
Published pages, sorted by
published_at descending.Read a published page
Render a published orvisibility: public page. This route sits outside /api/kiwi and never requires authentication.
string
required
Page path.
.md is appended if the path has no extension.string
default:"text/html"
text/html for a themed reader page, text/markdown for the raw file, or application/json for frontmatter plus rendered HTML.404 for pages that aren’t published or public, so private pages don’t leak their existence, and 406 for an Accept header with no supported type. Images and other non-markdown files are served when a markdown page in the same folder or a parent folder is published or public. Responses carry Cache-Control: public, max-age=60.
With Accept: application/json:
object
Page frontmatter.
string
Rendered body HTML, with heading IDs.
string
Page body without frontmatter.
Read public files
Fetch one public or published file without authentication. Use this when you want raw bytes instead of the rendered reader page.string
required
File path.
400 for a missing or escaping path and 404 for files that aren’t public. Non-markdown files follow the same folder rule as /p/.
Browse the public tree
Return the directory tree, filtered to public and published pages.string
default:"/"
Folder to start from.
string
Set to
published to include only published pages and skip visibility: public pages.404 if path does not exist.
Create a share link
Create a token that grants read access to one file, with an optional expiry and password. The page does not need to be published.string
Recorded as
createdBy.string
required
File path. Returns
404 if it does not exist.string
Go duration such as
168h. Omit for a link that never expires.string
Password readers must supply. Stored as a bcrypt hash and never returned.
400 for an invalid expiresIn and 501 if share links are disabled on this server.
string
Link ID, used to revoke it.
string
Shared file path.
string
Secret token for the public URL.
string
Expiry time (RFC 3339). A zero time (
0001-01-01T00:00:00Z) means no expiry.string
Actor that created the link.
string
Creation time.
integer
Times the link has been opened.
List share links
Return the share links for one file.string
required
File path.
501 if share links are disabled.
Revoke a share link
Delete a share link by itsid (not its token).
string
required
Link ID.
404 if the link does not exist.
Open a share link
Return the raw shared file. This route needs no API key.string
required
Share token.
string
Password for a protected link.
Alternative to the
password query parameter.401 with a WWW-Authenticate header when the password is missing or wrong, and 404 when the token is unknown or expired.
Get space visibility
Return the current space’s visibility and root directory.string
private, unlisted, or public. Defaults to private.string
Absolute path of the knowledge root on the server.
Set space visibility
Change who can read the space without an API key. The value is saved to[space] visibility in .kiwi/config.toml and applies immediately.
string
required
private: every request needs auth (when auth is configured).unlisted:GETrequests to/file,/peek, and/sectionwith apathare open; listing, tree, and search still need auth.public: everyGETandHEADrequest under/api/kiwiis open.
400 for any other value.
Related
Publishing concepts
When to publish, share, or open a space.
Web UI
The publish toggle in the page header.