Reorder PDF pages
The Reorder PDF Pages API takes an existing document and a target page sequence, then returns a new PDF with the pages arranged exactly the way you asked. It is a precise, deterministic operation for teams who need to fix scan order, interleave sections, or normalize document structure without ever opening a desktop editor.
Run it online
Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.
The exact problem it solves
Documents rarely arrive in the order you need them. A duplex scanner drops odd pages first and even pages last; a merge step concatenates chapters out of sequence; a signed contract comes back with the signature sheet stapled to the front. Fixing that by hand is tedious and does not scale past a handful of files. This API accepts your PDF and an explicit list of page numbers describing the order you want, and it produces a fresh document that follows that list to the letter. If your input has ten pages and you send the sequence you need, every page lands where you specified, with nothing added and nothing silently dropped.
How the call behaves
You POST to /pdf/reorder-pages with the source file and your desired page order. Because reordering large or password-protected documents can take real time, the endpoint is asynchronous: it validates the request and immediately returns a task_id. When the work finishes, the result is pushed to your signed webhook, or you can retrieve it from a signed link that stays valid for twenty-four hours. The page order you submit is honored precisely, so you can duplicate a page by listing it twice or drop one by omitting it. Bookmarks, form fields, and embedded content ride along with their pages rather than being flattened away.
A note on the format
PDF has carried an internal page tree since its earliest versions, which is why rearranging pages is a structural edit rather than a re-render: the visual content of each page is untouched, and only the ordering references change. That is exactly what makes a programmatic reorder safe. Text stays selectable, vector graphics stay crisp, and file size barely moves because nothing is rasterized. You get the same pages you started with, walking in a different line.
Fitting it into automation
This task is designed to be one link in a chain. A common pattern is to split a batch scan, reorder it into logical sections, then merge or stamp the result, all driven by webhooks so no worker sits polling. Access requires prepaid balance, which is what keeps the queue fast and free of abuse; a request without funds returns a clear 402 instead of quietly failing. Every call costs a published $0.002, a failed task is retried three times with backoff and is never billed, and your files are deleted after the retention window and never used to train anything.
What you can do with it
Fix duplex scan order
A back-office team scans double-sided contracts on a simplex feeder, leaving all odd pages first and all even pages reversed at the end. A single reorder call interleaves them back into reading order before the file goes to archival.
Move signature sheets to the back
An e-signing workflow returns documents with the certificate and signature page appended in a spot that breaks the layout. Automatically reorder each returned PDF so the signed exhibits sit exactly where legal review expects them.
Assemble reports from templates
A reporting service generates cover, summary, and appendix sections separately and stitches them together, but the generator emits them in creation order. Reordering enforces the canonical section sequence before the report is delivered to the client.
Repair OCR pipeline output
A digitization pipeline occasionally shuffles pages when parallel workers finish out of order. A deterministic reorder step, keyed to a known page map, guarantees the final document reads front to back every time.
FAQ
How do I reorder PDF pages with an API?
Send a POST to /pdf/reorder-pages with your source file and an array describing the page order you want. The reorder pdf pages API returns a task_id, and the finished document arrives by signed webhook or a signed link.
Is the reorder PDF pages API free?
There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.
Can I duplicate or remove pages while reordering?
Yes. The output follows your page list exactly, so listing a page twice duplicates it and omitting a page drops it. This makes reorder a flexible one-call way to reshape a document.
Does reordering reduce the quality of the PDF?
No. Reordering changes only the page ordering references, not the page content, so text stays selectable and vector graphics stay sharp. Nothing is rasterized or re-rendered.
Can I reorder pages in bulk?
Yes. Each document is a separate async task with its own task_id, so you can fan out thousands of files in parallel and receive each result by webhook as it completes.
What happens to bookmarks and form fields?
They travel with their pages. Interactive form fields and per-page bookmarks stay attached to the content they belong to rather than being flattened during the reorder.
How long is the result available?
The signed link stays valid for twenty-four hours, and we recommend the signed webhook for hands-off pipelines. After the retention window your files are deleted and never used for training.
What if I send an invalid page number?
The request is validated up front and rejected with a clear error before any billing occurs. A task that fails during processing is retried three times with backoff and, if it still fails, is never charged.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/pdf/reorder-pages \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"pdf":"https://ejemplo.com/documento.pdf"}'const res = await fetch("https://api.kit.forhosting.com/pdf/reorder-pages", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"pdf": "https://ejemplo.com/documento.pdf"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/pdf/reorder-pages",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"pdf": "https://ejemplo.com/documento.pdf"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/pdf/reorder-pages", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"pdf":"https://ejemplo.com/documento.pdf"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"pdf":"https://ejemplo.com/documento.pdf"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/pdf/reorder-pages", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"pdf": "https://ejemplo.com/documento.pdf"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "pdf.reorder_pages",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 25 |
max_pages | 200 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
413 | input_too_large | The file exceeds the size limit. |