Convert HTML, images, and documents to PDF with a single API call. Free tier included — no credit card required. Files are processed and immediately discarded.
Get up and running in under 2 minutes. No SDK needed — just HTTP requests.
Enter your email to generate a free API key instantly:
⚠ Save this key now — it cannot be retrieved later. Store it as an environment variable.
curl -X POST https://buildpdf.co/api/v1/convert \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "html": "<h1>Hello World</h1><p>My first PDF via API!</p>", "options": { "pageSize": "a4", "orientation": "portrait" } }'
const response = await fetch('https://buildpdf.co/api/v1/convert', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': process.env.BUILDPDF_API_KEY, }, body: JSON.stringify({ html: '<h1>Hello World</h1><p>My first PDF!</p>', options: { pageSize: 'a4' } }) }); const { pdf } = await response.json(); // pdf is a base64-encoded PDF — save it: fs.writeFileSync('output.pdf', Buffer.from(pdf, 'base64'));
import requests, base64, os response = requests.post( "https://buildpdf.co/api/v1/convert", headers={"X-API-Key": os.environ["BUILDPDF_API_KEY"]}, json={ "html": "<h1>Hello World</h1><p>My first PDF!</p>", "options": {"pageSize": "a4"} } ) pdf_bytes = base64.b64decode(response.json()["pdf"]) with open("output.pdf", "wb") as f: f.write(pdf_bytes)
<?php $ch = curl_init('https://buildpdf.co/api/v1/convert'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-Key: ' . getenv('BUILDPDF_API_KEY'), ], CURLOPT_POSTFIELDS => json_encode([ 'html' => '<h1>Hello World</h1>', 'options' => ['pageSize' => 'a4'], ]), ]); $result = json_decode(curl_exec($ch), true); file_put_contents('output.pdf', base64_decode($result['pdf']));
Convert HTML, text, or image files to PDF. Send content directly or as base64-encoded files.
| Parameter | Type | Description |
|---|---|---|
html |
string | Raw HTML content to convert. optional |
text |
string | Plain text content. optional |
file |
string | Base64-encoded file (image or document). optional |
format |
string | File format hint when using file: image, text, html, docx. optional |
options |
object | PDF options (see below). optional |
| Field | Default | Values |
|---|---|---|
pageSize | a4 | a4, letter, a3, legal |
orientation | portrait | portrait, landscape |
margin | 10 | Margin in mm (0–50) |
quality | 0.95 | Image quality 0.1–1.0 |
Extract text or images from a PDF file. Requires Starter plan or above.
| Parameter | Type | Description |
|---|---|---|
file |
string | Base64-encoded PDF file. required |
output |
string | text or images. Default: text. optional |
Check your current usage, remaining quota, and tier limits. Does not count as a conversion.
Register for a new API key. Returns a bpdf_ prefixed key.
| Parameter | Type | Description |
|---|---|---|
email |
string | Your email address. required |
All API requests require an API key. Pass it via one of these methods:
# Option 1: X-API-Key header (recommended) X-API-Key: bpdf_your_key_here # Option 2: Authorization Bearer Authorization: Bearer bpdf_your_key_here
Test the API right here — enter your API key and HTML content to generate a PDF.
Start free. Upgrade when you need more. No credit card required for the free tier.
| Code | Meaning | What to do |
|---|---|---|
400 | Bad Request | Check your request body — a required field is missing or malformed. |
401 | Unauthorized | API key is missing or invalid. Check the X-API-Key header. |
403 | Forbidden | Feature not available on your tier. Upgrade your plan. |
413 | File Too Large | File exceeds your tier's size limit. |
429 | Rate Limited | Too many requests. Wait and retry, or upgrade for higher limits. |
500 | Server Error | Something went wrong on our end. Retry, or contact support. |