Loading
Loading
Extract specific pages or page ranges from a PDF file and return them as a new PDF.
The PDF Extract Pages API allows you to select individual pages or ranges to create focused sub-documents from larger PDFs. You can also use keywords like even, odd, or all for batch extraction.
Pass your API key as the apiKey parameter in every request.
This is version v1.0 of the API.
The PDF Extract Pages API accepts a file upload, query parameters, and webhook headers described below.
The request body is a single optional file upload sent as multipart/form-data. All other parameters (including file_id and pages) are passed as query parameters, not in the request body.
{
"file": "/path/to/document.pdf"
}fileoptionalmultipart/form-dataThe PDF file to process.
All parameters must be included as query parameters. Any parameters sent in the form data will be ignored.
formatoptionalStringdefault: jsonResponse format: 'json' (default) or 'xml'.
file_idoptionalStringThe unique ID of a file already present on our server. Use this instead of uploading the file again.
outputoptionalStringdefault: extracted_outputName of the output PDF (without extension).
destroyoptionalBooleandefault: falseIf true, we delete the input file immediately after generating the output.
separatedoptionalBooleandefault: falseIf set to true, extracts each of the given pages as a separate PDF. Output is delivered as a ZIP file containing individual PDF files for each extracted page.
pagesrequiredStringSpecify the pages to extract from the PDF. You can provide individual page numbers and/or page ranges in any order (e.g., 1-4,9-5,16-last). Use commas ( , ) to separate entries and hyphens ( - ) for ranges. Special keywords: even - extracts all even-numbered pages, odd - extracts all odd-numbered pages, all - extracts all pages into individual files, last - represents the last page (e.g., 5-last, 10 or 1,last-2). Examples: "2,6-3" / "even" / "all" / "2,even" (invalid). Note: Only "last" is allowed to be used with pages/ranges. Other keywords are passed on their own.
webhook_urloptionalStringThe URL where we'll send the webhook notification after the task completes. Authentication parameters in the URL (e.g., ?auth=token123) are passed as-is.
webhook_failure_notificationoptionalBooleandefault: falseIf true, we'll send an email notification if the webhook request fails after 3 retries. The email goes to the requesting user or their org admin if user is part of an organization.
Optional custom headers for webhook authorization
X-Webhook-AuthorizationoptionalStringCustom authorization header sent with the webhook request. Format: Key:Value (e.g., Authorization:Bearer token123).
A successful request returns a 200 OK response with a JSON object containing the task ID and input file IDs.
taskIdUnique identifier for the PDF task, used to check status.
inputIdsArray of file IDs referencing input files used for the task. Not returned when destroy=true.
See the HTTP Status Codes documentation for a complete reference of common API errors and HTTP status codes.
Please provide a valid PDF file. Other file types are not supported.
Please provide either a file or a file ID.
Invalid parameter value provided for 'param_name'.
Please provide a valid file ID.
These errors might appear in the task-status response if the background job fails.
The provided file is not a valid PDF file.
An unknown error occurred while saving the file. Try again later.
An unknown error occurred while generating the PDF. Try again later.
Internal Server Error Occurred.
The provided PDF file is encrypted. Please decrypt it first to perform operations.
The provided page number format is invalid. Refer to the documentation for valid page number formats.
An error occurred while creating the ZIP file. Please try again later.