---
title: "gzip, deflate (zlib) or raw-deflate text to Base64 or hex, and decompress it back."
method: POST
path: "/api/v1/compress"
tags: ["Encoders & Decoders"]
---

# gzip, deflate (zlib) or raw-deflate text to Base64 or hex, and decompress it back.

`POST /api/v1/compress`

## Request

- Base URL: `https://programmes.net`
- URL: `https://programmes.net/api/v1/compress`
- Auth: none declared

Gzip & Deflate Compressor. Operations: `compress` — Compress UTF-8 text with gzip, deflate (zlib) or raw deflate. `decompress` — Decompress Base64 or hex gzip/deflate data back to text (output up to 256 KB).

## Request body

- union
  - CompressCompress: Compress UTF-8 text with gzip, deflate (zlib) or raw deflate.
    - `operation` 'compress', required
    - `input` string: The text to compress.
    - `options` object
      - `algorithm` 'gzip' | 'deflate' | 'deflate-raw': gzip (RFC 1952), deflate = zlib (RFC 1950) or deflate-raw (RFC 1951).
      - `encoding` 'base64' | 'hex': How the compressed bytes are written.
  - CompressDecompress: Decompress Base64 or hex gzip/deflate data back to text (output up to 256 KB).
    - `operation` 'decompress', required
    - `input` string: The compressed bytes, as Base64 or hex.
    - `options` object
      - `algorithm` 'auto' | 'gzip' | 'deflate' | 'deflate-raw': auto reads the format from the first bytes.
      - `encoding` 'base64' | 'hex': How the compressed bytes are written.

## Response `200`

The operation ran.

- object
  - `ok` unknown, required
  - `tool` 'compress', required
  - `operation` 'compress' | 'decompress', required
  - `result` unknown, required

## Other responses

- `400`: The request is not valid (https://programmes.net/api#invalid-request); The tool has no such operation (https://programmes.net/api#unknown-operation)
- `404`: No such tool (https://programmes.net/api#unknown-tool)
- `413`: The request or its input is too large (https://programmes.net/api#content-too-large)
- `415`: The body must be JSON (https://programmes.net/api#unsupported-media-type)
- `422`: An option is missing, of the wrong type or out of range (https://programmes.net/api#invalid-options); This call needs more CPU than one API call may use (https://programmes.net/api#refused); The operation could not process the input (https://programmes.net/api#tool-error)
- `429`: Too many requests (https://programmes.net/api#rate-limited)
- `500`: Internal error (https://programmes.net/api#internal-error)

---

[API](https://skmtc.dev/programmes/apis/programmes-net-api.md) · [All operations](https://skmtc.dev/programmes/apis/programmes-net-api/llms.txt) · [OpenAPI document](https://skmtc.dev/programmes/apis/programmes-net-api/revisions/aa939784a2e6?raw)
