xtract.bot
POST /api/gzip-compress

Compress arbitrary bytes into a gzip (.gz) stream over HTTP. Configurable compression level (0–9). Output is a standard RFC 1952 gzip frame any tool can decompress.

Takes any bytes (text, JSON, binary) and returns the gzip-compressed stream. The output is a standard RFC 1952 gzip frame — any tool that speaks gzip can decompress it (`gunzip`, browsers, web servers, etc.). Compression level controls the tradeoff: - `0`: stored, no compression (the fastest, no size win). - `6`: the common default — good ratio, fast. - `9`: maximum compression, slower.

Inputs

NameTypeDefaultDescription
data*fileBytes to compress.
levelnumber (0…9)6DEFLATE compression level. 0 = store-only, 9 = max.

Response

Modes: binary, json. Cache: yes (24h TTL).

Code samples

Built from the lorem example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/gzip-compress/lorem.txt
DATA=$(base64 -w0 < lorem.txt)

curl -X POST https://api.xtract.bot/api/gzip-compress \
  -H "Content-Type: application/json" \
  -H "Accept: application/octet-stream" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "level": 6,
  "data": "'"$DATA"'"
}'