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": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-compress/sample.pdf",
  "async": false,
  "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
    }
  }
}
'
{
  "status": "success",
  "message": "Success",
  "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/output.pdf",
  "jobId": "6YSZD3U872ZYYFEDMQCQSGEEO8YSF5WA",
  "credits": 2,
  "remainingCredits": 1480582,
  "duration": 33
}

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.

Response

Success.

status
string

Status of the API response.

Example:

"success"

message
string

Descriptive message for the response status.

Example:

"Success"

url
string<uri>

URL to the output file.

Example:

"https://pdf-temp-files.s3.us-west-2.amazonaws.com/output.pdf"

jobId
string

Unique identifier for the job.

Example:

"6YSZD3U872ZYYFEDMQCQSGEEO8YSF5WA"

credits
integer

Credits used for this operation.

Example:

2

remainingCredits
integer

Credits remaining after this operation.

Example:

1480582

duration
integer

Time taken to complete the request, in milliseconds.

Example:

33