Compression

Optimizing Performance with Compression

To improve the efficiency and performance of data transfer, we strongly encourage enabling compression when interacting with our Market Data APIs. Using compression reduces the size of the data payload, allowing for faster fetch times and better bandwidth utilization.

Our API supports the following compression methods via the Accept-Encoding header:

  • gzip (default)
  • deflate
  • br (Brotli)

❗️

Important:

Starting July 1, 2025, enabling compression via the Accept-Encoding header will become mandatory for all Market Data API requests. To ensure uninterrupted service, please enable compression now.


Why Use Compression?

  1. Faster Data Transfers: Smaller payloads reduce the time needed to fetch data, especially for endpoints returning large datasets.
  2. Efficient Bandwidth Usage: Compression minimizes data transfer costs by reducing the volume of data sent over the network.
  3. Broad Compatibility: Widely supported compression methods like gzip ensure compatibility across most HTTP clients.
  4. Future-Ready: We plan to enforce compression for all endpoints in the future. Starting now ensures you're ready for upcoming changes.

How to Enable Compression

Compression can be enabled by specifying the Accept-Encoding header in your API requests. Here’s how to do it for popular tools and programming languages:

Example: cURL

curl -H "Accept-Encoding: gzip" "https://api.amberdata.com/markets/spot/tickers"

Example: Python (Requests Library)

import requests

url = "https://api.amberdata.com/markets/spot/tickers"
headers = {"Accept-Encoding": "gzip"}
response = requests.get(url, headers=headers)

print(response.content)  # Decompressed content

Example: JavaScript (Fetch API)

fetch("https://api.amberdata.com/markets/spot/tickers", {
  headers: { "Accept-Encoding": "gzip" }
})
  .then(response => response.json())
  .then(data => console.log(data));

Example: Postman

  1. Go to the Headers tab in your request.
  2. Add Accept-Encoding as the header key and gzip as the value.
  3. Send the request and observe the compressed data being returned.

Frequently Asked Questions

What happens if I don’t enable compression before July 1, 2025?

After **July 1, 2025**, all API requests without an `Accept-Encoding` header will be rejected, and you will receive an error response. Enable compression now to avoid interruptions.

What is the recommended compression method?

We recommend using gzip, as it is widely supported and balances speed and compression ratio effectively.

Will compression impact my API usage limits?

No, enabling compression does not affect your API usage limits. It simply optimizes the data transfer process.

Does compression change the response?

No, compression does not change the structure or content of the API response. It only reduces the size of the data during transmission. Ensure your client can handle decompressed responses to benefit from faster transfers and prepare for the **July 1, 2025** requirement.


Next Steps

We highly encourage enabling compression in your API requests now to improve performance and prepare for the upcoming change.

Starting July 1, 2025, compression will become a mandatory requirement for all API requests. Ensure your systems are updated well before this date to avoid service disruptions.

If you encounter any issues while setting up compression, please contact our support team at [email protected].