---
schema_version: "1"
id: 3b856098b80ec68485fb006bd7003f9f9938e26fad98c8d20feef8ed5907efab
title: Use Compression for Bulk API 2.0 Query Responses
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/api-asynch/guides/api-bulk-v2/bulk-query/query-compression.md
canonical_url: https://developer.salesforce.com/docs/platform/api-asynch/guide/query-compression.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d5c8f308e953351d9782b40862732f147e51c9dc1e95055ed58af7f32fe26f89
products:
  - Bulk API 2.0 and Bulk API Developer Guide
  - Platform Developer Content
---

# Use Compression for Bulk API 2.0 Query Responses

For query jobs, Bulk API 2.0 can compress the _response body_, which reduces network traffic and improves response time.

**tip:** If encoding is enabled for Bulk API 2.0 Query job responses, there is a significant improvement in performance of query result downloads. This not the total query time, but a reduction in the time to download the results.

Responses are compressed if the client makes a request using the `Accept-Encoding` header, with a value of `gzip`. Bulk API 2.0 compresses the response in gzip format and sends the response to the client with a `Content-Encoding: gzip` _response_ header. If a request is made using the `Accept-Encoding` header with a value other than `gzip`, the encoding type is ignored, and the response isn’t compressed.

As an example, if a [Get Results for a Query Job](https://developer.salesforce.com/docs/platform/api-asynch/guide/query-get-job-results.md) request is made with the `Accept-Encoding: gzip` header, the response looks something like:

```nolang
HTTP/1.1 200 OK
Date: Tue, 09 Oct 2012 18:36:45 GMT
Content-Type: text/csv; charset=UTF-8
Content-Encoding: gzip
Transfer-Encoding: chunked

...compressed response body...
```

Bulk API 2.0 follows the HTTP 1.1 standards for response compression, as described in [Using Compression](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_compression.htm). Most clients automatically support compressed responses. Even though you request a compressed response, the REST framework sometimes doesn’t send back the response in a compressed format. See the [REST API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/quickstart_using_other_tools.htm).
