Website to PDF API

Category: conversion

Convert any webpage URL into a downloadable PDF document. The page is rendered and converted server-side.

Endpoint

POST https://anythingtext.com/api/tools/webtopdf
Authentication Required Content-Type: application/json

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
url String Required The full URL of the webpage to convert
Example: https://example.com

Response

Content-Type: application/pdf

PDF rendering of the webpage

(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/webtopdf \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{"url": "https://example.com"}' \
  --output website.pdf

Code Samples

const response = await fetch('https://anythingtext.com/api/tools/webtopdf', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'X-API-Key': 'your_api_key_here'
    },
    body: JSON.stringify({ url: 'https://example.com' })
});

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

response = requests.post(
    'https://anythingtext.com/api/tools/webtopdf',
    json={'url': 'https://example.com'},
    headers={'X-API-Key': 'your_api_key_here'}
)

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

print('PDF saved to website.pdf')
import java.net.URI;
import java.net.http.*;
import java.nio.file.*;

HttpClient client = HttpClient.newHttpClient();
String json = "{\"url\": \"https://example.com\"}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://anythingtext.com/api/tools/webtopdf"))
    .header("Content-Type", "application/json")
    .header("X-API-Key", "your_api_key_here")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse<byte[]> response = client.send(request,
    HttpResponse.BodyHandlers.ofByteArray());

Files.write(Path.of("website.pdf"), response.body());
System.out.println("PDF saved to website.pdf");