> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://zuora.ferndocs.com/docs/platform/data/aggregate-query-api-aqua/post-query/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://zuora.ferndocs.com/_mcp/server. # Post Query > Learn how to use the Submit an aggregate query job API operation to submit aggregated ZOQL and Export ZOQL queries, with examples in JSON and cURL. Learn how to use the Submit an aggregate query job API operation to submit aggregated ZOQL and Export ZOQL queries, with examples in JSON and cURL. Use the [Submit an aggregate query job](https://www.zuora.com/developer/api-references/api/operation/POST_BatchQueryJob/) API operation to submit an aggregated list of ZOQL and Export ZOQL queries. The following section provides JSON and cURL examples to use this API operation. HTTP request: `POST` `https://rest.zuora.com/v1/batch-query/` `POST` `https://rest.apisandbox.zuora.com/v1/batch-query/` * JSON Full Load example * JSON request: ```json { "format" : "csv", "version" : "1.1", "name" : "Example", "encrypted" : "none", "useQueryLabels" : "true", "partner" : "salesforce", "project" : "00170000011K3Ub", "dateTimeUtc" : "true", "queries" : [ { "name" : "AccountingPeriod", "query" : "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod", "type" : "zoqlexport" }] } ``` * JSON response (Full load): ```json { "encrypted": "none", "partner": "salesforce", "useLastCompletedJobQueries": false, "project": "00170000011k3ub", "batches": [ { "localizedStatus": "pending", "apiVersion": "91.0", "full": false, "recordCount": 0, "batchId": "2c92c0f966cd4f580166ec0ac8a75bb8", "batchType": "zoqlexport", "status": "pending", "name": "AccountingPeriod", "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod" } ], "status": "submitted", "name": "Example", "id": "2c92c0f966cd4f580166ec0ac89d5bb7", "version": "1.1", "format": "CSV" } ``` * JSON Incremental Load example * JSON request: ```json { "format" : "csv", "version" : "1.1", "name" : "Example", "encrypted" : "none", "useQueryLabels" : "true", "partner" : "salesforce", "project" : "00170000011K3Ub", "dateTimeUtc" : "true", "queries" : [ { "name" : "AccountingPeriod", "query" : "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod", "type" : "zoqlexport" }] } ``` * JSON response (Incremental load): ```json { "encrypted": "none", "partner": "salesforce", "useLastCompletedJobQueries": false, "project": "00170000011k3ub", "batches": [ { "localizedStatus": "pending", "apiVersion": "91.0", "full": false, "recordCount": 0, "batchId": "2c92c0f966cd4f580166ec0ac8a75bb8", "batchType": "zoqlexport", "status": "pending", "name": "AccountingPeriod", "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod" } ], "status": "submitted", "name": "Example", "id": "2c92c0f966cd4f580166ec0ac89d5bb7", "version": "1.1", "format": "CSV" } ``` * CURL example > **Note** > > When processing a request through a curl shell script, you must enclose the field value in nested single double single quotes, such as Invoice.Status=`'"'Posted'"'` * JSON request: ``` USER_NAME="ZUORA_API_USERNAME" PASSWORD="PASSWORD" BASE_URL="https://www.zuora.com/apps" echo echo "============= Posting the Aqua Job ===========" echo curl -i -k -u $USER_NAME:$PASSWORD -H "Content-Type:application/json" -H "Accept:application/json" -d ' { "format" : "csv", "version" : "1.1", "name" : "Example", "encrypted" : "none", "useQueryLabels" : "true", "partner" : "salesforce", "project" : "00170000011K3Ub", "dateTimeUtc" : "true", "queries" : [ { "name" : "Invoice", "query" : "select Invoice.Amount, Invoice.Balance, Invoice.InvoiceDate, Invoice.InvoiceNumber from Invoice where ( Invoice.Status='"'Posted'"')", "type" : "zoqlexport" }] } ' -X POST $BASE_URL/api/batch-query/ ``` * Curl response: ``` HTTP/1.1 200 OK Content-Type: application/json Date: Fri, 05 Sep 2014 11:27:54 GMT Transfer-Encoding: chunked Connection: Keep-Alive { "encrypted": "none", "partner": "salesforce", "useLastCompletedJobQueries": false, "project": "00170000011k3ub", "batches": [ { "localizedStatus": "pending", "apiVersion": "91.0", "full": false, "recordCount": 0, "batchId": "2c92c0f966cd4f580166ec0ac8a75bb8", "batchType": "zoqlexport", "status": "pending", "name": "AccountingPeriod", "query": "select Id,StartDate,EndDate,FiscalYear,Name,Status from AccountingPeriod" } ], "status": "submitted", "name": "Example", "id": "2c92c0f966cd4f580166ec0ac89d5bb7", "version": "1.1", "format": "CSV" } ``` > Learn how to use the Submit an aggregate query job API operation to submit aggregated ZOQL and Export ZOQL queries, with examples in JSON and cURL. ## Docs - [Post query with API version](https://zuora.ferndocs.com/docs/platform/data/aggregate-query-api-aqua/post-query/post-query-with-api-version.md): Learn how to use the Submit an aggregate query job API operation with the apiVersion query parameter to ensure consistent query performance. - [Post query with notification](https://zuora.ferndocs.com/docs/platform/data/aggregate-query-api-aqua/post-query/post-query-with-notification.md): Learn how to use the Submit an aggregate query job API operation to submit queries with user notification upon completion. - [Post query with retrieval time](https://zuora.ferndocs.com/docs/platform/data/aggregate-query-api-aqua/post-query/post-query-with-retrieval-time.md): Learn how to use the Submit an aggregate query job API operation with the incrementalTime parameter to retrieve records created or modified after a specified time in Stateful AQuA mode. - [Post query with time offset](https://zuora.ferndocs.com/docs/platform/data/aggregate-query-api-aqua/post-query/post-query-with-time-offset.md): Learn how to use the Submit an aggregate query job API operation with the offset parameter to retrieve records created or updated within a specific time frame.