Base URL
Authentication
All API endpoints require an API key. Include it in thex-api-key header or as an api-key query parameter.
For details on authentication, see our Authentication guide.
Endpoints
SQL Query
Execute read-only SQL SELECT queries against ClickHouse. Endpoint:POST /query
Request Body:
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | SQL SELECT query (read-only) |
format | string | No | Response format: "json" (default) or "csv" |
Automatic LIMIT: If your query doesn’t include a LIMIT clause, a default LIMIT of 1000 is automatically added. Maximum allowed LIMIT is 10,000.
Health Check
Check API and service health status. Endpoint:GET /health
Note: This endpoint does not require authentication.
Response:
Query Restrictions
For security, only read-only queries are allowed:Allowed Operations
SELECTstatementsWITH(CTEs - Common Table Expressions)JOINoperations- Aggregations (
COUNT,SUM,AVG, etc.) GROUP BY,ORDER BY,HAVINGLIMIT,OFFSET- Subqueries
Blocked Operations
The following operations are not allowed:INSERT,UPDATE,DELETEDROP,CREATE,ALTERTRUNCATE,REPLACEGRANT,REVOKEKILL,OPTIMIZE- Multiple statements (semicolons)
Error Responses
Invalid Query
400 Bad Request
Missing API Key
401 Unauthorized
Rate Limit Exceeded
429 Too Many Requests
Best Practices
Use appropriate LIMIT
Use appropriate LIMIT
Specify a reasonable LIMIT for your use case. The default is 1000, but you can go up to 10,000.
Filter early
Filter early
Use WHERE clauses to filter data early in the query to reduce processing time.
Use indexes
Use indexes
Filter by indexed columns (date, protocol_name, program_id) for better performance.
Avoid SELECT *
Avoid SELECT *
Select only the columns you need to reduce response size and improve performance.
