Saved Queries
Save SyQL queries for reuse, sharing, and scheduled re-execution.
Requires Academic verification.
Save a Query
For most workflows, save directly from SyQL. The structured POST /v1/queries route is mainly for already-resolved table and dataset selections.
From SyQL
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
https://api.syndb.xyz/v1/queries/from-syql \
-d '{
"label": "Mushroom body neuron volumes",
"query": "SELECT mesh_volume FROM neurons WHERE brain_region = '\''mushroom_body'\''",
"description": "All neuron mesh volumes in the mushroom body"
}'
Direct Save
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
https://api.syndb.xyz/v1/queries \
-d '{
"label": "Neuron cable lengths",
"description": "Neuron morphology subset for one dataset",
"syndb_table": 1,
"dataset_ids": ["11111111-1111-1111-1111-111111111111"],
"columns": ["neuron_id", "cable_length"],
"query_scope": "local"
}'
syndb_table is the current numeric SyndbTable discriminant. Use the SyQL-backed save route when you want server-side resolution from a query string instead of a pre-selected table and dataset list.
List Saved Queries
curl -H "Authorization: Bearer $TOKEN" \
https://api.syndb.xyz/v1/queries
Get a Query
curl -H "Authorization: Bearer $TOKEN" \
https://api.syndb.xyz/v1/queries/{query_id}
Update
curl -X PUT -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
https://api.syndb.xyz/v1/queries/{query_id} \
-d '{"label": "Updated label", "description": "Updated description"}'
Delete
curl -X DELETE -H "Authorization: Bearer $TOKEN" \
https://api.syndb.xyz/v1/queries/{query_id}
Run a Saved Query
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://api.syndb.xyz/v1/queries/{query_id}/run
Submits the query to the job system and returns a job ID.
Refresh Run Statuses
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://api.syndb.xyz/v1/queries/{query_id}/refresh
This polls all non-terminal runs attached to the saved query and returns the refreshed saved-query record.
CLI
The CLI saved-query commands are server-backed and operate on the same saved query store as the web UI and API.
syndb query list
syndb query save-syql --label "My query" "SELECT neuron_id FROM neurons LIMIT 100"
syndb query save --label "Neuron subset" --table 1 --dataset-id {dataset_id} --column neuron_id
syndb query show --id {query_id}
syndb query run --id {query_id}
syndb query status --id {query_id}
syndb query update --id {query_id} --label "New label"
syndb query delete --id {query_id}