> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/api/references/control-tower/control-query.md).

# Control Query

Retrieve and validate control queries. Use these endpoints to get the enriched query of a control or validate a query independently before attaching it to a control.

## Retrieve the enriched query of a control

> Retrieves the enriched query of a control.\
> \
> This endpoint returns an enriched version of the control query, which includes additional\
> context such as display names for resources.<br>

```json
{"openapi":"3.1.0","info":{"title":"Collibra Control Tower Management API","version":"1.0.0"},"tags":[{"name":"Control Query","description":"Retrieve and validate control queries. Use these endpoints to get the enriched query of a control or\nvalidate a query independently before attaching it to a control.\n"}],"servers":[{"url":"/rest/controlManagement/v1"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"description":"This API requires Basic HTTP authentication.","type":"http","scheme":"basic"}},"responses":{"ControlQueryResponse":{"description":"Response for retrieving a control query.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ControlQuery"}}}},"NoControlQueryResponse":{"description":"No control query found for the given control ID."},"NotFound":{"description":"The resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}}},"schemas":{"ControlQuery":{"description":"The query that defines the logic for finding non-compliant assets.\n\nThe shape of this object is defined by the `Collibra Control Tower Query Model`, which is versioned\nseparately from this API. Its specification is published on https://developer.collibra.com/, both as an\nOpenAPI document and as a JSON Schema you can validate a query against.","type":"object","additionalProperties":true},"StandardErrorResponse":{"description":"A standard error response object.","type":"object","properties":{"statusCode":{"description":"HTTP response code.","type":"integer"},"titleMessage":{"description":"The title of the error message.","type":"string"},"helpMessage":{"description":"A message containing actions you can take regarding the error.","type":"string"},"userMessage":{"description":"A user friendly error message.","type":"string"},"errorCode":{"description":"An error code identifier.","type":"string"},"query":{"description":"The rejected control query, with each issue attached to the part of the query it applies to\nand `isValid` set to `false`.\n\nOnly present when the request was refused because of its query.\n","allOf":[{"$ref":"#/components/schemas/ControlQuery"}]}},"required":["statusCode","errorCode","userMessage"]}}},"paths":{"/controls/{controlId}/enrichedQuery":{"get":{"tags":["Control Query"],"summary":"Retrieve the enriched query of a control","description":"Retrieves the enriched query of a control.\n\nThis endpoint returns an enriched version of the control query, which includes additional\ncontext such as display names for resources.\n","operationId":"getEnrichedControlQuery","responses":{"200":{"$ref":"#/components/responses/ControlQueryResponse"},"204":{"$ref":"#/components/responses/NoControlQueryResponse"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
```

## Validate a control query

> Validates a control query, independently from any control.\
> \
> This endpoint takes a query as input and returns the same query as response, with potential\
> "issues" that were found in the query. The query comes back as it was sent: issues are attached to\
> the part of the query each one applies to, and nothing is corrected or removed on your behalf.\
> \
> Findings are reported one level at a time. A query is checked in levels: it has to parse, then\
> satisfy the \`Control Query\` schema, say something coherent, and reference elements that exist\
> and fit together. A level that finds anything stops the levels above it, because their rules are\
> written against a query that already passed. So a response carries every finding of one level, and\
> the next level's findings appear on a following call once those are fixed. Expect to iterate rather\
> than to receive one exhaustive list.<br>

```json
{"openapi":"3.1.0","info":{"title":"Collibra Control Tower Management API","version":"1.0.0"},"tags":[{"name":"Control Query","description":"Retrieve and validate control queries. Use these endpoints to get the enriched query of a control or\nvalidate a query independently before attaching it to a control.\n"}],"servers":[{"url":"/rest/controlManagement/v1"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"description":"This API requires Basic HTTP authentication.","type":"http","scheme":"basic"}},"requestBodies":{"ValidateControlQueryRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ControlQuery"}}},"required":true}},"schemas":{"ControlQuery":{"description":"The query that defines the logic for finding non-compliant assets.\n\nThe shape of this object is defined by the `Collibra Control Tower Query Model`, which is versioned\nseparately from this API. Its specification is published on https://developer.collibra.com/, both as an\nOpenAPI document and as a JSON Schema you can validate a query against.","type":"object","additionalProperties":true},"StandardErrorResponse":{"description":"A standard error response object.","type":"object","properties":{"statusCode":{"description":"HTTP response code.","type":"integer"},"titleMessage":{"description":"The title of the error message.","type":"string"},"helpMessage":{"description":"A message containing actions you can take regarding the error.","type":"string"},"userMessage":{"description":"A user friendly error message.","type":"string"},"errorCode":{"description":"An error code identifier.","type":"string"},"query":{"description":"The rejected control query, with each issue attached to the part of the query it applies to\nand `isValid` set to `false`.\n\nOnly present when the request was refused because of its query.\n","allOf":[{"$ref":"#/components/schemas/ControlQuery"}]}},"required":["statusCode","errorCode","userMessage"]}},"responses":{"ControlQueryResponse":{"description":"Response for retrieving a control query.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ControlQuery"}}}},"BadRequest":{"description":"The request is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}}}},"paths":{"/controlQueries/validate":{"post":{"tags":["Control Query"],"summary":"Validate a control query","description":"Validates a control query, independently from any control.\n\nThis endpoint takes a query as input and returns the same query as response, with potential\n\"issues\" that were found in the query. The query comes back as it was sent: issues are attached to\nthe part of the query each one applies to, and nothing is corrected or removed on your behalf.\n\nFindings are reported one level at a time. A query is checked in levels: it has to parse, then\nsatisfy the `Control Query` schema, say something coherent, and reference elements that exist\nand fit together. A level that finds anything stops the levels above it, because their rules are\nwritten against a query that already passed. So a response carries every finding of one level, and\nthe next level's findings appear on a following call once those are fixed. Expect to iterate rather\nthan to receive one exhaustive list.\n","operationId":"validateControlQuery","requestBody":{"$ref":"#/components/requestBodies/ValidateControlQueryRequest"},"responses":{"200":{"$ref":"#/components/responses/ControlQueryResponse"},"400":{"$ref":"#/components/responses/BadRequest"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.collibra.com/api/references/control-tower/control-query.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
