API Freaks logoAPI Freaks logo
CTRL+K

    APIs

  • Pricing
  • Resources
  • Tools

  • Contact us
CTRL+K
Sign InGet Started For Free
  • Overview
  • Documentation
  • How to Guides
  • Pricing
  • APIFreaks
  • Organization and Teams
  • Credits Usage API
  • IP Geolocation Lookup
  • Bulk IP Geolocation Lookup
  • Domain WHOIS Lookup
  • IP WHOIS Lookup
  • ASN Lookup
  • Domain WHOIS Historical Lookup
  • Domain WHOIS Reverse Lookup
  • Bulk Domain WHOIS Lookup
  • DNS Lookup
  • Historical DNS Lookup
  • Reverse DNS Lookup
  • Bulk DNS Lookup
  • Email Checker API
  • SSL Certificate Lookup
  • Domain Availability
  • Bulk Domain Availability API
  • Website Screenshot
  • Bulk Screenshot
  • PDF Merge
  • PDF Delete Pages
  • PDF Split & Extract Pages
  • PDF Rotate
  • PDF Compress
  • PDF Linearize
  • PDF Protect
  • PDF Unlock
  • PDF to Image
  • Currencies Exchange Rates
  • Currency Converter
  • Currency Time Series
  • Currency Fluctuation
  • Geolocalized Currency Converter
  • Live Commodity Prices
  • Commodity Historical Prices
  • Commodity Fluctuation
  • Commodity Time Series
  • IBAN Validation
  • SWIFT/BIC Code Lookup & Finder
  • ZIP Code API
  • ZIP Code Search Inside Radius
  • ZIP Code Distance API
  • ZIP Code Search By City
  • Live Weather API
  • Weather Forecast API
  • Historical Weather API
  • Air Quality API
  • Marine Weather API
  • Flood Forecast API
  • Timezone Lookup
  • Timezone Converter
  • User Agent Parser
  • Bulk User Agent Parser
  • Astronomy API

PDF Split & Extract Page API

Our PDF Split and Extract Pages API enables you to divide PDF files into multiple documents or pull specific pages through simple REST endpoints. Whether you're splitting a hundred-page report into chapters, extracting key pages from contracts, or separating invoices into individual pages, our API handles it all while maintaining the original quality. Define custom page ranges, use special keywords like “even” or “odd”, or extract exactly the pages you need in a single request. The API preserves all fonts, images, formatting, and document structure without compression or quality loss.

Perfect for document management systems, invoice processing platforms, legal document automation, and content management solutions. Separate bulk scanned documents into individual files, extract signature pages from contracts, divide multi-page invoices for accounting systems, or pull specific chapters from reports. With asynchronous request processing and webhook support, you can seamlessly integrate PDF operations into your automation pipelines.

10K Free Credits, No Credit Card Required

Features

Asynchronous Processing

Upon successful request, our API immediately returns a 200 OK response with a unique Task ID, processing your file in the background. You can track the task progress via our Task Status API using the unique Task ID.

Webhook Notifications

If you don't want to poll for task status, you can simply provide the webhook data in your request. Instead of manually checking status, we will automatically notify your endpoint the moment the task processing is completed.

Zero Data Retention

Your privacy matters. When you set the destroy parameter, your files are permanently wiped from our servers immediately after processing finishes, ensuring complete data security. If destroy is not set, files are retained up to 30 days based on user's plan.

Custom Page Splitting

Split documents exactly where you need. Define multiple custom page ranges (e.g., "1-5", "10-15") in a single request to generate specific sub-documents instantly. Each range creates its own PDF file from your source document.

Flexible Page Extraction

Extract only the pages you need from any PDF. Pull specific pages or ranges from a master file and save them as a new, clean PDF document. Perfect for creating subsets of large documents or isolating important sections.

Advanced Page Range Selection

