API Documentation

Convert HTML to a PDF with a single authenticated request. Sign in and create a client ID + client secret pair from your dashboard.

Authentication

Every request must include an Authorization: Basic header carrying your client ID and client secret as base64(client_id:client_secret) - the same scheme curl -u client_id:client_secret produces automatically. Credentials are created and revoked from the dashboard; the secret is shown only once, at creation time.

Endpoint

POST https://renderpdf.vercel.app/api/convert

FieldTypeDescription
htmlstring (required)The HTML document to render.
options.formatstringA3, A4, A5, Letter, Legal, or Tabloid (case-insensitive). Default A4.
options.orientationstringportrait or landscape. Default portrait.
options.marginstring or objectA single value like "20mm" applied to all sides, or { top, right, bottom, left } for per-side control.

Response

200 - the raw PDF bytes, Content-Type: application/pdf.

Errors

StatusMeaning
400Missing or invalid html field.
401Missing, malformed, invalid, or revoked client credentials.
429Rate limit exceeded. Your limit is set by your current plan (requests/minute) - check the Retry-After header.

cURL

curl -X POST https://renderpdf.vercel.app/api/convert \
  -u "CLIENT_ID:CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>Hello World</h1>",
    "options": { "format": "A4", "margin": "20mm" }
  }' \
  -o output.pdf

JavaScript

const credentials = Buffer.from('CLIENT_ID:CLIENT_SECRET').toString('base64');

const response = await fetch(
  'https://renderpdf.vercel.app/api/convert',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Basic ${credentials}`
    },
    body: JSON.stringify({
      html: '<h1>Hello World</h1>',
      options: {
        format: 'A4',
        margin: '20mm'
      }
    })
  }
);

const pdf = await response.blob();