Rotate a PDF
Scanners feed pages in landscape, phones photograph documents in any orientation, and the PDF that lands on your desk ends up needing its neck cranked to read. This endpoint straightens it out programmatically — pick an angle, pick which pages, done.
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 sideways-page problem is more common than it should be
Anyone who has scanned a stack of mixed-orientation paperwork knows the result: half the pages read fine, half need your head tilted 90 degrees. Multi-function scanners, fax-to-PDF gateways and mobile capture apps all produce this inconsistently, and manually fixing it page by page in a desktop PDF viewer does not scale past a handful of documents. This endpoint exists specifically for that cleanup step, done in bulk, without a human touching a mouse.
What rotation actually changes
Rotating a PDF page sets its display orientation — the content itself is untouched, but the page renders turned by the angle you specify: 90, 180 or 270 degrees, clockwise. That distinction matters because it means the operation is lossless and instant relative to re-scanning: no re-OCR, no quality loss, no re-typesetting. You can rotate the whole document uniformly, or target specific pages when only some of them came in sideways.
How the call works
POST the PDF and the rotation angle (plus optional page selection) to /pdf/rotate. Like every task in this API, it runs asynchronously: you receive a task_id right away and the corrected file arrives via your signed webhook, or through a signed link that stays live for 24 hours if you'd rather fetch it on your own schedule.
Where it belongs in a workflow
This is almost never used alone — it's the quiet second step after a scan-to-PDF or fax-to-PDF pipeline, run automatically before the document is filed, OCR'd or emailed onward. Chaining it with a scanned-vs-native check first lets you rotate only what actually needs it, instead of blindly rotating every incoming file.
What it costs and doesn't cost you
It's a flat $0.002 per request regardless of page count, because rotation is a lightweight structural change rather than a rendering-heavy one. If the task fails after its automatic retries, you're not charged — the pricing reflects the actual work done, not a guess.
What you can do with it
Cleaning up scanner batches
A back-office scanner drops mixed-orientation pages into a folder; a watcher job rotates every sideways page to 0 degrees before archiving.
Fax-to-email intake
Inbound faxes convert to PDF upside down about half the time; this endpoint corrects orientation automatically before routing to the right inbox.
Mobile document capture
A field app lets staff photograph paperwork with a phone; server-side rotation fixes whatever orientation the camera happened to save.
Pre-processing before OCR
OCR accuracy drops sharply on rotated text; running rotation first ensures the recognition step gets upright pages.
FAQ
How do I rotate a PDF with the API?
Send a POST request to /pdf/rotate with the file and the desired angle — 90, 180 or 270 degrees — and you'll get the corrected PDF back via webhook or signed link.
Can I rotate only some pages, not the whole document?
Yes, you can target specific pages by number while leaving the rest of the document at its original orientation.
Does rotation reduce quality or re-run OCR?
No. It only changes the page's display orientation metadata; the underlying content, resolution and any existing text layer stay exactly as they were.
Is there a free way to try the rotate 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 rotate counter-clockwise?
Specify 270 degrees for a counter-clockwise quarter-turn, or 90 for clockwise; both are handled as standard angle values.
What if the PDF is already right-side up?
You can simply skip the call, or pair this endpoint with an orientation check beforehand so you only rotate files that actually need it.
How fast does rotation run in bulk?
Because it's a lightweight structural operation rather than a rendering job, it processes quickly even across large batches submitted as separate tasks.
What happens if a rotation task fails?
It retries automatically up to three times; if it still can't complete, you receive a clear error and are never billed for the failed attempt.
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/rotate \
-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/rotate", {
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/rotate",
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/rotate", 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/rotate", 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.rotate",
"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. |