Split PDFs or extract pages using individual numbers, ranges, or special keywords. Use "even" for even pages, "odd" for odd pages, "all" to split every page, or "last" to reference the final page. Mix page numbers and ranges in any order like "1-5,10,15-last" for complete control.

Split PDF into Individual Pages

Break PDF files into single pages effortlessly. Use the "all" keyword to split PDF into individual pages or extract custom page ranges as separate files. Perfect for processing bulk scanned documents or separating multi-page files.

Batch Page Processing

Extract multiple non-consecutive pages or different sections in a single API call. Process complex patterns like "1,5,10-15,20,25-last" efficiently without making multiple requests. Perfect for automated document workflows.

No Quality Loss

We keep your original document's quality. All things like fonts, pictures, and vector graphics, and the look do not change from original file. No compressing, downgrading, and you do not lose quality.

Large File Support

Handle heavy documents and high-resolution assets with ease. Our API supports a massive 1GB payload size per request, allowing you to process even the largest PDF files without worrying about size restrictions.

Free Web Tool

Need to quickly split PDF files in browser?

Split or extract PDF pages instantly in your browser. No installation required.

Try Now

Documentation

Split PDF API

API Endpoint

POST

https://api.apifreaks.com/v1.0/pdf/split

Test
LANGUAGE
Python
PHP
Java
Node
Ruby
JavaScript
C#
$ pip install requests

API Request

File Upload

File uploads must use multipart/form-data format. PDF API accepts a single file upload.

ParameterRequiredTypeDefaultDescription
fileNomultipart/form-data-The PDF file to process. Only used if you're uploading a file instead of using file_id.

Input Priority Rule:

If both file and file_id are provided, the multipart file upload takes priority and file_id is ignored.

Query parameters

All parameters must be included as query parameters. Any parameters sent in the form data will be ignored.

ParameterRequiredTypeDefaultDescription
file_idNoString-The unique ID of a file already present on our server. Use this instead of uploading the file again.
outputNoStringsplit_outputName of the output PDF (without extension).
destroyNoBooleanfalseIf true, we delete the input file immediately after generating the output.
pagesNoArray<String>allDefines the page numbers or ranges at which to split 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 – splits at every even-numbered page • odd – splits at every odd-numbered page • all – splits the PDF into single pages • last – represents the last page (e.g., 5-last, 10 or 1,last-2) Examples: ✓ "1,4-2,last" ✓ "odd" ✓ "all" ✗ "1,odd" (invalid) Note: Only "last" is allowed to be used with pages/ranges. Other keywords are passed on their own. Multiple pages param can be passed at once to get multiple output files.

Extract Pages API

API Endpoint

POST

https://api.apifreaks.com/v1.0/pdf/extract-pages

Test
LANGUAGE
Python
PHP
Java
Node
Ruby
JavaScript
C#
$ pip install requests

API Request

File Upload

File uploads must use multipart/form-data format. PDF API accepts a single file upload.

ParameterRequiredTypeDefaultDescription
fileNomultipart/form-data-The PDF file to process. Only used if you're uploading a file instead of using file_id.

Input Priority Rule:

If both file and file_id are provided, the multipart file upload takes priority and file_id is ignored.

Query parameters

All parameters must be included as query parameters. Any parameters sent in the form data will be ignored.

ParameterRequiredTypeDefaultDescription
file_idNoString-The unique ID of a file already present on our server. Use this instead of uploading the file again.
outputNoStringextracted_outputName of the output PDF (without extension).
destroyNoBooleanfalseIf true, we delete the input file immediately after generating the output.
separatedNoBooleanfalseIf 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.
pagesYesString-Specify 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 Support

Webhook Parameters

ParameterRequiredTypeDefaultDescription
webhook_urlNoString-The 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_notificationNoBooleanfalseIf 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.

Webhook Headers

HeaderRequiredTypeDefaultDescription
X-Webhook-AuthorizationNoString-
Custom authorization header sent with the webhook request. Format: Key:Value (e.g., Authorization:Bearer token123).

