REST API
QueryWise exposes a full REST API under /api/v1/. Everything the dashboard does, the API does — same endpoints, same data, same authorization model. The interactive OpenAPI schema is served at /docs on every QueryWise instance.
Authentication
Two paths:
- Session cookie + JWT — what the dashboard uses. Auth0-issued RS256 tokens, validated on every request.
- API key — for programmatic access, CI/CD, integrations. Generate from Settings → API Keys.
API key requests:
curl -H "Authorization: Bearer qw_live_..." https://app.querywise.io/api/v1/recommendations
API keys are scoped to a tenant and a role (typically editor or viewer). They never expire automatically; you can rotate or revoke from the same page.
Rate limits
The default rate limit is 120 requests per minute per tenant. Exceeded requests get HTTP 429 with a Retry-After header. Higher limits are available on enterprise plans.
The middleware order is:
CORS → Rate Limit → Auth → Tenant Resolution → Audit
Tenant resolution sets the PostgreSQL search_path to the tenant's schema, so every downstream query is automatically scoped.
Major endpoint groups
The API has 26+ endpoint groups. The ones most teams use:
Costs & analytics
GET /api/v1/costs/summary— top-level cost summaryGET /api/v1/costs/breakdown— by vendor, service, tag, or cost centerGET /api/v1/costs/trends— time series with forecastGET /api/v1/costs/forecast— 30/60/90-day projectionsGET /api/v1/analytics/cost-drivers— what drove month-over-month changeGET /api/v1/focus-export— FOCUS-standard export (JSON or CSV)
Recommendations
GET /api/v1/recommendations— list with filters (severity, category, vendor, status)GET /api/v1/recommendations/{id}— detail with evidence + remediationPOST /api/v1/recommendations/{id}/apply— execute apply workflowGET /api/v1/recommendations/{id}/impact— before/after comparisonPOST /api/v1/recommendations/{id}/analyze— trigger AI deep analysis
Cloud accounts
GET /api/v1/accounts— list connected accountsPOST /api/v1/accounts— connect new vendor (validated against tag policy)POST /api/v1/accounts/{id}/test— connection testPOST /api/v1/accounts/{id}/sync— trigger on-demand syncGET /api/v1/accounts/{id}/schema-metadata— table/column inventory
Budgets & alerts
GET /api/v1/budgets— list budgetsPOST /api/v1/budgets— create budget with thresholdsGET /api/v1/alerts— alert feedPOST /api/v1/alerts/{id}/acknowledge— acknowledge alert
Tags & allocation
GET /api/v1/tags/discovery— coverage and cardinality per tagGET /api/v1/tags/allocation— cost broken down by tagGET /api/v1/cost-centers— list cost centersPOST /api/v1/cost-centers— create cost centerGET /api/v1/cost-centers/{id}/chargeback— chargeback report
Queries
GET /api/v1/queries— top queries by cost, duration, or countGET /api/v1/queries/{hash}— query detail with plan and anti-pattern matchesGET /api/v1/queries/{hash}/plans— execution plan history
Reports
GET /api/v1/reports— saved reportsPOST /api/v1/reports/{id}/share— generate shareable read-only linkGET /reports/share/{token}— public-readable shared report
Integrations
POST /api/v1/integrations/jira/connect— JIRA OAuth flow startPOST /api/v1/integrations/servicenow/connect— ServiceNow OAuth (withinstance_url)POST /api/v1/integrations/slack/test— test Slack webhook
Response shape
All list endpoints return the same envelope:
{
"items": [...],
"total": 142,
"limit": 50,
"offset": 0
}
All detail endpoints return the resource directly. Errors are RFC 7807 Problem JSON.
Pagination
Cursor-based pagination is supported on heavy endpoints (recommendations, queries, audit):
GET /api/v1/recommendations?limit=50&cursor=eyJpZCI6IjE...
The response includes next_cursor if there are more pages.
Audit logging
Every API write is logged in audit_logs with the actor, tenant, action, target, and request payload (sanitized). Reads are sampled. The audit feed is available at GET /api/v1/audit/events and on the Activity Log dashboard page.
OpenAPI schema
For the full reference, hit /docs on your QueryWise instance — it serves Swagger UI generated from the live FastAPI schema. The raw OpenAPI JSON is at /openapi.json.
Where to next
- Recommendations Engine — what the recommendations API actually returns.
- Workflows & Integrations — how to wire JIRA, ServiceNow, and Slack.