API
API overview
Base URL, IDs, every main endpoint, the response format and errors.
Every example in the API docs comes in cURL, Node.js, Go and Python. Pick a language once and every page remembers it. Kanesh has no SDK to install: the examples use plain HTTP.
Before you start
- Run Kanesh with Getting started and create a collection in Studio.
- Node.js examples need Node 18 or newer. Save them as
.mjssoawaitworks at the top level. - Python examples use
requests:pip install requests. - Go examples use only the standard library.
Base URL and IDs
A local install serves the API at http://127.0.0.1:8080. API paths start with /api/v1. Use HTTPS when Kanesh runs outside your machine.
Paths use IDs, not names. :workspace is a workspace ID and :collection is a collection ID. Get both from Workspaces and collections, or copy them from Studio.
Endpoints
| Method | Path | What it does |
|---|---|---|
POST | /api/v1/auth/login | Sign in and get a token |
GET | /api/v1/auth/me | The signed-in user |
POST | /api/v1/auth/logout | Revoke the token you send |
GET | /api/v1/workspaces | Workspaces you can access |
GET | /api/v1/workspaces/:workspace/collections | Collections and their fields |
GET | /api/v1/workspaces/:workspace/collections/:collection/records | List and query records |
GET | /api/v1/workspaces/:workspace/collections/:collection/records/:record | Get one record |
POST | /api/v1/workspaces/:workspace/collections/:collection/records | Create a record |
PATCH | /api/v1/workspaces/:workspace/collections/:collection/records/:record | Update fields of a record |
DELETE | /api/v1/workspaces/:workspace/collections/:collection/records/:record | Delete a record |
POST | /api/v1/workspaces/:workspace/graphql | GraphQL for the workspace |
GET | /health/live | Liveness check, no sign-in |
Import, export, files, members and roles have more endpoints. Studio’s API reference lists all of them for your workspace.
Response format
A successful response puts the result in data. List responses add pagination to meta:
{
"data": [{ "title": "Cloud migration" }],
"meta": {
"request_id": "ZILI2GCARTZPNVR6JBAWQV2VMZ",
"response_time": 1.78,
"pagination": { "limit": 50, "offset": 0, "count": 7, "has_more": false }
}
} An error puts a code and a message in error:
{
"error": { "code": "not_found", "message": "The requested resource is unavailable." },
"meta": { "request_id": "L7DIIN4JO5XT4WPN2JQC7YCYBI", "response_time": 0.36 }
} response_timeis in milliseconds.request_idmatches the server log and theX-Request-IDheader. Include it when you report a problem.- A delete returns 204 with no body.
Errors
The most common are 400 invalid_input, 401 authentication_required, 403 access_denied and 404 not_found. See Errors for every code, its message and what to do.
OpenAPI
Studio’s API reference exports an OpenAPI 3.1 document for your workspace. It only includes what your account may access, so you can generate a typed client with any OpenAPI tool.