Skip to main content
POST
PDF Compress

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.

compression_level
enum<string>
default:medium

Preset compression profiles. When omitted, medium is applied. Presets also enable font optimization by default. config remains the final override. See PDF Compress.

Available options:
low,
medium,
high,
aggressive
color_quality
integer
default:60

JPEG quality for color and grayscale images, from 1 (smallest file, lowest quality) to 100 (highest quality). Can be used with or without compression_level.

Required range: 1 <= x <= 100
password
string

Password for the PDF file.

callback
string<uri>

The callback URL (or Webhook) used to receive the POST data. see Webhooks & Callbacks. This is only applicable when async is set to true.

expiration
number
default:60

Sets the expiration time for the output link, in minutes. After this period, generated output file(s) are automatically deleted from PDF.co Temporary Files Storage. The maximum allowed duration depends on your subscription plan. For permanent storage of input files (e.g., reusable images, PDF templates, documents), use PDF.co Built‑In Files Storage.

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