REST API
The main way to interact with scratchdata
is via the REST API.
Authentication
Auth is done via an API key. Keys are associated with a specific database. You may pass the API key via an HTTP header or a query param.
- Header Add the
X-API-KEY
header - Query Param Add
?api_key=...
to your request
Endpoints
POST /data
Send any JSON to the database associated with your API key.
Query Parameters
Parameter | Description |
---|---|
table | Name of the table to insert data (required) |
transform | How to flatten nested JSON. values: horizontal , explode |
Body
The JSON body can either be a single object or a list:
GET /query
Make a SQL query to the database associated with your API key.
Query Parameters
Parameter | Description |
---|---|
q | SQL query to run (required) |
format | Output format. values: json , csv |
Return
This endpoint returns a JSON list of the rows returned.