HTTP API
Implementation reference: src/sydra/http.zig.
Authentication
If auth_token is set in sydradb.toml, all routes under /api/* require:
Authorization: Bearer <auth_token>
Implementation: handleRequest auth guard.
GET /metrics
Returns Prometheus text exposition.
Implementation: handleMetrics.
POST /api/v1/ingest
Consumes NDJSON (newline-delimited JSON). Each line is an object with:
series(string, required)ts(integer, required)value(number, optional)fields(object, optional): ifvalueis missing, the first numeric field is usedtags(object, optional)
Implementation: handleIngest.
Returns:
{"ingested":123}
Error cases:
- A line that exceeds the internal buffer fails the request with
413 Payload Too Large.
POST /api/v1/query/range
Requires Content-Length and a JSON body:
start(integer, required)end(integer, required)series_id(integer) orseries(string)tags(object, optional; used when hashingseries→series_id)
Returns a JSON array:
[{"ts":1694300000,"value":24.2}]
Implementation: handleQuery (POST JSON).
GET /api/v1/query/range?...
Query parameters:
series_id=<u64>(preferred) orseries=<string>tags=<string>(optional, defaults to{})start=<i64>(required)end=<i64>(required)
Returns the same JSON array as the POST form.
Implementation: handleQueryGet (GET query string).
POST /api/v1/query/find
Request JSON:
tags(object): exact-match tag constraints (string values)op(string, optional):"and"(default) or"or"
Response JSON: array of matching series_id values.
Implementation: handleFind.
POST /api/v1/sydraql
Request body is plain text sydraQL.
Response JSON object:
columns: array of{name,type,nullable}rows: array of row arraysstats: execution timings and operator stats
Implementation:
Debug endpoints
GET /debug/compat/stats– JSON countersGET /debug/compat/catalog– JSON snapshot of compat catalog objectsGET /debug/alloc/stats– JSON allocator stats (only insmall_poolallocator mode)
See also:
SeriesIdderivation and caveats- Configuration (auth, ports, data dir)