Compress PDF

Endpoint #

POST https://pixlab.davix.dev/v1/pdf

Action #

action=compress

Description #

The Compress PDF action reduces the file size of a PDF document using the H2I engine (PixLab).

This action is part of the public /v1/pdf API surface and processes an uploaded PDF file into a compressed PDF output. It is suitable for workflows such as reducing document size for storage, delivery, and distribution. The generated file is returned through the public PDF output path as a signed output URL.

Request Format #

Requests to /v1/pdf must use:

  • Content-Type: multipart/form-data
  • API key authentication in request headers
  • PDF upload through the files field

For non-merge PDF actions, the route uses the first uploaded PDF file as the primary input. This applies to action=compress.

Parameters #

action #

Type: string
Required: Yes
Accepted value: compress

Specifies that the request should compress the uploaded PDF document.

files #

Type: file upload (multipart/form-data)
Required: Yes

The source PDF document.

  • uploaded through the files field
  • must be a valid PDF upload
  • for this action, the first uploaded PDF file is used as the source input

Supported Parameters #

The Compress PDF action supports the following parameters:

ParameterDescription
actionMust be compress
filesSource PDF upload

No additional public compress-specific form parameters are documented for action=compress. The public external cURL example for this action includes only the source PDF plus the optional idempotency header.

Full cURL Example #

curl -sS -X POST "https://pixlab.davix.dev/v1/pdf" \
-H "X-Api-Key: <YOUR_API_KEY>" \
-H "Idempotency-Key: pdf-compress-001" \
-F "action=compress" \
-F "files=@/path/to/document.pdf"

This example includes the full documented public parameter surface for the Compress PDF action:

  • action=compress
  • source PDF upload in files
  • optional idempotency header

The API accepts both Idempotency-Key and X-Idempotency-Key.

Success Response #

Successful /v1/pdf requests return either a single output object or a results array, depending on the action. The public PDF reference documents single-output and multi-output success patterns, but does not guarantee the exact metadata shape for every individual PDF action. For public documentation, the safest documented response example for a single-output action such as compress is a top-level signed output URL.

{
"url": "https://pixlab.davix.dev/pdf/compressed-file.pdf",
"request_id": "req_abc123"
}

Response Fields #

url #

Signed output URL for the generated compressed PDF. PDF outputs are served under the public /pdf/<file> output path.

request_id #

Request identifier returned by the API when available.

Errors #

The public /v1/pdf endpoint documents the following PDF-route errors:

  • missing_field
  • invalid_parameter
  • unsupported_media_type
  • pdf_page_limit_exceeded
  • rate_limit_exceeded
  • rate_limit_store_unavailable
  • monthly_quota_exceeded
  • server_busy
  • timeout
  • pdf_tool_failed

The shared upload/error layer can also return:

  • invalid_upload
  • file_too_large
  • too_many_files
  • total_upload_exceeded

HTTP Status Codes #

  • 400 → invalid request fields or parameters
  • 413 → upload size/count limits exceeded
  • 415 → unsupported media type
  • 429 → rate limit or monthly quota exceeded
  • 503 → timeout, rate-limit store unavailable, or server busy
  • 500 → PDF processing failure

Usage Notes #

Idempotency-Key is optional and supported for retry-safe request handling.

action=compress uses the uploaded source PDF and returns a compressed PDF output.

Output files are returned through signed URLs under the public PDF output path.

Applications that need long-term storage should store generated files externally rather than depending on output URLs as permanent storage. The platform returns generated outputs for retrieval, not long-term file hosting.

Was it helpful ?
Scroll to Top