apyhub
Back

Split PDF by Page Range API

What it does

PDF Splitter lets you send a PDF and split it by page ranges. You provide the PDF file, a semicolon-separated ranges string such as 1-3;5;7-9, and optionally check combineIntoOne if you want all selected pages returned as a single PDF.

Use it when you need to extract specific sections from a larger document without manual editing. Typical cases include separating invoice pages, pulling out chapters from reports, or generating a smaller review copy for internal workflows.

The response is a JSON object containing a files array. Each item includes the generated filename (name) and the Base64-encoded PDF content (base64). Each semicolon-separated range produces its own file. If combineIntoOne is checked, the selected pages are returned together in one PDF.

POST
Split a PDF by page ranges
https://api.eu.apyhub.com/freedailypro/split-pdf-by-page-ranges/split

QUICKSTART

GUIDE

Quickstart

Split a PDF into the page ranges you specify. Each semicolon-separated range becomes its own PDF.

curl -X POST "https://api.eu.apyhub.com/freedailypro/split-pdf-by-page-ranges/split" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.pdf" \
  -F "ranges=1-3;5;7-9"

What you'll get back

A JSON response containing a files array. Each item has the generated file's name and its Base64-encoded content in base64.

{
  "files": [
    { "name": "split_1.pdf", "base64": "JVBERi0xLjQK..." },
    { "name": "split_2.pdf", "base64": "JVBERi0xLjQK..." },
    { "name": "split_3.pdf", "base64": "JVBERi0xLjQK..." }
  ]
}

The example above returns three files, one for each of 1-3, 5 and 7-9.

TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
The PDF. Up to 20 MB.
Semicolon-separated pages or ranges, one group per output, for example 1-3;5;7-9
Check to return a single PDF with all selected pages

About this endpoint

What it does

Splits an uploaded PDF into page selections based on the page ranges provided. The response format depends on the delimiter used in ranges:

  • Comma-separated values (,) return a single PDF as a binary response.
  • Semicolon-separated values (;) return a JSON response containing a files array. Each item includes the generated filename and Base64-encoded PDF content.

Request Body

ParameterTypeMandatoryDescription
fileFile (binary)YesThe PDF file to process. Maximum size: 20 MB.
rangesStringYesPage numbers or ranges to extract. Use commas for a single PDF output, for example 1-3,5,7-9. Use semicolons for separate PDF outputs, for example 1-3;5-6.
combineIntoOneStringNoSet to true to request a single PDF containing all selected pages.

Response

The response format depends on the request.

Response fieldTypeDescription
bodyString (binary) / Object (JSON)Response body containing the generated PDF or JSON response data, depending on the request.
filesArrayList of generated files when the response is JSON.
files[].nameStringName of a generated file, for example split_1.pdf.
files[].base64StringBase64-encoded content of a generated file.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.