Technical guides
Compression
The HLC API supports gzip and deflate compression to reduce response payload sizes and improve transfer speeds for bandwidth-constrained clients.
When to Enable Compression
Compression is recommended for:
- Large catalog queries returning hundreds of products
- Bulk inventory snapshots
- Mobile applications with limited bandwidth
- High-latency network environments
Typical compression ratios: JSON responses compress to 15-25% of original size with gzip.
Implementation
Requesting Compressed Responses
Include the Accept-Encoding header to enable compression:
const apiUrl = 'https://api.hlc.bike/us/v3.0'
const apiKey = process.env.HLC_API_KEY
const response = await fetch(`${apiUrl}/Catalog/Products`, {
headers: {
ApiKey: apiKey,
'Accept-Encoding': 'gzip, deflate',
language: 'en',
},
})
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
}
const products = await response.json()
console.log(`Received ${products.length} products`)
Environment Compatibility
Modern browsers automatically handle compression and ignore custom Accept-Encoding headers. Node.js, Deno, and server runtimes respect this header and decompress responses automatically.