API Response

Explore detailed response fields including field names, data types, requirements, and descriptions in the interactive Response Tables below. For PDF Split API click here, and for PDF Extract Pages API click here.

Utility & Resource APIs

Use these endpoints to manage files and check task status.

Task Status API

Check real-time status and retrieve input/output file ID(s) using the unique task_id. The response includes creation and expiry timestamps to help you track result availability, along with specific error details if a task fails. Results are retained for up to 7 days, depending on the operation.
Try Task Status API

File Status API

Retrieve detailed metadata for any file using its unique file_id. Returns details including file name, size, type, and creation/deletion timestamps. Generated or uploaded files are retained up to 30 days based on user's plan, unless destroy is enabled to delete them immediately. You can use this endpoint to check if the file has expired using its file_id.
Try File Status API

File Download API

Download any file from API Freaks server using its file ID. Works for both processed PDF files and ZIP archives containing multiple output files.
Try File Download API

PDF Delete API

Permanently delete a specific file you uploaded or generated using the file ID which you no longer need.
Try PDF Delete API

Files List API

Retrieve a list of all your PDF files stored on API Freaks server, with their file names and corresponding file IDs. Organization admins and maintainers can view all files in their organization, while members see only their own.
Try Files List API

File Upload API

Upload one or multiple PDF files in a single multipart/form-data request. Each file receives a unique file_id that can be used with the PDF APIs.
Try File Upload API

Upload Binary API

Upload a single large as a raw binary stream. This method eliminates multipart boundary overhead, offering faster upload speeds for larger files. Returns a unique file_id for uses with the PDF APIs.
Try Upload Binary API

HTTP Error Codes

Split PDF API Error Codes

HTTP StatusReasons
400
Invalid PDF File: Please provide a valid PDF file. We don't support other types.
400
Missing File or ID: You must provide either a file or a file ID.
400
Invalid Parameter: The value for 'param_name' is invalid.
404
File ID Not Found: Please provide a valid file ID.
500
File Saving Exception: An unknown error occurred while saving. Try again later.
500
Internal Server Error: Internal Server Error Occurred.

Extract Pages API Error Codes

HTTP StatusReasons
400
Invalid PDF File: Please provide a valid PDF file. We don't support other types.
400
Missing File or ID: You must provide either a file or a file ID.
400
Invalid Parameter: The value for 'param_name' is invalid.
404
File ID Not Found: Please provide a valid file ID.
500
File Saving Exception: An unknown error occurred while saving. Try again later.
500
Internal Server Error: Internal Server Error Occurred.

Task Processing Error Messages

These errors might appear in the task-status response if the background job fails.

ErrorDescription
Invalid PDF File
The provided file is not a valid PDF file.
File Saving Exception
An unknown error occurred while saving the file. Try again later.
PDF Generation Exception
An unknown error occurred while generating the PDF. Try again later.
Internal Server Error
Internal Server Error Occurred.
Encrypted PDF Provided
The provided PDF file is encrypted. Please decrypt it first to perform operations.
Invalid Page Number Format
The provided page number format is invalid. Refer to the documentation for valid page number formats.
ZIP File Creation Error
An error occurred while creating the ZIP file. Please try again later.

How-To-Guides

Split PDF into Pages

Follow these steps to split PDF files using the API. The process involves uploading files, checking the task status, and downloading the result.

Step 1: Upload and Split PDF

Split PDFs into multiple documents by providing a file directly or referencing a file_id of a stored file. Define custom page ranges to break the PDF exactly where you need.

curl -X 'POST' \ 'https://api.apifreaks.com/v1.0/pdf/split?pages=1-5&pages=10-15&pages=20-last&output=split_document' \ -H 'X-apiKey: YOUR_API_KEY' \ -F 'file=@/path/to/document.pdf'
# Standard Response { "taskId": "04a06cd5-158d-4191-a45b-6f58249c599d", "inputIds": [ "7a9e4b12-f3c8-4d56-b7e1-8c2f9d0a3e6f" ] } # Response with destroy=true (No File IDs as they are deleted right away) { "taskId": "04a06cd5-158d-4191-a45b-6f58249c599d" }

