Client HTTP API Reference
These are the local HTTP endpoints exposed by the Electron desktop app.
All endpoints except GET /api/health require Authorization: Bearer <local-api-token>.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/health | No | Lightweight health probe for the local API server. |
| GET | /api/info | Yes | Returns app version, current local API port, and basic local DB counts. |
| GET | /api/heaps | Yes | Lists local workspaces ordered by last activity. |
| GET | /api/heaps/:id | Yes | Returns one local workspace by ID. |
| GET | /api/heaps/:id/blocks | Yes | Lists blocks in a workspace, with optional type filter, paging, and local FTS query. |
| GET | /api/blocks/:id | Yes | Returns a single block plus local relations, backlinks, files, thumbnails, apps, and attributes. |
| GET | /api/search | Yes | Runs local full-text search across blocks, optionally scoped to one heap. |
| POST | /api/query | Yes | Executes a read-only SQL query against the local database. |
| POST | /api/blocks | Yes | Creates a new block in the local app through the Rust block creation path. |
| GET | /api/tags | Yes | Lists tag blocks used in a heap. |
GET /api/health
- Authentication: No
- Purpose: Lightweight health probe for the local API server.
Response:
- Returns
{ "status": "ok" }when the local API process is responding.
GET /api/info
- Authentication: Yes
- Purpose: Returns app version, current local API port, and basic local DB counts.
Response:
- Includes
version,port,blocks,workspaces, andfiles.
GET /api/heaps
- Authentication: Yes
- Purpose: Lists local workspaces ordered by last activity.
Response:
- Returns an array of workspace rows with
id,block_id,title,icon,type, and timestamps.
GET /api/heaps/:id
- Authentication: Yes
- Purpose: Returns one local workspace by ID.
Response:
- Returns the matching workspace row.
- Returns
404if the workspace does not exist.
GET /api/heaps/:id/blocks
- Authentication: Yes
- Purpose: Lists blocks in a workspace, with optional type filter, paging, and local FTS query.
Query parameters:
type: optional block type filter.limit: max rows, capped at 500 by the implementation.offset: pagination offset.q: optional full-text prefix search term within the heap.
Response:
- Returns
{ blocks, total, limit, offset }.
GET /api/blocks/:id
- Authentication: Yes
- Purpose: Returns a single block plus local relations, backlinks, files, thumbnails, apps, and attributes.
Response:
- Includes block fields such as
id,title,text,type,workspace_id, timestamps,relations,backlinks,files,apps,available_views,global_filters, andattributes. relationsandbacklinksnow include display-oriented fields likedisplay_title,text_excerpt, andfile_name, plus pagination metadata inrelations_paginationandbacklinks_pagination.- Query params:
limit,offset, and optionalview=<view-id-or-name>to embed paginated filtered view results.
GET /api/blocks/:id/views/:viewId
- Authentication: Yes
- Purpose: Returns paginated block results for one saved app view using that view's filter and heap-filter settings.
- Query params:
limit,offset. - Response:
{ view, items, total, limit, offset, global_filters }.
GET /api/search
- Authentication: Yes
- Purpose: Runs local full-text search across blocks, optionally scoped to one heap.
Query parameters:
q: required search term.heap: optional workspace filter.limit: max rows, capped at 500.offset: pagination offset.
Response:
- Returns
{ results, total, limit, offset }.
POST /api/query
- Authentication: Yes
- Purpose: Executes a read-only SQL query against the local database.
Request body:
sql: required SQL string. OnlySELECTstatements are accepted.params: optional positional parameter array.
Response:
- Returns
{ rows }.
Notes:
- Non-
SELECTstatements are rejected with403.
POST /api/blocks
- Authentication: Yes
- Purpose: Creates a new block in the local app through the Rust block creation path.
Request body:
workspace_id: required destination workspace.title: optional block title.content: optional text content.relations: optional array of{ to_id, type }.
Response:
- Returns
{ id, success }with HTTP201on success.
GET /api/tags
- Authentication: Yes
- Purpose: Lists tag blocks used in a heap.
Query parameters:
heap: required workspace ID.
Response:
- Returns an array of distinct tag blocks with
id,title,icon, andcolor.