Rotate PDF API

Category: pdf

Rotate all or specific pages of a PDF by 90, 180, or 270 degrees.

Endpoint

POST https://anythingtext.com/api/tools/pdfrotate
Authentication Required Content-Type: multipart/form-data

Authentication

This API requires an API key. Generate one from the API Keys section in your dashboard settings.

Include the X-API-Key header in all API requests:

X-API-Key: atk_your_api_key_here

Rate Limiting

API requests are limited to 60 requests per minute per user. If you exceed this limit, the API returns a 429 Too Many Requests response.

Every response includes rate limit headers:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 42

When rate limited, the response body contains:

{ "error": "Rate limit exceeded. Maximum 60 requests per minute.", "retryAfter": 42, "limit": 60 }

Request Parameters

Name Type Required Description
file File Required The PDF file to rotate
Example: document.pdf
angle Integer Required Rotation angle: 90, 180, or 270
Example: 90
pages String Optional Page range to rotate (default: all). e.g., '1-3,5'
Example: 1-3

Response

Content-Type: application/pdf

Rotated PDF file

(binary PDF data)

Error Responses

StatusDescriptionBody
401 Not authenticated {"error": "Please log in..."}
400 Bad request / Missing required params {"error": "... is required"}
500 Internal server error {"error": "Failed to ..."}

cURL Example

curl -X POST https://anythingtext.com/api/tools/pdfrotate \
  -H "X-API-Key: your_api_key_here" \
  -F "file=@document.pdf" \
  -F "angle=90" \
  --output rotated.pdf

Code Samples

const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('angle', '90');

const response = await fetch('https://anythingtext.com/api/tools/pdfrotate', {
    method: 'POST',
    headers: { 'X-API-Key': 'your_api_key_here' },
    body: formData
});

const blob = await response.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'output.pdf';
a.click();
import requests

with open('input.pdf', 'rb') as f:
    response = requests.post(
        'https://anythingtext.com/api/tools/pdfrotate',
        files={'file': f},
        data={'angle': '90'},
        headers={'X-API-Key': 'your_api_key_here'}
    )

with open('output.pdf', 'wb') as f:
    f.write(response.content)

print('Saved to output.pdf')
import java.net.URI;
import java.net.http.*;
import java.nio.file.*;

HttpClient client = HttpClient.newHttpClient();
// Build multipart form data with file + parameter
String boundary = "----Boundary" + System.currentTimeMillis();
byte[] fileBytes = Files.readAllBytes(Path.of("input.pdf"));

// See cURL example above for the equivalent command.
// For Java multipart uploads, consider using Apache HttpClient
// or Spring WebClient for simpler multipart handling.

// Example with Apache HttpClient:
// HttpEntity entity = MultipartEntityBuilder.create()
//     .addBinaryBody("file", fileBytes)
//     .addTextBody("angle", "90")
//     .build();