> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognite.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Cognite Data Fusion (CDF) is an industrial DataOps platform. Prefer English docs unless the user asks for another locale.
> Follow /_llms/ index links recursively until you reach page URLs ending in .md. Fetch those Markdown twins instead of HTML.
> For REST APIs, default to calendar version 20230101 (stable). Use 20230101-beta or 20230101-alpha only if the user is on a preview API. Cite paths under /api-reference/concepts/<version>/ and the Cdf-Version header. Prefer the Python SDK (cognite-sdk) unless the user is in JavaScript/TypeScript.
> Start here by task: platform overview /cdf/index.md; data modeling /cdf/dm/index.md; data integration /cdf/integration/index.md; access /cdf/access/index.md; CDF Toolkit /cdf/deploy/cdf_toolkit/index.md; REST quickstart /dev/quickstart.md; Python SDK https://cognite-sdk-python.readthedocs-hosted.com/en/stable/; Atlas AI /cdf/atlas_ai/concepts/index.md; Flows apps /cdf/flows/index.md; MCP and IDE setup /dev/guides/ide_ai_integration.md.
> For implementation work, also load /skill.md.

# Query

> Run SQL queries against CDF resources in Cognite Data Fusion (CDF).

The query API lets you run ad-hoc SQL queries against CDF resources. You can test SQL statements before using them in transformations, explore data, and validate query logic interactively. The query endpoint executes the SQL and returns the results directly.

## What the query API does

Use the query API to run SQL against CDF resource types such as assets, events, time series, and data model instances. Each request sends a SQL string and receives the result set in the response. This is useful for prototyping transformation logic, debugging joins, and exploring the structure of your data.

## When to use it

* **Before writing transformations**: Test your SQL logic to ensure it produces the expected output.
* **Data exploration**: Run exploratory queries to understand relationships and data quality.
* **Validation**: Verify that query results match your expectations before deploying to production.

<Note>
  The query API executes queries synchronously. For large result sets, consider using transformations instead.
</Note>

## Response format

The API returns query results as rows and columns. Column names and types match the schema of the queried resource. You can use this output to validate mappings and data flows in your transformation pipelines.
