Queries run over the data you have already ingested into a workspace. You describe what you want in natural language, and AiQL returns the matching results. You can also list, retrieve, and delete saved queries.
Prerequisites
- An AiQL API key in the
AIQL_API_KEY environment variable
- A workspace ID with a finished ingestion (see Run a full ingestion)
Run a query
Send your request as text and pass the workspace ID in the AiQL-Workspace header.
curl -X POST https://api.aiql.io/queries \
-H "Authorization: Bearer $AIQL_API_KEY" \
-H "AiQL-Workspace: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{"text": "list every invoice over $1,000 from last quarter"}'
List saved queries
Retrieve the queries you have run in a workspace.
curl https://api.aiql.io/queries \
-H "Authorization: Bearer $AIQL_API_KEY" \
-H "AiQL-Workspace: YOUR_WORKSPACE_ID"
Delete a query
Remove a saved query when you no longer need it.
curl -X DELETE https://api.aiql.io/queries/YOUR_QUERY_ID \
-H "Authorization: Bearer $AIQL_API_KEY" \
-H "AiQL-Workspace: YOUR_WORKSPACE_ID"
Keep prompts focused and constrain the result set. Word counts include both your query input and the matched content returned, so a tighter query costs fewer credits.
Queries are billed at 10 credits per 1,000 words, with a minimum of 1 credit per query. Listing, retrieving, and deleting saved queries is free. See Pricing for details.