---
title: "Compress PDF"
method: POST
path: "/pdf/compress"
tags: ["PDF"]
---

# Compress PDF

`POST /pdf/compress`

## Request

- Base URL: `https://api.filegraph.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.filegraph.ai/pdf/compress`
- Auth: API key in header `X-API-Key`

Reduce PDF file size by compressing images and removing unnecessary data.

## Compression Levels
- **low**: Minimal compression, best quality
- **medium**: Balanced compression (default)
- **high**: Maximum compression, reduced quality

## Query parameters

- `level` string

## Response `200`

Successful Response

- CompressResponse: Response for PDF compression.
  - `filename` string, required: Output filename
  - `content_type` string, required: MIME type of the file
  - `size_bytes` integer, required: File size in bytes
  - `content_base64` string, required: Base64-encoded file content
  - `input_size_bytes` integer, required: Original file size
  - `output_size_bytes` integer, required: Compressed file size
  - `compression_ratio` number, required: Compression ratio (output/input)

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/filegraph/apis/docconvert-api.md) · [All operations](https://skmtc.dev/filegraph/apis/docconvert-api/llms.txt) · [OpenAPI document](https://skmtc.dev/filegraph/apis/docconvert-api/revisions/436255c85bd4?raw)
