Generation API API
The Generation API creates PDFs, social/OG images and charts on the fly and returns them as clean JSON (base64 or a download token).
🤖 Using an AI assistant? Copy this link into ChatGPT / Claude / Cursor — it reads every endpoint and parameter instantly and tells you if this API fits your use case.
The primary pdf_render endpoint returns a rendered PDF with filename, content type, byte size and a page hint, and the set also covers PDF from HTML or a URL, OG and template images, charts of many types and batch rendering. It is built for products that need server-side document and image generation without running a headless-browser render farm. One ReefAPI key, one shared credit pool, the standard envelope.
Real request and response JSON
Captured from the indexed primary action, pdf_render, on .
{
"method": "POST",
"url": "https://api.reefapi.com/generate/v1/pdf_render",
"headers": {
"x-api-key": "$REEF_KEY",
"content-type": "application/json"
},
"body": {
"template_name": "invoice",
"data": {
"company": {
"name": "Acme"
},
"items": [
{
"description": "Widget",
"qty": 2,
"unit_price": 9.5
}
],
"subtotal": 19,
"total": 19
}
}
}{
"ok": true,
"meta": {
"api": "generate",
"endpoint": "pdf_render",
"mode": "live",
"latency_ms": 1384.7,
"record_count": 1,
"bytes": 9074,
"cache_hit": false
},
"data": {
"file": {
"filename": "invoice.pdf",
"format": "pdf",
"content_type": "application/pdf",
"bytes": 9074,
"source": "template",
"pages_hint": null,
"file_b64": "JVBERi0xLjcKJfCflqQKNSAwIG9iago8PC9GaWx0ZXIgL0ZsYXRlRGVjb2RlL0xlbmd0aCA4MDY+PgpzdHJlYW0KeNqtV8uO0zAU3ecr8gPjuU/bVxqNBOIlJEBABQLEYigzbOgCWPD7XCdt3g20g6LWaZycc3yPfZxiDX5coH9lwZCzpSj1dlf9qCAkbXq7k+Zyf1w+wAD1t19+Z7YMbH6ngeZM5YRQo9VvnlZY/65iDpJIBGsyDplz4ljvKiYJqJJFhte/V2+r136cyLEMtquE1J/lrPwfSJbBdpWKBWGK/4FiCWpXJScmyiz/QgHCyMmRm5b9hMFZpVDQ2A5NATQy88SO/vqZHMtgYzvuTbIMNrTj3hRLUGM7/kqBrb9+EiFl8RPqqmQxZPX5IDWLhsRGWvRHDGY50vDy6eiLMCPxc/TLm7+X5ue36uGmwkN29NMJwWUkRNF6s6suX3589Oj9q5piiDECxnpzV326AiC5Bm8kNo1C+ytfw+d687x6vDkyqimtkI+OAHNtPtc4WhzTQse3bRgY28bahppm30etFhqJELQIuRRAEmhRo+CXcF4AC+5/Rq0RUxAAl99Ieffm",
"delivery": "inline"
}
}
}What the Generation API API does
| Action | Description | Concrete use case | Key params |
|---|---|---|---|
| pdf_render | Render a PDF from inline HTML/CSS (Jinja2) or a built-in template_name + data (invoice/receipt/certificate/report). WeasyPrint, fonts pinned, network-off. Output: inline base64 (≤8MB) or one-time download token. | Ops teams call pdf_render to render a PDF from inline HTML/CSS (Jinja2) or a built-in template_name + data (invoice/receip…. | html, template_name, data, paper, filename, ... |
| pdf_from_html | Shortcut for rendering inline HTML directly to PDF — the same WeasyPrint engine as pdf_render; `html` is required. | Developer tools call pdf_from_html to get shortcut for rendering inline HTML directly to PDF. | html, data, paper, filename, allow_hosts |
| pdf_from_url | Render a built-in or inline template to PDF, populating it with data fetched live from a JSON URL you supply. Useful when your invoice or report data lives at a public API endpoint — no manual copy-paste needed. | Validation workflows call pdf_from_url to render a built-in or inline template to PDF, populating it with data fetched live from a JSON…. | data_url, template_name, html, data_path, paper, ... |
| og_image | Render a social / Open Graph card image (1200×630 default) from a built-in template or an inline layout spec. Supports automatic text-wrap and font scaling for long titles, colour gradients and badge overlays. | Data-quality teams call og_image to render a social / Open Graph card image (1200×630 default) from a built-in template or an inl…. | template_name, layout, vars, width, height, ... |
| image_from_template | Alias of og_image (explicit Bannerbear 'create image from template' naming). template_name + vars → PNG. | Ops teams call image_from_template to get alias of og_image (explicit Bannerbear 'create image from template' naming). | template_name, vars, width, height, format, ... |
| image_from_url | Render an image template with `vars` fetched from a JSON URL (proxy, SSRF-validated). Data-driven banner generation. | Developer tools call image_from_url to render an image template with `vars` fetched from a JSON URL (proxy, SSRF-validated). | data_url, template_name, layout, data_path, width, ... |
| chart | Render a chart from a Chart.js-style spec — returns a PNG or SVG image. Supported chart types: bar, horizontal_bar, line, area, pie, doughnut, scatter and radar. Powered by a matplotlib backend. | Validation workflows call chart to render a chart from a Chart.js-style spec. | spec, format, filename |
| chart_types | List all supported chart types with a description of each. No input required. | Data-quality teams call chart_types to list all supported chart types with a description of each. | none |
| batch_pdf | Render up to 20 PDFs in one call. `jobs` = array of pdf_render param objects. | Ops teams call batch_pdf to render up to 20 PDFs in one call. | jobs |
| batch_image | Render up to 20 images in one call. `jobs` = array of og_image param objects. | Developer tools call batch_image to render up to 20 images in one call. | jobs |
| template_list | List built-in templates (PDF + image) with their data contracts. Stateless — there is NO stored-template management (create/upload/delete out of scope). | Validation workflows call template_list to list built-in templates (PDF + image) with their data contracts. | none |
| validate_html | Lint HTML/CSS for the PDF path WITHOUT rendering: flags remote resources that the SSRF-safe renderer will block, size, and tag-balance hints. Deterministic. | Data-quality teams call validate_html to get lint HTML/CSS for the PDF path WITHOUT rendering. | html |
| health | Renderer diagnostics — which backends (WeasyPrint/Pillow/matplotlib) are loadable and their versions. No input. | Ops teams call health to get renderer diagnostics. | none |
| qr | Generate a QR code (PNG or SVG) with custom fg/bg color, error-correction, and an OPTIONAL center logo fetched from logo_url (SSRF-guarded, via proxy). Use error_correction=h when embedding a logo so it stays scannable. | Developer tools call qr to generate a QR code (PNG or SVG) with custom fg/bg color, error-correction, and an OPTIONAL ce…. | data, format, error_correction, scale, border, ... |
| barcode | Generate a 1D barcode IMAGE (PNG or SVG) from data: EAN-13/8, UPC-A, Code-128, Code-39, ISBN-10/13, ITF, GS1-128, JAN, PZN, Codabar. Check digits are validated — a wrong EAN/UPC/ISBN check digit returns a structured error, not a silent fix. | Validation workflows call barcode to generate a 1D barcode IMAGE (PNG or SVG) from data. | data, type, format, show_text, module_height, ... |
| code_image | Render a syntax-highlighted code snippet as a PNG with a carbon/ray.so-style window frame. 500+ languages (Pygments), 40+ themes, optional line numbers. | Data-quality teams call code_image to render a syntax-highlighted code snippet as a PNG with a carbon/ray.so-style window frame. | code, language, theme, window_style, line_numbers, ... |
| favicon | Turn one source image into a complete favicon bundle: multi-resolution favicon.ico, a named PNG set (16→512 incl. apple-touch-icon + android-chrome), site.webmanifest, and the ready-to-paste <head> <link> snippet. Source from image_url (SSRF-guarded) or a base64 upload. | Ops teams call favicon to turn one source image into a complete favicon bundle. | image_url, image_base64 |
| vcard | Build a vCard (.vcf) contact file from contact fields (vCard 3.0 or 4.0). Returns the raw.vcf text + a base64 data-URI you can download or encode into a QR. | Developer tools call vcard to build a vCard (.vcf) contact file from contact fields (vCard 3.0 or 4.0). | full_name, first_name, last_name, organization, title, ... |
| ical | Build an iCalendar (.ics) event file from event fields (RFC 5545). Supports timed or all-day events, end-time or duration, location, description, organizer. Returns the raw.ics + a base64 data-URI. | Validation workflows call ical to build an iCalendar (.ics) event file from event fields (RFC 5545). | summary, start, end, duration_minutes, location, ... |
| wifi | Generate a WiFi-join QR code (PNG/SVG) from network credentials — scan to connect, no typing. Encodes the standard WIFI: payload (WPA/WEP/open, hidden networks). | Data-quality teams call wifi to generate a WiFi-join QR code (PNG/SVG) from network credentials. | ssid, password, encryption, hidden, format, ... |
| batch | Generate up to 50 small assets in one request. Items run independently — a bad item yields its own error entry, never fails the batch. NOTE: items that fetch a remote logo_url/image_url ARE supported and SSRF-guarded. | Ops teams call batch to generate up to 50 small assets in one request. | items |
Call pdf_render from your stack
curl -X POST https://api.reefapi.com/generate/v1/pdf_render \
-H "x-api-key: $REEF_KEY" \
-H "content-type: application/json" \
-d '{"template_name":"invoice","data":{"company":{"name":"Acme"},"items":[{"description":"Widget","qty":2,"unit_price":9.5}],"subtotal":19,"total":19}}'import requests
r = requests.post(
"https://api.reefapi.com/generate/v1/pdf_render",
headers={"x-api-key": REEF_KEY},
json={
"template_name": "invoice",
"data": {
"company": {
"name": "Acme"
},
"items": [
{
"description": "Widget",
"qty": 2,
"unit_price": 9.5
}
],
"subtotal": 19,
"total": 19
}
},
)
print(r.json()["data"])const res = await fetch("https://api.reefapi.com/generate/v1/pdf_render", {
method: "POST",
headers: {
"x-api-key": process.env.REEF_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"template_name": "invoice",
"data": {
"company": {
"name": "Acme"
},
"items": [
{
"description": "Widget",
"qty": 2,
"unit_price": 9.5
}
],
"subtotal": 19,
"total": 19
}
}),
});
const { ok, data, meta, error } = await res.json();Ask your MCP-connected assistant: call reefapi.generate.pdf_render with {"template_name":"invoice","data":{"company":{"name":"Acme"},"items":[{"description":"Widget","qty":2,"unit_price":9.5}],"subtotal":19,"total":19}}.Who uses this API and why
- SaaS products call pdf_from_html to turn invoices, reports and receipts into downloadable PDFs.
- Marketing tools use og_image and image_from_template to auto-generate share images at scale.
- Dashboards use chart to render server-side charts for emails and PDFs where JS cannot run.
Questions developers ask before integrating
What is the Generation API API?
Generation API API is a ReefAPI endpoint group for generation api It returns live JSON through POST requests under /generate/v1.
Is the Generation API API free to try?
Yes. ReefAPI starts with 1,000 free credits, no card required. Generation API calls use the same shared credit balance as every other ReefAPI engine.
Do I need a Generation API login or account?
No login to Generation API is needed for the API response. You call ReefAPI with your x-api-key header, and the playground can run live examples before you create a production key.
How fresh is the Generation API data?
The page example is captured from a live pdf_render call, and production requests fetch live data through ReefAPI rather than a static sample.
How many credits does the Generation API API use?
Generation API actions currently cost 1-4 credits per successful call. Failed or blocked calls are free, and all APIs draw from one credit pool.
Can I call Generation API from an AI assistant or MCP client?
Yes. Connect ReefAPI once through MCP and your assistant can call generate actions with the same key, credit pool and JSON envelope used by normal REST requests.
Is the Generation API API a Generation API scraper?
It is the managed alternative to a DIY Generation API scraper. Instead of building and maintaining your own scraper — proxies, headless browsers, captcha and constant breakage — you call one ReefAPI endpoint and get the same generation api back as clean JSON.
Why does my Generation API scraper keep getting blocked?
Most Generation API scrapers break on anti-bot defenses, rate limits and IP bans that need rotating residential proxies and browser fingerprinting to clear. ReefAPI handles all of that for you — no proxies, no captchas, no maintenance — and returns live JSON. Blocked or failed calls are free.