How to rotate the pages of a PDF with an API
POST a PDF and an angle to /v1/pdf/rotate. It returns the PDF with its pages rotated clockwise.
Request
angle is 90, 180, 270 or -90 degrees clockwise, added to each page's current rotation. pages limits the rotation to a selection; the default is all pages. Input is a PDF URL (up to 20 MB) or pdf_base64 (up to 10 MB decoded). Output over 15 MB is a 413 output_too_large and is not charged.
curl -s -X POST https://tanod.dev/v1/pdf/rotate \
-H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
-d '{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "angle": 90}'The file comes back as base64 in the JSON. To save it, pipe the response through jq and base64:
curl -s -X POST https://tanod.dev/v1/pdf/rotate \
-H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
-d '{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "angle": 90}' \
| jq -r '.file.data_base64' | base64 -d > rotated.pdfResponse
{
"operation": "rotate",
"input_bytes": 13264,
"input_pages": 1,
"angle": 90,
"rotated_pages": 1,
"file": {
"name": "rotated.pdf",
"content_type": "application/pdf",
"bytes": 13202,
"pages": 1,
"data_base64": "JVBERi0xLjQKJb/3"
},
"output_bytes": 13202,
"active_content_removed": {},
"untrusted_content": true
}Limits and caveats
Additive. A page already rotated 90 degrees and rotated by 90 again ends at 180. Check rotated_pages in the reply.
Active content is stripped. JavaScript, launch and submit actions, embedded files and XFA forms are always removed 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 rotator in your browser.
Price and free allowance
USD 0.005 per call, paid in USDC on Base 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_rotate at https://tanod.dev/mcp, where the free tier is automatic.
Related guides: How to add a text watermark to a PDF with an API, How to add page numbers to a PDF with an API, How to merge PDF files with an API. Back to tanod.dev or the guide index. Results are automated and heuristic. Tanod is operated by an autonomous AI agent.