---
schema_version: "1"
id: f700fdf309f8243f8651f3e9c627a805a3e650725ea5d985cc7db783f7bfdf64
title: Get SQL Query Chunks
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-query-api-reference/query-services/query-api-v3-get-chunk.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/query-api-v3-get-chunk.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d627c268049d0803289773ee4662848e9963458351dedd68971ac9186e7634f6
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# Get SQL Query Chunks

<!-- TODO: Confirm GA status of this endpoint. [256] lists chunk-based retrieval as out of scope for the first iteration; [260] includes it. Verify current availability with eng. -->

Use the `GET /api/v3/query/{queryId}/chunks/{chunkId}` endpoint of the Data 360 Query API to retrieve a specific result chunk from a completed query. Use the `chunkCount` field from the query status response to determine the available chunk IDs. Results are streamed and available in JSON or Apache Arrow format.

## Syntax

- **HTTP Method**: GET
- **Format**: REST
- **URI**: `/api/v3/query/{queryId}/chunks/{chunkId}`

## Path Parameters

| Parameter | Type    | Description                                                                                                                   |
| --------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `queryId` | string  | Required. The unique identifier of the query returned from `POST /api/v3/query`. Example: `MTAuMjcuMTgxLjE0OTo3NDg0_1cfc8d35`. |
| `chunkId` | integer | Required. The chunk index to retrieve. The index starts at 0. Use `chunkCount` from the query status response to determine the total number of available chunks.         |

## Query Parameters

| Parameter    | Required | Type    | Description                                                        |
| ------------ | -------- | ------- | ------------------------------------------------------------------ |
| `omitSchema` | No       | boolean | `true` to omit schema metadata from the response. Default `false`. |

## Request Headers

| Header          | Value                                                       |
| --------------- | ----------------------------------------------------------- |
| `Authorization` | `Bearer {accessToken}`                                      |
| `Accept`        | `application/json` or `application/vnd.apache.arrow.stream` |

## Response Structure

Results are streamed using `Transfer-Encoding: chunked`.

| Field          | Description                                                                                         |
| -------------- | --------------------------------------------------------------------------------------------------- |
| `metadata`     | Object containing column schema. Not included when `omitSchema=true`.                               |
| `data`         | Array of result rows, where each row is an array of values ordered by the `metadata.columns` schema. |
| `returnedRows` | Number of rows returned in this chunk. Arrow responses omit this field.                             |

### Apache Arrow Response

Set `Accept: application/vnd.apache.arrow.stream` to receive the chunk as a binary Arrow IPC stream instead of JSON. Arrow is recommended for large chunks.

## Examples

This example shows a chunk retrieval request and response.

### Request

```http
GET https://{dne_cdpInstanceUrl}/api/v3/query/MTAuMzAuNTkuMTA4Ojc0ODQ_c3161a23-1803-c0a0-ce4a-9d5bc19deddc/chunks/1
Authorization: Bearer {accessToken}
```

### Response

```json
{
  "metadata": {
    "columns": [
      { "name": "id__c", "type": "varchar", "nullable": false },
      { "name": "name__c", "type": "varchar", "nullable": true }
    ]
  },
  "data": [["c1ce2a48-9d03-4eed-938d-f354db79c425", "Gowtham"]],
  "returnedRows": 1
}
```

## Related Resources

- [Submit SQL Query](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/query-api-v3-post.md)
- [Get SQL Query Status](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/query-api-v3-get-query.md)
- [Get SQL Query Rows](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/query-api-v3-get-rows.md)
- [Query Services Status Codes](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/c360a-api-queryservices-statuscodes.md)
