Add headers and footers to a PDF
The PDF Header & Footer API stamps consistent running headers and footers across every page of a document — page numbers, dates, document titles, confidentiality notices, or a logo band — without you having to open, re-render, or reflow the file. You send a PDF and a small layout spec; we return the same document with clean, repeatable margins of text on each page.
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 problem it quietly solves
A finished PDF rarely arrives with the running elements a real document needs. Invoices are missing a page count, exported reports have no date stamp, legal bundles need a reference in the corner, and contracts want a discreet Confidential line at the foot. Doing this by hand is fine for one file and miserable for ten thousand. This endpoint is built for teams that generate documents programmatically — billing systems, report builders, assembly platforms — and need that finish applied uniformly, at scale, without a human in the loop.
How it works
You POST to /pdf/header-footer with the source PDF and a layout describing what goes in each region: left, center, and right slots for both the header and footer band. Text supports tokens such as the current page number, the total page count, and the date, so a single spec adapts to a five-page memo or a five-hundred-page manual. Because rendering large files takes real work, the call is asynchronous: it returns a task_id immediately, and the finished PDF arrives when it is ready.
Where headers and footers come from
Running headers and footers are one of the oldest conventions in typesetting — the folio and the running head that names the chapter predate print itself, carried over from scribes who numbered leaves by hand. PDF inherited the visual model but not the behavior: it describes fixed pages, so it has no native notion of a header that repeats or a number that increments. That gap is what this API fills, drawing the running matter onto each page while respecting the geometry already there.
Built to sit inside a pipeline
This is one task in a larger toolkit, so it composes cleanly: generate or merge a document, stamp its headers and footers here, then compress or protect it downstream. Results return through a signed webhook (recommended, since your system is notified the moment work completes) or a signed link valid for 24 hours if you would rather poll. Files live only as long as the retention window, then are deleted; nothing you send is ever used to train any model.
Pricing and reliability, plainly
Billing is per page at $0.002 per request, so a short document costs a fraction of a cent and a long one scales predictably — no tokens, no credits, no surprises. Access needs prepaid balance; a request without one returns a clean 402, which keeps the service fast and free of abuse. If a task fails, we retry three times with backoff and, if it still cannot complete, return a clear error — and you are never charged for a task that did not succeed.
What you can do with it
Page numbering across a merged bundle
A legal team merges dozens of exhibits into one filing and needs continuous 'Page X of Y' numbering plus a matter reference in the footer, applied automatically the moment the bundle is assembled.
Dated, branded financial reports
A reporting platform stamps the generation date, report title, and a small company logo into the header of every monthly statement before it is emailed to clients, so each PDF is self-identifying even when printed.
Confidentiality notices at scale
An enterprise adds a 'Confidential — Internal Use Only' line to the footer of thousands of exported documents in a single batch, keeping the disclaimer consistent across teams and templates.
Invoices with page counts
A billing system appends the invoice number and total page count to every outgoing PDF, so multi-page invoices are unambiguous and nothing gets lost between the first sheet and the last.
FAQ
How do I add a header and footer to a PDF via API?
Send a POST to /pdf/header-footer with your source PDF and a layout describing the left, center, and right slots for each band. The call returns a task_id, and the stamped PDF is delivered by webhook or signed link when it is ready.
Can I add automatic page numbers and dates?
Yes. The layout accepts tokens for the current page number, the total page count, and the date, so a single spec numbers every page correctly whether the document has five pages or five hundred.
Is there a free tier for the add header footer to PDF API?
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 put a logo or image in the header?
Yes, the header and footer bands can carry an image such as a logo alongside text in the left, center, or right slots, so you can brand every page in one pass.
Does it work for large PDFs and bulk jobs?
It does. Because the endpoint is asynchronous, large files and high volumes are handled without blocking your request; you submit each document, receive a task_id, and get notified as each one finishes.
Will adding headers overlap my existing content?
The running matter is drawn into the header and footer margins you define, on top of the existing page geometry. You control placement, so with sensible margins the stamped text sits cleanly above and below your content.
How is the finished PDF delivered?
Through a signed webhook, which we recommend because your system is notified the instant the task completes, or a signed link that remains valid for 24 hours. Files are deleted after the retention window and never used to train anything.
What happens if a task fails — am I charged?
No. A failed task is retried three times with backoff, and if it still cannot complete you receive a clear error. You are never billed for a task that did not succeed.
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/header-footer \
-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/header-footer", {
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/header-footer",
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/header-footer", 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/header-footer", 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.header_footer",
"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. |