Notes:

  • The API accepts only one PDF file per request (multipart file takes priority over file_id)
  • Use the Upload Binary API to significantly speed up large file uploads.
  • Multiple pages parameters create multiple output files
  • Each page range generates a separate PDF in the output
  • Use pages=all to split PDF into individual pages
  • Use the destroy=true parameter to delete input file after split completes (returns only taskId)
  • File IDs must reference valid, active files stored on the API Freaks server. You can verify if a file is still available using the File Status API

Step 2: Check Task Status

After submitting a split task, check its progress using the Task Status API with your taskId. The task goes through these statuses: queued, processing, completed, and failed.

curl -X GET "https://api.apifreaks.com/v1.0/pdf/task-status?taskId=04a06cd5-158d-4191-a45b-6f58249c599d" \ -H "X-apikey: YOUR_API_KEY"
# Response (completed) { "taskId": "04a06cd5-158d-4191-a45b-6f58249c599d", "status": "completed", "outputFileId": "9b2e7f3a-5c8d-4e1b-a6f9-0d3c8e7b2a5f", "outputFileName": "processed_document.pdf", "createdAt": "2025-01-26 10:30:00", "expiresAt": "2025-01-27 10:30:00" } # Response (failed) { "taskId": "04a06cd5-158d-4191-a45b-6f58249c599d", "status": "failed", "error": "Invalid PDF File", "message": "The provided file is not a valid PDF file.", "createdAt": "2025-01-26 10:30:00" }

Step 3: Download Split PDFs

Once the task status shows “completed”, download your split PDFs using the File Download API with the outputFileId from the task status response. When multiple page ranges are provided or separated=true is used, the output is a ZIP file containing all the PDF files.

curl -X GET "https://api.apifreaks.com/v1.0/pdf/download?fileId=9b2e7f3a-5c8d-4e1b-a6f9-0d3c8e7b2a5f" \ -H "X-apikey: YOUR_API_KEY" \ --output output.pdf

Extract Pages from PDF

Extract specific pages from a PDF by providing a file directly or referencing a file_id of a stored file. Specify custom page ranges, individual page numbers, or special keywords for flexible extraction.

Step 1: Upload and Extract Pages

Upload your PDF and specify the pages to extract. After submitting, follow the same Step 2: Check Task Status and Step 3: Download Split PDFs described above to check task status and download your extracted pages.

curl -X 'POST' \ 'https://api.apifreaks.com/v1.0/pdf/extract-pages?pages=1,5,10-15,20&output=extracted_pages' \ -H 'X-apiKey: YOUR_API_KEY' \ -F 'file=@/path/to/document.pdf'
# Standard Response { "taskId": "04a06cd5-158d-4191-a45b-6f58249c599d", "inputIds": [ "7a9e4b12-f3c8-4d56-b7e1-8c2f9d0a3e6f" ] } # Response with destroy=true (No File IDs as they are deleted right away) { "taskId": "04a06cd5-158d-4191-a45b-6f58249c599d" }

Notes:

  • The API accepts only one PDF file per request (multipart file takes priority over file_id)
  • For faster uploads of large files, Upload Binary API can be used.
  • The pages parameter is required and defines which pages to extract.
  • When separated=false (default), all extracted pages are combined into one PDF and for separated=true, each page is saved as an individual PDF in a ZIP file.
  • Extract custom PDF page ranges using any combination of numbers and ranges.
  • Use the destroy=true parameter to delete input file after extraction completes (returns only taskId).
  • File IDs must reference valid, active files stored on the API Freaks server. You can verify if a file is still available using the File Status API.

Webhook Support

Get automatic notifications when your task completes instead of polling the task status endpoint. Good for event-driven applications and real-time document processing.

