> ## Documentation Index
> Fetch the complete documentation index at: https://developer.pdf.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Compress PDF

> This operation allows you to compress/reduce the size of your PDF files while maintaining the quality.

<img src="https://mintcdn.com/pdfco/tXGo3rbTS_pEF5es/images/integrations/n8n/compress-pdf.png?fit=max&auto=format&n=tXGo3rbTS_pEF5es&q=85&s=ab6cec161484694cbf12407733e9960d" alt="Compress Pdf Pn" width="888" height="860" data-path="images/integrations/n8n/compress-pdf.png" />

## Input

| Name | Description | Required |
| :- | :- | :- |
| PDF URL | Provide the URL to the source PDF document, or a `filetoken://` link from [PDF.co Built-In Files Storage](https://app.pdf.co/tools/files). If you use another cloud service such as **Google Drive** or **Dropbox** ensure the link is publicly accessible. | Yes |
| File Name | File name for the generated output, the input must be in string format. | No |
| Webhook URL | The callback URL or Webhook used to receive the output data. | No |
| Password | The password of the password-protected PDF file | No |
| HTTP Username | HTTP auth user name if required to access source URL. | No |
| HTTP Password | HTTP auth password if required to access source URL. | No |
| Custom Compression Configuration | [**Configuration options**](https://developer.pdf.co/api/pdf-compress#config). By default this object is pre-defined to give typical options for optimization. | No |

## Custom Compression Configuration

The `config` object defines granular settings for the compression process. By default, this `config` object is set to match the standard configuration for image optimization by Adobe Acrobat Pro and is defined as follows:

```json theme={null}
{
   "images": {
       "color": {
           "skip": false,
           "downsample": {
               "skip": false,
               "downsample_ppi": 150,
               "threshold_ppi": 225
           },
           "compression": {
               "skip": false,
               "compression_format": "jpeg",
               "compression_params": {
                   "quality": 60
               }
           }
       },
       "grayscale": {
           "skip": false,
           "downsample": {
               "skip": false,
               "downsample_ppi": 150,
               "threshold_ppi": 225
           },
           "compression": {
               "skip": false,
               "compression_format": "jpeg",
               "compression_params": {
                   "quality": 60
               }
           }
       },
       "monochrome": {
           "skip": false,
           "downsample": {
               "skip": false,
               "downsample_ppi": 300,
               "threshold_ppi": 450
           },
           "compression": {
               "skip": false,
               "compression_format": "ccitt_g4",
               "compression_params": {}
           }
       }
   },
   "save": {
       "garbage": 4
   }
}
```

Refer to this [guide for more details](https://developer.pdf.co/api/pdf-compress#config) on the config object.

## Output

| Name | Description |
| :- | :- |
| `jobId` | Unique identifier for the background job. |
| `pageCount` | Number of pages in the PDF document. |
| `error` | Indicates whether an error occurred (`false` means success) |
| `status` | Status code of the request (200, 404, 500, etc.). For more information, see [**Response Codes**](/api/response-codes). |
| `credits` | Number of credits consumed by the request |
| `remainingCredits` | Number of credits remaining in the account |
| `duration` | Time taken for the operation in milliseconds |
| `url` | Direct URL to the final PDF file stored in S3. |
| `name` | Name of the output file |
| `outputLinkValidTill` | Timestamp indicating when the output link will expire |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.