---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/data-cloud-query-api-reference/c360a-api-query-v2.md
cuppy_section: docs
cuppy_doc: 8WFX-06KV
cuppy_doc_uuid: 1f748cad-57dc-461e-919c-b1510a1aacea
cuppy_permalink: https://cuppy.io/salesforce/d/8WFX-06KV
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/references/data-cloud-query-api-reference/c360a-api-query-v2
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: 156a9782fb94a139d1e68066fa8abb7b83cbba7856cdd5f7ecc64c7a1fbd4501
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/c360a-api-query-v2.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

## Request Data With Query V2

Use the POST endpoint of Query API V2 to make the first request with the SQL query. The POST endpoint returns data along with batchId for the next batch.

A newer version of the Query API is available. We recommend using the newest [Query API](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/c360a-api-queryservices-overview.html).

*   **HTTP Method**: POST
*   **Availability**: Data 360 v2.0, Salesforce 54.0
*   **format**: REST
*   **URI**: `/api/v2/query`

The request body must contain a JSON object with these fields:

| Field Name | Field Type | Description |
| --- | --- | --- |
| sql | string | The SQL query to execute. Must be a valid ANSI standard SQL query. |

The response includes:

*   `data`: Array of record objects containing the requested data
*   `startTime`: ISO 8601 timestamp indicating when the query started executing
*   `endTime`: ISO 8601 timestamp indicating when the query finished executing
*   `rowCount`: Number of rows returned by the query
*   `queryId`: Unique identifier for the query
*   `nextBatchId`: Identifier for the next batch of results
*   `done`: boolean indicating if all results have been returned
*   `metadata`: Object containing metadata about the fields in the result set

The metadata object contains information about each field on the result set:

| Field Name | Field Type | Description |
| --- | --- | --- |
| type | string | SQL data type of the field |
| placeInOrder | integer | Position of the field on the result set |
| typeCode | integer | Numeric code representing the SQL data type |

*   Use the `done` flag to determine if more results are available
*   When `done` is false, use the `nextBatchId` to retrieve the next set of records
*   All queries are executed synchronously
*   The API supports cursor-based pagination via `nextBatchId`
*   You must fetch the complete result set within one hour
*   The time interval between batch calls must not exceed three minutes

*   [Query Services Status Codes](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/c360a-api-queryservices-statuscodes.html)
*   [Data Cloud Query Guide](https://developer.salesforce.com/docs/data/data-cloud-query-guide/guide/query-guide-get-started.html)


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
