ContX IQ: How do I list the Knowledge Queries of a project?
Knowledge Queries are Config API objects, so they are listed like every other configuration: GET /configs/v1/knowledge-queries with the project in project_id, authenticated with a Service Account Bearer token.
Without full_fetch=true the list is metadata only. Each item keeps its identifiers, name, display_name, description, status and timestamps, and the heavy fields come back empty: query and policy_id. That is the list to show in a console or to pick a query by name before reading it by id. With full_fetch=true every item carries its complete definition, query included. search= keeps only the items whose name, display name or description contains the text.
Every item carries its name, the URL-friendly identifier that is unique in the project, so a client can find the query it needs without reading each one by id.
Use case
Scenario: An admin console lists the Knowledge Queries of a project by name and lets an operator open one. The console fetches the metadata-only list, renders name and display_name, and reads the selected query by id for its definition. A deployment script does the opposite: it lists with full_fetch=true to compare the stored query text with the one in version control, and uses search= to narrow a large project to the queries of one feature.
Requirements
Prerequisites:
- ServiceAccount credentials: Bearer token in the Authorization header.
- A project id (project_id) with at least one Knowledge Query.
Required API access:
- GET /configs/v1/knowledge-queries
Steps
Step 1: List the Knowledge Queries of the project
- Action: GET /configs/v1/knowledge-queries?project_id=<gid>.
- Result: 200 with a data array. Each item carries id, name, display_name, description, project_id, organization_id, status and the create and update fields; query and policy_id are empty because full_fetch was not requested.
Step 2: List with the full definition
- Action: the same call with full_fetch=true.
- Result: each item also carries query, the Knowledge Query definition as a JSON string, and policy_id, the ContX IQ policy it runs under.
Step 3: Filter by text
- Action: add search=<text>.
- Result: only the items whose name, display name or description contains the text, metadata only unless full_fetch=true is added as well.
Step 1
The metadata-only list. project_id is required.
curl -sS "$API_URL/configs/v1/knowledge-queries?project_id=$PROJECT_ID" \
-H "Authorization: Bearer $SA_TOKEN"200: each item names the query; query and policy_id stay empty without full_fetch.
HTTP/2 200
{
"data": [
{
"id": "gid-of-knowledge-query-1",
"name": "person-license-numbers",
"display_name": "License numbers a person can see",
"description": "Returns the LicenseNumber values the subject may read",
"project_id": "gid-of-project",
"organization_id": "gid-of-organization",
"status": "ACTIVE",
"policy_id": "",
"query": "",
"create_time": "2026-10-20T08:01:12Z",
"created_by": "gid-of-service-account",
"update_time": "2026-10-20T08:01:12Z",
"updated_by": "gid-of-service-account"
},
{
"id": "gid-of-knowledge-query-2",
"name": "contract-payment-methods",
"display_name": "Payment methods of contracted users",
"description": "",
"project_id": "gid-of-project",
"organization_id": "gid-of-organization",
"status": "ACTIVE",
"policy_id": "",
"query": "",
"create_time": "2026-10-21T14:37:50Z",
"created_by": "gid-of-service-account",
"update_time": "2026-10-21T14:37:50Z",
"updated_by": "gid-of-service-account"
}
]
}Step 2
The same list with every field.
curl -sS "$API_URL/configs/v1/knowledge-queries?project_id=$PROJECT_ID&full_fetch=true" \
-H "Authorization: Bearer $SA_TOKEN"200: query is the stored Knowledge Query definition as a JSON string, policy_id the policy it runs under.
HTTP/2 200
{
"data": [
{
"id": "gid-of-knowledge-query-1",
"name": "person-license-numbers",
"display_name": "License numbers a person can see",
"description": "Returns the LicenseNumber values the subject may read",
"project_id": "gid-of-project",
"organization_id": "gid-of-organization",
"status": "ACTIVE",
"policy_id": "gid-of-ciq-policy-1",
"query": "{\"nodes\":[\"ln.property.number\"],\"filter\":{\"attribute\":\"ln.property.number\",\"operator\":\"=\",\"value\":\"$ln_number\"}}",
"create_time": "2026-10-20T08:01:12Z",
"created_by": "gid-of-service-account",
"update_time": "2026-10-20T08:01:12Z",
"updated_by": "gid-of-service-account"
}
]
}Step 3
Only the queries whose name, display name or description contains "license".
curl -sS "$API_URL/configs/v1/knowledge-queries?project_id=$PROJECT_ID&search=license" \
-H "Authorization: Bearer $SA_TOKEN"