> This page is for Docs.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://zuora.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://zuora.ferndocs.com/_mcp/server.

# Use Data Query through API

> Learn how to export data from your Zuora tenant through Data Query API.

Learn how to export data from your Zuora tenant through Data Query API.

You can use the [Data Query API](https://developer.zuora.com/v1-api-reference/api/tag/Data-Queries/) to submit queries, check the status of queries, and obtain the exported data.

Construct a SQL query.

```
SELECT accountnumber, balance FROM Account WHERE Account.balance > 100
```

For example, see [Constructing SQL Queries in Data Query](/docs/platform/data/data-query/construct-sql-queries-in-data-query) for the supported SQL syntax, the available tables, and sample queries.

Call [Submit data query](https://developer.zuora.com/v1-api-reference/api/data-queries/post_dataqueryjob) to submit the query and create a query job. Provide the query in the request body.

You can request the query results in CSV, TSV, DSV or JSON format.

Call [Get data query job](https://developer.zuora.com/v1-api-reference/api/operation/GET_DataQueryJob/) in the API or check your query listed on the Data Query page to track the status of the query job.

> **Note**
>
> Depending on the complexity of the query, you may need to call "Get data query job" several times, until the value of `queryStatus` in the response body is `completed`, `failed`, or `cancelled`.

When the query job is complete, you can obtain the URL of the query results from the response body. For example:

`https://example.s3.us-west-2.amazonaws.com/3a3e85c4-96e7-486b-ae02-827120104301_24921638725108715.json?X-Amz-Security-Token=...`

Download the query results.

Each row in the query results contains the requested fields of an object in your Zuora tenant. For instance, if you requested the query results in JSON format, each row in the query results is a JSON object. The query results are not wrapped in a JSON array. For example:

```
accountnumber,balance
A00253588,230.0
A00253573,125.0
A00255366,199.95
...
```

```json
{"accountnumber":"A00253588","balance":230.0}
{"accountnumber":"A00253573","balance":125.0}
{"accountnumber":"A00255366","balance":199.95}
...
```