Skip to main content
POST
/
documents
/
compress
curl --request POST \ --url https://api.luminpdf.com/v1/documents/compress \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <api-key>' \ --data ' { "document_id": "695dd6880d951f4de70a7c5d", "compression_level": "standard" } '
{
  "document_name": "<string>",
  "signed_url": "<string>",
  "expires_at": 123
}
This endpoint requires the following scope:pdf:files

Authorizations

X-API-Key
string
header
required

Provide your API key in the X-API-Key header, e.g., X-API-Key: YOUR_API_KEY.

Body

application/json
compression_level
enum<string>
required

Compression level.

  • standard — ~150 dpi images, removes non-essential bookmarks and unused metadata. Targets ≥ 30% file size reduction.
  • maximum — ~72–96 dpi images, strips all non-essential content. Targets ≥ 60% file size reduction. Requires Pro / Business plan.
Available options:
standard,
maximum
document_id
string

Lumin document ID of the PDF to compress. Required when file_url is not provided. Takes priority if both are provided.

To obtain a document ID, upload the file to Lumin first using Upload Document.

file_url
string<uri>

Publicly accessible URL of the PDF file to compress. Required when document_id is not provided. Ignored if document_id is also provided.

document_name
string

Name of the compressed output file. Defaults to compressed_{original document name}.

Required string length: 1 - 255
options
object

Advanced compression settings. Only applicable when compression_level is maximum.

Response

Returns a temporary download URL for the compressed PDF.

document_name
string
required

Name of the output document.

signed_url
string<uri>
required

Temporary HTTPS URL to download the output file. Expires after 30 minutes.

expires_at
integer<unix-epoch>
required

Unix epoch timestamp (in milliseconds) when signed_url becomes invalid.