ForHosting KIT · Documents & PDF

Delete pages from a PDF

The Delete PDF Pages API takes a source document and a list of the pages you want gone, then returns a rebuilt PDF with exactly those pages removed and everything else untouched. It is a single POST that handles the messy parts for you: page indexing, ranges, reverse counting from the end, and preserving the document's structure. Use it when a blank scan, a cover sheet, a signature block, or a confidential appendix needs to disappear before a file moves on.

● StablePer request + per page$0.002
Use it from WebAPIEmailApp soonTelegram soon

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 problem it removes

Almost every automated document pipeline eventually hits a PDF that carries pages nobody downstream should see: a scanned separator sheet between batches, a duplicated cover, an internal approval page, or the boilerplate terms that bloat an invoice. Doing this by hand does not scale past the first few files, and most code libraries force you to bundle a heavy PDF engine into your own service and babysit its memory. This endpoint exists so that removing pages becomes one call with a predictable price. It is built for developers automating contract flows, accounting teams cleaning supplier documents, and anyone who receives PDFs they did not generate and cannot fully control.

How the call behaves

You POST to /pdf/remove-pages with the document and the pages to delete, and you immediately receive a task_id rather than waiting on an open connection. The work runs on our global edge and the finished file is delivered two ways: a signed webhook you register (recommended, because your system reacts the moment the result is ready) or a signed link that stays valid for 24 hours if you prefer to pull. Page numbers are one-based, you can pass individual pages and ranges together, and negative indexes count from the last page so removing the final sheet never requires you to know the total first.

What stays intact

PDF has been the fixed-layout standard since Adobe released it in 1993 and handed it to ISO in 2008, and that longevity is why files accumulate cruft: they pass through scanners, mail merges, and export tools that each staple on their own pages. When we drop pages we rebuild the document rather than blank the content, so the output is genuinely smaller and the deleted pages leave no recoverable residue. Existing bookmarks and embedded fonts on the pages you keep are carried over, so any downstream reader sees a normal, well-formed PDF.

Fitting it into automation

Because the response is a task_id and the result arrives by webhook, this slots cleanly between other steps without blocking a worker. A common shape is: split a document, decide which pages are noise, call this endpoint, then forward the trimmed file to storage or e-signature. There is no free tier; access needs prepaid balance, and a call without it returns 402. That gate keeps the queue fast and free of abuse for the people building on it. You are billed per page at a published $0.002 per request, a failed task is never charged, and inputs and outputs are deleted after the retention window and never used to train anything.

Strip scanner separator sheets

High-volume scanning workflows insert blank or barcode separator pages between documents. After splitting a batch, call the API to remove those markers so archived files contain only real content.

Redact an appendix before sharing

A proposal PDF carries an internal cost breakdown on its last three pages. Remove them programmatically before the version goes out to the client, without opening an editor.

Clean invoices for accounting import

Supplier invoices often arrive padded with terms-and-conditions pages that break OCR line-item extraction. Delete those pages first so your accounting system ingests only the invoice itself.

Drop cover and signature sheets

Signed contracts come back with an added cover letter and a standalone signature page. Trim them to keep a tidy, uniform archive across thousands of agreements.

How do I delete pages from a PDF with an API?

POST your file and a list of page numbers to /pdf/remove-pages. You get a task_id back, and the rebuilt PDF arrives by signed webhook or a 24-hour signed link. Page numbers are one-based and you can mix single pages with ranges.

Is the delete pages from PDF 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 remove a range of pages in one call?

Yes. You can pass individual pages and ranges together in the same request, so deleting pages 2, 5 and 7 through 12 at once is a single call rather than several.

How do I delete the last page without knowing the page count?

Use a negative index. Negative page numbers count from the end, so -1 targets the final page regardless of how long the document is.

Does removing pages change the rest of the document?

No. The pages you keep retain their content, embedded fonts, and bookmarks. We rebuild the file around the remaining pages, so the output is a smaller, well-formed PDF.

Can the deleted pages be recovered from the output?

No. The document is rebuilt without the removed pages rather than merely hidden, so there is no leftover data for them in the resulting file.

Can I process PDFs in bulk?

Yes. Each document is one asynchronous request returning a task_id, so you can fire many in parallel and let the webhooks report each result as it finishes without holding connections open.

What happens to my file after processing?

Inputs and outputs are deleted after the retention window and are never used to train anything. Results are delivered only over signed webhooks or signed links that expire in 24 hours.

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.

POSThttps://api.kit.forhosting.com/pdf/remove-pages

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.

curl -X POST https://api.kit.forhosting.com/pdf/remove-pages \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pdf":"https://ejemplo.com/documento.pdf"}'
{
  "pdf": "https://ejemplo.com/documento.pdf"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "pdf.remove_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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb25
max_pages200
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.
413input_too_largeThe file exceeds the size limit.

Read the full KIT documentation →