SQL
query.create
Save a query
Details
- Endpoint
- POST /v1/query
- Credits
- Free
- Rate class
- Light. Counts against your light requests per second.
- Also called
- /api/v1/query
Saves a SQL query with its parameters and visualizations under your account and returns its query_id. Queries are public unless is_private is true. Needs a login or an API key.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | |
| description | string | |
| query_sql | string | The SQL (also accepted as sql). |
| dialect | string | One of "tide", "trino". |
| query_parameters | array of any | [{ key, type: text | number | date | list, value, options? }] |
| visualizations | array of any | [{ id, type, name, config }] |
| tags | array of any | |
| is_private | boolean |
Request
Send your key in the x-api-key header, or leave it out to use the keyless tier.
curl
curl -X POST "https://api.tide.ad/v1/query" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"name": "Latest checkpoints",
"query_sql": "SELECT sequence_number, block_time FROM sui.checkpoints ORDER BY sequence_number DESC LIMIT 10"
}'TypeScript
const res = await fetch("https://api.tide.ad/v1/query", {
method: "POST",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({
"name": "Latest checkpoints",
"query_sql": "SELECT sequence_number, block_time FROM sui.checkpoints ORDER BY sequence_number DESC LIMIT 10"
}),
});
const data = await res.json();Response
No example response is available for this method yet.