---
title: Rotate PDF by Degrees API
slug: rotate-pdf-by-degrees
url: https://apyhub.com/sarvasoft/service/rotate-pdf-by-degrees
provider: SARVASOFT OPC PRIVATE LIMITED
categories: [Ingestion Kit, Document Intelligence Kit, Output Kit]
tags: [pdf-rotation, document-processing, page-manipulation, pdf-utils, file-transformation]
auth: api_key
version: 2.0.0
service_type: sync
endpoints: 1
atoms: 7
mcp: true
---

# Rotate PDF by Degrees API

Rotate PDF API: send a PDF by URL or Base64, rotate all pages or chosen pages by 90, 180, or 270 degrees, and get the new PDF back. Free tier, no card.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/sarvasoft/rotate-pdf-by-degrees` | What it does Rotates all pages in a PDF, or only the pages you choose. Send the PDF as a public URL… | 7 |

## Endpoint reference

### Rotate pages within a PDF

`POST https://api.eu.apyhub.com/sarvasoft/rotate-pdf-by-degrees` · 7 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `degrees` | body | integer | no | Rotation angle in degrees. 0 and 360 leave pages unchanged. One of: 0, 90, 180, 270, 360. Default: `0`. Example: `90`. |
| `pdf_url` | body | string (uri) | no | Public URL of the source PDF. Required if pdf_base64 is not set. Must be http or https. Provide exactly one of pdf_url or pdf_base64. Example: `https://example.com/sideways.pdf`. |
| `filename` | body | string | no | Suggested name for the output file. Example: `rotated.pdf`. |
| `pdf_base64` | body | string | no | Base64-encoded PDF. Required if pdf_url is not set. Provide exactly one of pdf_url or pdf_base64. Example: `JVBERi0xLjQKJeLjz9MK...`. |
| `page_numbers` | body | array of integer | no | 1-based page numbers to rotate. Omit to rotate every page. Example: `[1,3]`. |
| `response_mode` | body | string | no | How the rotated PDF is returned. One of: binary, base64, json, url. Default: `binary`. Example: `json`. |

#### Quickstart

Rotate every page of a PDF by 90 degrees and get the file back as JSON.

```bash
curl -X POST "https://api.eu.apyhub.com/sarvasoft/rotate-pdf-by-degrees" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"pdf_url":"https://assets.apyhub.com/samples/sample.pdf","degrees":90,"response_mode":"json"}'
```

#### What you'll get back

Returns a JSON object with the rotated file and its metadata.

```json
{
  "filename": "rotated.pdf",
  "size": 675,
  "created_at": "2026-11-20T07:52:44Z",
  "pdf_base64": "JVBERi0xLjMKJb/3ov4KMSAwIG9iago8PCAvUGFnZXMgMiAwIFI..."
}
```

## About

## What it does
The Rotate PDF API turns sideways or upside-down pages the right way up. Send a PDF as a public `pdf_url` or a `pdf_base64` string, choose an angle, and get the rotated PDF back in one call.

Set `degrees` to 90, 180 or 270. A value of 0 or 360 leaves pages unchanged, and 0 is the default. To rotate only some pages, pass `page_numbers` as a list of 1-based page numbers. Leave it out to rotate every page. Use `filename` to name the output file.

Choose how the file comes back with `response_mode`. The default, `binary`, returns raw bytes. Use `base64` for an encoded string, or `url` for a temporary link. Use `json` to get the file with its name, size in bytes and creation time.

Teams use the Rotate PDF API to fix scanned documents that arrive sideways. It also corrects one page inside a longer packet, and sets page orientation before OCR, storage or merging.

The API rotates pages only. It does not resize, crop, compress or edit page content. An angle outside the allowed values, such as 45, or a page number outside the document returns a 422 error.

If you don't know which pages are sideways, the [PDF Orientation API](https://apyhub.com/flowdocs/service/auto-correct-pdf-pages) finds and fixes them with OCR. After rotating, combine files with the [Merge Files to PDF API](https://apyhub.com/apyhub/service/merge-files-to-pdf).

AI agents can call it through ApyHub MCP.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/sarvasoft/service/rotate-pdf-by-degrees
