Data Compression
Use of Gzip Compression by the API
Some large API responses are automatically compressed with gzip to reduce size and speed up downloads.
Accepting Gzipped Responses
Most HTTP clients and browsers support gzip by default. To ensure gzip is accepted, add the following header to your request:
Accept-Encoding: gzip
If the response is large, the server will send it gzipped.
Reading Gzipped Responses
-
Browsers: Handled automatically.
-
curl: Use
--compressed:curl --compressed https://api.example.com/data -
Code: If not automatic, check
Content-Encoding: gzip(orX-Content-Encoding: gzip) and decompress with your language's gzip/zlib library.
Small responses may not be gzipped, this is normal.
Sending Gzipped Request Data
If your request body is large (greater than 6MB), you should also compress it before sending. To do this:
-
Compress your request body using gzip.
-
Add the following header to indicate compression:
X-Content-Encoding: gzip -
Our server endpoints automatically decompress gzipped request bodies.
Example with curl:
echo '{"large":"payload"}' | gzip | \
curl \
-X POST https://api.example.com/upload \
-H 'X-Content-Encoding: gzip' \
-H 'Content-Type: application/json' \
--data-binary @-
This helps reduce upload size for large JSON or binary payloads.
You can read more about Compression in HTTP & gzip compression in the MDN Web Docs.
Appendix: Content-Encoding versus X-Content-Encoding
It is very important to use the X-Content-Encoding header and not the standard Content-Encoding, this is because AWS API Gateway will automatically decompress gzip data based on the Content-Encoding header. We want to decompress & compress your data using our own middleware instead of API Gateway, hence the "custom" header needs to be used.
Appendix: Gzip Compression Analysis
Measured on the 10 largest diverse production documents per collection (March 2026). Compression ratio = raw size / gzip size.
ClustyRequest
| Picks | Raw JSON | Gzip | Compression Ratio |
|---|---|---|---|
| 34,427 | 9.9 MB | 420.8 KB | 24x |
| 33,481 | 9.6 MB | 413.3 KB | 24x |
| 31,391 | 6.3 MB | 580.7 KB | 11x |
| 30,228 | 6.0 MB | 553.6 KB | 11x |
| 29,805 | 5.9 MB | 545.8 KB | 11x |
| 27,810 | 4.6 MB | 441.3 KB | 11x |
| 26,112 | 4.2 MB | 423.4 KB | 10x |
| 24,797 | 7.1 MB | 300.6 KB | 24x |
| 23,641 | 3.8 MB | 414.0 KB | 9x |
| 23,170 | 6.7 MB | 284.1 KB | 24x |
Average: 15x compression
RoutyRequest
| Picks | Raw JSON | Gzip | Compression Ratio |
|---|---|---|---|
| 3,717 | 689.1 KB | 22.7 KB | 30x |
| 2,406 | 502.4 KB | 17.4 KB | 29x |
| 1,515 | 281.9 KB | 24.3 KB | 12x |
| 1,059 | 141.1 KB | 11.9 KB | 12x |
| 791 | 105.4 KB | 10.0 KB | 11x |
| 684 | 91.5 KB | 8.9 KB | 10x |
| 669 | 89.3 KB | 8.9 KB | 10x |
| 668 | 89.1 KB | 8.9 KB | 10x |
| 610 | 139.8 KB | 10.0 KB | 14x |
| 609 | 81.1 KB | 7.6 KB | 11x |
Average: 17x compression
Takeaway
Gzip achieves 10-30x compression on request payloads, with an overall average of ~15x. The repetitive structure of picks arrays compresses extremely well.