Convert HTML to a PDF with a single authenticated request. Sign in and create a client ID + client secret pair from your dashboard.
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.
POST https://renderpdf.vercel.app/api/convert
| Field | Type | Description |
|---|---|---|
| html | string (required) | The HTML document to render. |
| options.format | string | A3, A4, A5, Letter, Legal, or Tabloid (case-insensitive). Default A4. |
| options.orientation | string | portrait or landscape. Default portrait. |
| options.margin | string or object | A single value like "20mm" applied to all sides, or { top, right, bottom, left } for per-side control. |
200 - the raw PDF bytes, Content-Type: application/pdf.
| Status | Meaning |
|---|---|
| 400 | Missing or invalid html field. |
| 401 | Missing, malformed, invalid, or revoked client credentials. |
| 429 | Rate limit exceeded. Your limit is set by your current plan (requests/minute) - check the Retry-After header. |
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.pdfconst 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();