HTTP API Reference
Ask your data anything. MynaDB exposes a REST API on port 7000 (configurable) that lets you communicate with your infrastructure data. All endpoints accept and return JSON unless otherwise noted.
http://localhost:7000 (default configuration)
Write Data
Write time series data using InfluxDB Line Protocol.
| Endpoint | POST /write/:db |
| Content-Type | text/plain |
| Parameters | :db - Database name (auto-created if not exists) |
Line Protocol Format
<measurement>,<tag_key>=<tag_value>,... <field_key>=<field_value>,... [timestamp]
Example
curl -X POST http://localhost:7000/write/mydb \
-H "Content-Type: text/plain" \
-d 'cpu,host=server01,region=us-west usage=75.5,temp=45
cpu,host=server02,region=us-east usage=82.3,temp=50
memory,host=server01 used=16.5,total=32.0'
Response
HTTP/1.1 204 No Content
Field Types
| Suffix | Type | Example |
|---|---|---|
| (none) | Float64 | usage=75.5 |
i |
Int64 | count=42i |
u |
UInt64 | bytes=1024u |
| quotes | String | status="ok" |
t/f |
Boolean | active=t |
Query Data
Execute SQL queries against your time series data.
| Endpoint | GET /query/:db?sql=<query>POST /query/:db |
| Content-Type | text/plain (POST body is SQL) |
| Response | JSON array of objects |
GET Request
curl 'http://localhost:7000/query/mydb?sql=SELECT * FROM cpu LIMIT 10'
POST Request (Recommended for complex queries)
curl -X POST http://localhost:7000/query/mydb \
-d "SELECT host, AVG(usage) as avg_cpu
FROM cpu
WHERE region = 'us-west'
GROUP BY host
ORDER BY avg_cpu DESC"
Response
[
{"host": "server01", "avg_cpu": 75.5},
{"host": "server02", "avg_cpu": 45.2}
]
Table Name Formats
| Format | Example | Description |
|---|---|---|
| Short name | SELECT * FROM cpu |
Auto-prefixed with catalog.schema |
| Schema.table | SELECT * FROM default.cpu |
Explicit schema |
| Fully qualified | SELECT * FROM mydb.default.cpu |
Full catalog.schema.table |
Flush Cache
Flush in-memory cache to Parquet files on disk.
| Endpoint | POST /flush |
curl -X POST http://localhost:7000/flush
Response
{"status": "ok", "message": "Cache flushed successfully"}
Trigger Compaction
Manually trigger compaction for a database or specific measurement.
| Endpoint | POST /compact/:dbPOST /compact/:db/:measurement |
# Compact entire database
curl -X POST http://localhost:7000/compact/mydb
# Compact specific measurement
curl -X POST http://localhost:7000/compact/mydb/cpu
List Tables
List all tables in a database.
| Endpoint | GET /tables/:db |
curl http://localhost:7000/tables/mydb
Response
{
"catalog": "mydb",
"tables": [
"mydb.default.cpu",
"mydb.default.memory",
"mydb.default.disk"
],
"count": 3
}
Get Table Schema
Get the schema (columns and types) for a table.
| Endpoint | GET /schema/:db/:table |
curl http://localhost:7000/schema/mydb/cpu
Response
{
"table": "cpu",
"columns": [
{"name": "timestamp", "type": "Int64"},
{"name": "host", "type": "Utf8"},
{"name": "region", "type": "Utf8"},
{"name": "usage", "type": "Float64"},
{"name": "temp", "type": "Int64"}
]
}
List Partitions
List date partitions for a table.
| Endpoint | GET /partitions/:catalog/:schema/:table |
curl http://localhost:7000/partitions/mydb/default/cpu
Delete Partition
curl -X DELETE http://localhost:7000/partitions/mydb/default/cpu/2024-01-15
Retention
Delete old partitions based on age or date.
| Endpoint | POST /retention/:catalog/:schema/:table |
| Content-Type | application/json |
Delete by Age
curl -X POST http://localhost:7000/retention/mydb/default/cpu \
-H "Content-Type: application/json" \
-d '{"older_than_days": 30}'
Delete by Date
curl -X POST http://localhost:7000/retention/mydb/default/cpu \
-H "Content-Type: application/json" \
-d '{"before_date": "2024-01-01"}'
Health Check
Check if the server is running.
| Endpoint | GET /health |
curl http://localhost:7000/health
Response
{"status": "ok"}
Cache Statistics
Get statistics about the in-memory cache.
| Endpoint | GET /stats |
curl http://localhost:7000/stats
OpenTelemetry (OTLP) Ingestion
Native OpenTelemetry ingestion for metrics, logs, and traces. See full OTLP documentation.
| Endpoint | Method | Description |
|---|---|---|
gRPC :4317 |
- | OTLP gRPC receiver (metrics, logs, traces) |
/v1/metrics |
POST | OTLP HTTP metrics receiver |
/v1/logs |
POST | OTLP HTTP logs receiver |
/v1/traces |
POST | OTLP HTTP traces receiver |
Iceberg REST Catalog
Apache Iceberg REST Catalog API for multi-engine analytics. See full Iceberg documentation.
| Endpoint | Method | Description |
|---|---|---|
/iceberg/v1/namespaces |
GET | List namespaces |
/iceberg/v1/namespaces/:ns/tables |
GET | List tables in namespace |
/iceberg/v1/namespaces/:ns/tables/:table |
GET | Get table metadata |
Grafana-Compatible Endpoints
InfluxDB-compatible endpoints for Grafana datasource integration. See full Grafana documentation.
| Endpoint | Method | Description |
|---|---|---|
/api/v2/query |
POST | Flux-compatible query endpoint |
/api/v1/query |
GET/POST | InfluxQL-compatible query endpoint |
Streaming Queries
Real-time query subscriptions. See full streaming documentation.
| Endpoint | Method | Description |
|---|---|---|
/ws/query/:db |
WebSocket | WebSocket query subscription |
/stream/query/:db |
GET | Server-Sent Events query stream |
Prometheus Metrics
Prometheus-compatible metrics endpoint. See full monitoring documentation.
| Endpoint | GET /metrics |
curl http://localhost:7000/metrics
Authentication
API authentication when auth is enabled. See full security documentation.
| Endpoint | Method | Description |
|---|---|---|
/auth/users |
GET | List users |
/auth/users |
POST | Create user |
/auth/users/:name |
DELETE | Delete user |
/auth/users/:name/role |
PUT | Update user role |
Error Responses
All errors return JSON with an error message:
{
"error": "Table not found: mydb.default.unknown"
}
| Status Code | Description |
|---|---|
| 200 | Success (with response body) |
| 204 | Success (no content) |
| 400 | Bad request (invalid syntax) |
| 404 | Not found (table, database) |
| 500 | Internal server error |