# ContX IQ: How do I list the Knowledge Queries of a project?

> List the Knowledge Queries of a project with GET /configs/v1/knowledge-queries: a metadata-only list by default, with each query's id, name, display name, description and status, full_fetch=true to include the query text and policy_id, and search= to filter by name, display name or description.

**Category:** ContX IQ  
**API:** ContX IQ  
**Tags:** ContX IQ, Knowledge Query, Config API, List, full_fetch, search
**Last Updated:** 2026-10-28
**OpenAPI Endpoints:** /configs/v1/knowledge-queries
**Related Guides:** /guides/guide-config-api, /guides/guide-contx-iq

## Summary

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.

## Code Examples

### Step 1

The metadata-only list. project_id is required.

**GET https://eu.api.indykite.com/configs/v1/knowledge-queries**

```bash
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.

```json

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.

**GET https://eu.api.indykite.com/configs/v1/knowledge-queries**

```bash
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.

```json

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".

**GET https://eu.api.indykite.com/configs/v1/knowledge-queries**

```bash
curl -sS "$API_URL/configs/v1/knowledge-queries?project_id=$PROJECT_ID&search=license" \
  -H "Authorization: Bearer $SA_TOKEN"
```

## Common Errors

### 422: missing field project_id

**Solution:** project_id is a required query parameter: pass the project GID.

### 401: Invalid ServiceAccount JWT in Authorization header

**Solution:** The Config API takes a Service Account Bearer token, not an Application Agent credential.

---

Source: https://developer.indykite.com/resources/ciq-list-1