Save Query
Persist a named query definition so it can be re-executed against any compatible dataset.
/v1/save
curl -X POST "https://analytics.toolkitapi.io/v1/save" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "monthly_revenue_by_region",
"description": "Total revenue grouped by region for a given month",
"query": "What is the total revenue by region for each month?",
"dataset_id": "dset_abc123"
}'
import httpx
resp = httpx.post(
"https://analytics.toolkitapi.io/v1/save",
json={
"name": "monthly_revenue_by_region",
"description": "Total revenue grouped by region for a given month",
"query": "What is the total revenue by region for each month?",
"dataset_id": "dset_abc123"
},
)
print(resp.json())
const resp = await fetch("https://analytics.toolkitapi.io/v1/save", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "monthly_revenue_by_region",
"description": "Total revenue grouped by region for a given month",
"query": "What is the total revenue by region for each month?",
"dataset_id": "dset_abc123"
}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"query_id": "qry_xyz789",
"name": "monthly_revenue_by_region",
"created_at": "2024-06-01T12:00:00Z",
"status": "saved"
}
Description
How to Use
1. Compose your natural-language or structured query as you would submit it to `/v1/analyze`. 2. Choose a short, descriptive `name` (e.g. `"weekly_signups_by_plan"`). 3. `POST /v1/save` with the query payload and an optional `dataset_id` to bind it to a specific dataset. 4. Store the returned `query_id` — use it with `POST /v1/query/{query_id}` to run it later.
About This Tool
The Save Query endpoint lets you persist a named, reusable query definition against the analytics engine. Once saved, you can re-execute the query at any time via `POST /v1/query/{query_id}` without re-specifying the full question or chart definition.
This enables consistent, repeatable reporting — the same named query can be run against different datasets or on a schedule, keeping your analytics workflows DRY.
> **Note:** This endpoint is planned for a future release. It currently returns HTTP 501 Not Implemented. Bookmark it for when it becomes available, or check the API changelog for its general availability date.
Why Use This Tool
- Scheduled reporting — Save queries once and trigger them nightly or weekly via automation.
- Dashboard templates — Maintain a library of named queries that back recurring charts.
- Team collaboration — Share `query_id` values across team members for consistent metric definitions.
- Version control — Track changes to query definitions by re-saving with an updated payload.
- Multi-dataset analysis — Save a query template and run it against different uploaded datasets.
Start using Save Query now
Get your free API key and make your first request in under a minute.