Add webhook_url to your request. We'll send a POST request to this URL when the task finishes (either completed or failed).

Example Request:

curl -X 'POST' \ 'https://api.apifreaks.com/v1.0/pdf/split?webhook_url=https://yourdomain.com/webhook/pdf-split&webhook_failure_notification=true' \ -H 'X-apiKey: YOUR_API_KEY' \ -F 'file=@/path/to/document.pdf'
# Response { "taskId": "04a06cd5-158d-4191-a45b-6f58249c599d", "inputIds": [ "7a9e4b12-f3c8-4d56-b7e1-8c2f9d0a3e6f" ] }

Webhook Delivery

Webhook delivery will be attempted up to 3 times. If all retries fail and webhook_failure_notification is enabled, we'll send an email notification to the requesting user or their organization admin.

Custom Authorization Header

Use X-Webhook-Authorization to add a custom header to webhook requests for endpoint security.

Format: Key:Value

Example: If you send Authorization:Bearer token123, the webhook request will include: Authorization: Bearer token123

Example with custom authorization:

curl -X 'POST' \ 'https://api.apifreaks.com/v1.0/pdf/split?webhook_url=https://yourdomain.com/webhook/pdf-split&webhook_failure_notification=true' \ -H 'X-apiKey: YOUR_API_KEY' \ -H 'X-Webhook-Authorization: Authorization:Bearer token123' \ -F 'file=@/path/to/document.pdf'

Webhook Request Format

When your task completes, we send a POST request to your webhook_url with these headers:

HeaderDescriptionExample
Content-TypeAlways application/jsonapplication/json
X-SignatureHMAC-SHA256 signature of the request body using your API key. Use this to verify the payload is authentic.4a7d1ed414474e4033ac29ccb8653d9b
Custom Header(If provided) Your custom header from X-Webhook-AuthorizationAuthorization: Bearer token123

Webhook Response

The webhook payload contains the same response structure as the Task Status API endpoint when checked for the task ID. For a comprehensive view of the webhook response structure and detailed field descriptions, explore the interactive Response Table.

Verifying Webhook Authenticity

Use the X-Signature header to verify webhook requests actually came from API Freaks and weren't tampered with.

How the signature works:

  1. We compute an HMAC-SHA256 hash of the request body using your API key as the secret
  2. We Base64-encode the result
  3. We send this as the X-Signature header value

To verify the webhook:

  1. Take the raw payload body (JSON string exactly as received without parsing it)
  2. Compute HMAC-SHA256 of the payload using your API key as the secret
  3. Base64-encode the result of the hash
  4. Compare with the X-Signature header value

Important: Don't transform or process the raw request body before verification. Adding whitespace or other formatting creates a different signature and verification will fail.

Pricing

To use the PDF Split & Extract Pages APIs, API credits are required. Charges apply only for successful queries, defined by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits already charged will be refunded.

For each successful request, 200 credits will be charged. 1 extra credit will be charged per MB beyond 50 MB.

Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.

Price Estimation Calculator

Ready to get started?

Sign Up for Free

APIFreaks

API Catalog

  • Geolocation APIs
  • WHOIS APIs
  • DNS APIs
  • Email Validation APIs
  • SSL APIs
  • Domain APIs
  • Screenshot APIs
  • PDF APIs
  • Currency APIs
  • Commodity APIs
  • Financial APIs
  • ZIP Code APIs
  • Weather APIs
  • Timezone APIs
  • User Agent APIs
  • Other APIs

Tools Catalog

  • Code Formatters
  • Data & Query Tools
  • Text Tools
  • Email Utilities
  • DNS Tools
  • Viewers
  • Converters
  • PDF Tools

Docs

  • APIs
  • Swagger Docs

Pricing & Accounts

  • Pricing
  • Sign up
  • Sign In

Company

  • About Us
  • Resources
  • Terms
  • Privacy

Copyright © 2026

Made in Pakistan