Skip to main content
POST
/
v2
/
pdf
/
compress
PDF Compress
curl --request POST \
  --url https://api.pdf.co/v2/pdf/compress \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "url": "<string>",
  "async": true,
  "name": "<string>",
  "config": {
    "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
    }
  }
}'

Authorizations

x-api-key
string
header
required

Body

application/json
url
string<uri>
default:https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-compress/sample.pdf
required

URL to the source file url attribute.

async
boolean
default:false

Set async to true for long processes to run in the background, API will then return a jobId which you can use with the Background Job Check endpoint. Also see Webhooks & Callbacks

name
string

File name for generated output.

config
object

For more information, see the PDF Compress Configuration options.