POST request that optimizes a PDF file and returns a download URL for the resulting file.
Optimize a PDF
The Optimize method of the Transformations endpoint restructures a PDF and applies image downsampling according to a chosen profile, producing an output tailored to a specific use case (such as web viewing, printing, or archiving). Run the following curl command to optimize a PDF. Replace the<access_token> placeholder with a valid access token, either generated via code or extracted from your browser’s Application tab in the dev tools. Replace /path/to/your-file.pdf with the path to a local PDF file.
Request
params.profile field selects a predefined optimization profile:
web— Linearizes the PDF for fast web delivery and downsamples images to screen resolution. Best for online viewing and email attachments.print— Preserves print-resolution images and optimizes for fidelity over size. Best for high-quality printing.archive— Converts to PDF/A, embedding all fonts and color profiles. Best for long-term storage and compliance.minimal-file-size— Aggressively downsamples images and removes redundant data to produce the smallest possible file. Best when size reduction is the priority.mixed-raster-content— Applies MRC compression, separating text and background layers. Best for scanned documents and pages mixing text and images.
Response
Below is an example response. Theresult.file.URL field contains a time-limited, pre-signed link to download the optimized PDF.
Response types
200 Success
Successful request. The response contains a pre-signed URL to download the optimized PDF along with its content type and metadata (file size and page count).
401 Unauthorized
If your access token is expired or invalid, you will receive a 401 Unauthorized response. If this happens, renew your access token and try again.
If you continue getting the error after renewing the token, check the validity of the client_secret key that generated it.
413 Content Too Large
The uploaded file exceeds the 25 MB or 200-page limit. Split the PDF into smaller parts and retry.