How to add page numbers to a PDF with an API

Updated 2026-11-10

Use when a PDF needs page numbers added, for example after merging files. Add output=url for a 24 h link.

From an MCP client, add https://tanod.dev/mcp and call pdf_page_numbers; its free daily calls are applied automatically, no key or signup.

POST a PDF to /v1/pdf/page-numbers. It returns the PDF with a number stamped on each page in the format you choose, such as Page {n} of {N}.

Request

format uses {n} for this page's number and {N} for the last (default {n} / {N}). Optional: position (6 choices, default bottom-center), font, font_size (10), color, opacity, margin, start_number and pages; 2- skips a cover, and numbering counts the stamped pages.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/pdf/page-numbers \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf", "format": "Page {n} of {N}"}'

The file comes back as base64 in the JSON. To save it, pipe the response through jq and base64:

save the result to a file
curl -s -X POST https://tanod.dev/v1/pdf/page-numbers \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf", "format": "Page {n} of {N}"}' \
  | jq -r '.file.data_base64' | base64 -d > numbered.pdf

Response

Response (example from the API spec, trimmed)
{
  "operation": "page-numbers",
  "input_bytes": 140815,
  "input_pages": 6,
  "numbered_pages": 6,
  "first_number": 1,
  "last_number": 6,
  "file": {
    "name": "numbered.pdf",
    "content_type": "application/pdf",
    "bytes": 91519,
    "pages": 6,
    "data_base64": "JVBERi0xLjcKJb/3"
  },
  "output_bytes": 91519,
  "active_content_removed": {
    "javascript": 1,
    "xfa": 1
  },
  "untrusted_content": true
}

Limits and caveats

Paying by card instead? The same PDF operations run as an Apify actor, PDF Toolkit (tanod/pdf-toolkit), billed through your Apify account at USD 0.01 per PDF processed (merge, split, extract or remove pages, rotate, watermark, page numbers, protect or unlock; a merge of up to 20 PDFs counts once) or USD 0.015 per PDF compressed, plus Apify's small start fee per run. Failed PDFs and invalid links are free.

With pages set to 2-, the first stamped page is numbered start_number, not 2. Use start_number to match your own scheme.

Numbers are drawn as text over the page, so they can overlap content near the margin; adjust margin or position.

JavaScript, launch and submit actions, embedded files and XFA forms are always stripped from the output and counted in active_content_removed. Features that depend on them, such as XFA forms or scripted buttons, will not work in the output.

Encrypted input is a 422 pdf_encrypted; unlock it first.

Doing this by hand? Use the free PDF page numberer in your browser.

Add "output": "url" to the request and the file is stored for 24 hours and returned as a link (url, expires_at, sha256) instead of base64, which keeps it out of your context window. The price is the same. How the links work.

Price and free allowance

USD 0.005 per call, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum with x402. 3 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared by merge, split, extract and remove pages, rotate, watermark, page numbers, protect, unlock and metadata. MCP tool: pdf_page_numbers at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/docs?via=pdf-page-numbers-api as a custom connector (steps), then ask in plain words, for example "Add page numbers to the bottom of this PDF." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.

Related guides: How to add a text watermark to a PDF with an API, How to merge PDF files with an API, How to split a PDF into separate files with an API. Back to tanod.dev or the guide index. Results are automated and heuristic.