Skip to content

Query context

POST /v1/query-context runs a read-only query against your project’s context graph and returns the connected entities and relationships, assembled by graph traversal.

Terminal
curl https://api.wexa.ai/v1/query-context \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "X-Wexa-Workspace: ws_<your_project>" \
-H "Content-Type: application/json" \
-d '{
"query": "top accounts at churn risk",
"limit": 10
}'
Field Type Required Notes
query string yes A natural-language or structured query.
limit integer no Max results; the gateway clamps to a safe ceiling.

The project_id is not something you pass — it is injected server-side from your workspace header and credential. A client cannot rebind it.

The request runs Fabric’s governed pipeline: authenticated → scope-resolved → rate-checked → validated by the Cypher guard → policy-checked → executed by graph traversal against a read-only role → PII-redacted → recorded. Reads are bounded (mandatory project filter, clamped limit and timeout), so a query can never write or escape its project.

The response contains the ranked entities, relationships, and facts that ground the query, plus a lifecycle_id for tracing and audit. Every entity that reaches you is provenance-stamped — Fabric can show which run consumed which entity and when.

Status Cause
401 Missing / invalid API key.
403 The workspace header names a project your key can’t access.
422 The query failed validation (e.g. contained a write clause).
429 Per-project or per-org quota exceeded.