Add page numbers to a PDF
A hundred-page document with no page numbers is a small daily frustration multiplied across every reader who has to say 'go to the page with the chart' instead of 'page 42.' This endpoint adds numbering to every page of a PDF automatically, in whatever position and format the document calls for.
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.
A detail nobody notices until it's missing
Page numbers are one of those things readers only consciously register by their absence — trying to reference a specific page on a call, cite a section in a review, or find your place again after closing a long PDF. Documents assembled by merging several PDFs together are especially prone to missing or inconsistent numbering, since each source file may have had its own scheme or none at all. This endpoint fixes that in one pass, applied uniformly across the final file.
What the numbering actually offers
You control where the numbers sit — bottom center, bottom corner, top of the page — what they look like, whether they read as a bare number or a pattern like 'Page 3 of 40', and where counting starts, which matters when a cover page or table of contents shouldn't be counted as page one. The numbers are written directly into the page content, so they display consistently across every PDF viewer and survive printing.
How the call is made
POST the PDF along with your position, format and starting-number preferences to /pdf/page-numbers. It's processed asynchronously: a task_id comes back right away, and the numbered PDF is delivered to your signed webhook when it's ready, or made available at a signed link valid for 24 hours.
Its place in a bigger document flow
This step almost always follows something else — merging PDFs, generating a report, or assembling a packet from several source documents — and precedes final delivery. Running it as the last step in a document-assembly pipeline guarantees the final page count and numbering are always correct, even when the number of merged sections changes from run to run.
Cost and reliability
It's a flat $0.002 per request no matter how many pages get numbered, so numbering a 5-page memo and a 500-page manual are billed the same predictable rate. If the task can't complete after its automatic retries, you're never charged for it.
What you can do with it
Merged document packets
Several PDFs get combined into one packet for a filing or a board meeting; this endpoint applies consistent numbering across the whole merged file.
Long reports and manuals
A generated report runs dozens of pages; adding 'Page X of Y' numbering makes it navigable and citable for readers and reviewers.
Legal and academic submissions
Court filings and academic papers often require specific page numbering conventions before submission, applied automatically at export time.
Printed handouts and booklets
A PDF destined for print needs numbering so pages stay in order and are easy to reference after collating.
FAQ
How do I add page numbers to a PDF via API?
Send the PDF and your formatting preferences to /pdf/page-numbers in a POST request, and the numbered file returns via webhook or a signed link.
Can I choose where the page numbers appear?
Yes, you can set the position — such as bottom center or a top or bottom corner — to match the document's existing layout.
Can numbering start from a page other than one?
Yes, you can set the starting number, which is useful when a cover page or table of contents shouldn't count toward the numbering.
Does it support formats like 'Page 3 of 40'?
Yes, you can choose a bare number or a pattern that includes the total page count alongside the current one.
Is adding page numbers 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.
Will the numbers show up correctly in every PDF viewer?
Yes, since the numbers are written into the page content itself rather than relying on viewer-specific features.
Can I number a batch of PDFs at once?
Submit one task per document; each is billed and processed independently for predictable, linear scaling.
What happens if the page-numbering task fails?
It retries automatically up to three times, and if it still doesn't succeed you get a clear error with no charge.
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/page-numbers \
-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/page-numbers", {
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/page-numbers",
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/page-numbers", 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/page-numbers", 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.page_numbers",
"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. |