Rotate PDF Pages

Endpoint #

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

Action #

action=rotate

Description #

The Rotate PDF Pages action rotates selected pages of a PDF document using the H2I engine (PixLab).

This action is part of the public /v1/pdf API surface. It accepts a source PDF, applies page rotation to the selected pages, and returns an updated PDF output through a signed URL under the public PDF output path. It is suitable for correcting page orientation in scanned or incorrectly oriented documents.

Common uses include:

  • fixing scanned documents
  • normalizing page orientation
  • preparing documents for viewing or printing

Request Format #

Requests to /v1/pdf must use:

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

For non-merge PDF actions, the first uploaded PDF file is used as the primary input. This applies to action=rotate.

Parameters #

action #

Type: string
Required: Yes
Accepted value: rotate

Specifies that the request should rotate pages in the 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

degrees #

Type: integer
Required: No
Default: 90

Defines the rotation angle applied to selected pages.

Behavior:

  • parsed as an integer
  • rounded to the nearest multiple of 90
  • normalized before applying rotation

Common effective values:

  • 0
  • 90
  • 180
  • 270

pages #

Type: string
Required: No
Default: all

Specifies which pages should be rotated.

Supported forms:

  • all
  • first
  • single page such as 1
  • multiple pages such as 1,3,5
  • ranges such as 2-6

Values are parsed and clamped to the document page count.

Supported Parameters #

The Rotate PDF Pages action supports the following public parameters:

ParameterDescription
actionMust be rotate
filesSource PDF upload
degreesRotation angle
pagesTarget pages

These are the documented public parameters for /v1/pdf action=rotate.

Full cURL Example #

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

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

  • action=rotate
  • source PDF upload in files
  • degrees
  • pages
  • optional idempotency header

Success Response #

Successful /v1/pdf requests return either a single output object or a results array, depending on the action. For public documentation, action=rotate is safest documented as a single generated PDF output returned through a signed URL. PDF output URLs are served under /pdf/<file>.

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

Response Fields #

url #

Signed output URL for the generated rotated PDF. PDF outputs are served under the public /pdf/<file> 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 or PDF page limit 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. Both Idempotency-Key and X-Idempotency-Key are accepted.

Rotation is applied only to the selected pages.

If pages is omitted, the default selector is all.

degrees is rounded to the nearest multiple of 90 and normalized before the rotation is applied.

Output files are returned through signed URLs. Applications that need long-term storage should store generated files externally rather than treating output URLs as permanent hosting.

Was it helpful ?
Scroll to Top