Base URL
/api/kiwi/. Health, metrics, OpenAPI, raw files, llms.txt, and MCP sit at the server root.
Selecting a space
A server can host several spaces. Pick one in either of two ways:X-Kiwi-Space returns 404 instead of falling back to another space. Requests with neither go to the primary space. Space administration (/api/spaces) is covered in Spaces admin.
Authentication
Set the mode with[auth] type in .kiwi/config.toml. Every mode except none expects an Authorization: Bearer <token> header on /api/kiwi/* requests.
- none (default)
- apikey
- perspace
- oidc
No credentials. Use this for local development and trusted networks.
SIGHUP to the server process to reload [auth] from disk without a restart. See Auth tokens for key management.
What auth covers
Request headers
Optimistic concurrency
Every file read returns anETag header: the quoted git blob hash of the content. Writes return the new ETag in both the ETag header and the JSON etag field.
Send that value back in If-Match to make a write conditional. If someone else changed the file since your read, the write is rejected with 409 and nothing is written.
409 Conflict
If-Match works on PUT /file, PATCH /file, and PATCH /file/frontmatter. For POST /bulk, set if_match per file; one mismatch fails the whole batch. Quotes around the ETag are optional.
Errors
Errors return a JSON body with a singleerror field. Server-side failures (5xx) return a generic message; details go to the server log.
Pagination
There is no global pagination envelope. Endpoints that return long lists take their own parameters:Rate limiting
Rate limiting is off unless you setrequests_per_minute above zero:
.kiwi/config.toml
/health, /healthz, /readyz, and /metrics are never limited. Over the limit, requests get 429 with Retry-After: 60.
Health and metrics
Use these unauthenticated endpoints for container probes and monitoring.GET /health always returns {"status": "ok"}. GET /healthz adds uptime and version:
GET /readyz checks storage and any enabled protocol servers (NFS, S3, WebDAV). It returns 200 with status: "ready", or 503 with status set to storage-unreachable or protocol-unhealthy.
503 Service Unavailable
GET /metrics returns Prometheus text with kiwi_build_info, kiwi_uptime_seconds, kiwi_sse_subscribers, and kiwi_janitor_issues (after the first janitor scan). It does not export per-request counters; collect those at your proxy.
Machine-readable references
Next steps
Files
Read, write, rename, and upload.
Search
Full-text, hybrid, and semantic search.
Versioning
History, diff, blame, and the change feed.
Metadata and graph
DQL queries and the link graph.
Drafts
Staging branches for agents.
Utilities
Lint, timeline, rules, audit.