# Compression

### Supported Algorithms

* **gzip** - Widely supported, good general-purpose compression
* **deflate** - Lightweight compression with broad compatibility
* **brotli** - Modern algorithm with excellent compression ratio
* **zstd** - Recommended for best overall performance

### Using Compression

#### Request Compression

Set the `Content-Encoding` header with your chosen algorithm:

```
Content-Encoding: zstd
```

#### Response Compression

Set the `Accept-Encoding` header in your request:

```
Accept-Encoding: zstd, br, gzip
```

### Recommendations

* **Best Performance**: zstd provides the optimal balance of compression ratio and speed
* **Highest Compatibility**: gzip is supported by virtually all HTTP clients

### SDK Support

* **Go SDK (v1.7.2+)**: Uses zstd compression by default
* **Python/JavaScript SDKs**: Use gzip compression by default

### Performance Comparison

| Algorithm | Speed  | Compression Ratio | Use Case                     |
| --------- | ------ | ----------------- | ---------------------------- |
| zstd      | Fast   | Very good         | Recommended for most cases   |
| brotli    | Slow   | Excellent         | When bandwidth is limited    |
| gzip      | Medium | Good              | When compatibility is needed |
| deflate   | Medium | Fair              | Lightweight option           |

For implementation help, contact our support team.
