Page2Doc API PRO ONLY

Programmatic access to web page conversion via REST API

⚠️ Pro Subscription Required
API access is only available for Pro subscribers. Generate your API key from the extension popup (API Access section).

Authentication

All API requests must include your API key in the X-API-Key header:

X-API-Key: p2d_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxx
🔐 Security Best Practices
Never commit API keys to version control. Use environment variables or secure secret management systems.

Endpoints

Convert URL to Document

POST
https://page2doc.com/api/v1/convert

Convert a web page URL to PDF, Word (DOCX), or Excel (XLSX) format.

Request Body (JSON)

Parameter Type Required Description
url string Yes Full URL of the page to convert (must start with http:// or https://)
format string Yes Output format: pdf, docx, or xlsx
mode string No Extraction mode: full (default), article, or tables
clean boolean No Remove ads and popups (default: true)
wait number No Wait time in milliseconds before capture (default: 2000, max: 10000)

Example Request (cURL)

curl -X POST https://page2doc.com/api/v1/convert \
  -H "Content-Type: application/json" \
  -H "X-API-Key: p2d_api_your_key_here" \
  -d '{
    "url": "https://example.com/article",
    "format": "pdf",
    "mode": "article",
    "clean": true
  }' \
  --output document.pdf

Example Request (JavaScript/Node.js)

const response = await fetch('https://page2doc.com/api/v1/convert', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'YOUR_API_KEY_HERE'
  },
  body: JSON.stringify({
    url: 'https://example.com/article',
    format: 'docx',
    mode: 'article',
    clean: true
  })
});

const blob = await response.blob();
const buffer = Buffer.from(await blob.arrayBuffer());
fs.writeFileSync('output.docx', buffer);

Example Request (Python)

import requests
import os

response = requests.post(
    'https://page2doc.com/api/v1/convert',
    headers={
        'Content-Type': 'application/json',
        'X-API-Key': os.environ['PAGE2DOC_API_KEY']
    },
    json={
        'url': 'https://example.com/article',
        'format': 'pdf',
        'mode': 'article',
        'clean': True
    }
)

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

Success Response

Status: 200 OK
Content-Type: application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

The response body contains the binary document file.

Error Responses

Status Error Description
401 Unauthorized Invalid or missing API key
403 Forbidden Pro subscription expired or API key revoked
413 Payload Too Large Page content exceeds size limit (10MB for Pro)
422 Unprocessable Entity Invalid URL or unsupported format
429 Too Many Requests Rate limit exceeded (500 requests/day for Pro)
500 Internal Server Error Conversion failed or server error

Check API Key Status

GET
https://page2doc.com/api/v1/status

Verify your API key and check usage statistics.

Example Request

curl https://page2doc.com/api/v1/status \
  -H "X-API-Key: p2d_api_your_key_here"

Success Response

{
  "valid": true,
  "plan": "pro",
  "usage": {
    "today": 12,
    "month": 347,
    "limit": 500
  },
  "createdAt": "2025-02-15T10:30:00Z"
}

Rate Limits

Rate limit headers are included in all responses:

X-RateLimit-Limit: 500
X-RateLimit-Remaining: 487
X-RateLimit-Reset: 1708041600

Best Practices

Support

For API support, rate limit increases, or custom integrations, contact us at api@page2doc.com