API Documentation

Convert HTML and URLs to PDF, PNG, and other formats with our simple REST API.

Authentication

All API requests require authentication using an API key. Include your key in the X-API-Key header.

X-API-Key: sk_your_api_key

Endpoints

POST/convert/pdf
Convert HTML or URL to PDF
POST/convert/png
Convert HTML or URL to PNG image
POST/convert/jpeg
Convert HTML or URL to JPEG image
POST/convert/webp
Convert HTML or URL to WebP image
GET/logs
List your conversion history

Request Options

ParameterTypeDescription
source*stringURL or raw HTML content (required)
formatstringPage format: A4, Letter, Legal, etc.
landscapebooleanUse landscape orientation
marginobjectPage margins: {top, right, bottom, left}
headerobjectHeader HTML: {source, height}
footerobjectFooter HTML: {source, height}
cssstringCustom CSS to inject
javascriptstringCustom JavaScript to inject
delaynumberDelay before rendering (ms)
timeoutnumberMax rendering time (seconds)
sandboxbooleanSandbox mode (no credits used)
encodebooleanReturn base64 instead of binary

Code Examples

curl -X POST https://api.pixeltopdf.com/convert/pdf \
  -H "X-API-Key: sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"source": "https://example.com"}' \
  --output document.pdf

Rate Limits

Rate limits depend on your plan:

  • Free: 10 requests per minute
  • Starter: 60 requests per minute
  • Pro: 120 requests per minute
  • Enterprise: Custom limits

Error Codes

CodeDescription
400Bad request - Invalid parameters
401Unauthorized - Invalid or missing API key
402Payment required - No credits remaining
429Too many requests - Rate limit exceeded
500Internal server error - Please retry

Need help?

Can't find what you're looking for? Reach out to our support team.

Open Playground