# DevilPDF > DevilPDF is a document generation API. Send a template id and JSON (or raw HTML, or a URL) to one endpoint and get back a PDF or an image. It also merges, splits, protects and fills PDFs, fills Word and Excel templates, designs templates from a plain-English description, and runs a hosted MCP server for AI agents. Base URL: https://devilpdf.com API version: v1 (in the path) OpenAPI 3.1: https://devilpdf.com/openapi.json ## Authentication Every request needs an API key as a bearer token. Keys start with `dp_live_` and are created in the dashboard at https://devilpdf.com/app. Keep them on the server. ``` Authorization: Bearer dp_live_... ``` ## Render a document `POST /v1/render` with exactly one source: `template`, `html` or `url`. ```bash curl https://devilpdf.com/v1/render \ -H "Authorization: Bearer $DEVILPDF_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "template": "invoice", "data": { "number": "INV-1001", "customer": { "name": "Acme Robotics" }, "items": [{ "name": "Consulting", "quantity": 3, "unit_price": 150 }] }, "filename": "invoice-1001" }' ``` Response (JSON): ```json { "object": "document", "id": "doc_nWWGc4ehhC44vpOsHFGn", "status": "succeeded", "format": "pdf", "url": "https://devilpdf.com/f/doc_nWWGc4ehhC44vpOsHFGn/invoice-1001.pdf?exp=...&sig=...", "filename": "invoice-1001.pdf", "pages": 1, "bytes": 29384, "expires_at": "2026-03-15T14:02:11.000Z" } ``` Main body fields: - `template`: a saved template id (`tpl_...`) or a built-in starter: `invoice`, `quote`, `certificate`. - `html` (+ optional `css`): raw HTML to render. Add `data` to use it as an inline template. - `url`: a public web page to capture. - `data`: JSON merged into the template. - `format`: `pdf` (default), `png`, `jpeg`, `webp`. - `output`: `url` (default, JSON with a signed download link), `file` (raw bytes, nothing stored), `base64` (JSON with the file inline). - `options`: `page_size` (A3, A4, A5, Letter, Legal, Tabloid), `orientation`, `margin`, `font`, `accent`, `page_numbers`, `header_text`, `footer_text`, `wait_for`, `delay`, and image options `width`, `height`, `device_scale`, `full_page`, `quality`, `transparent`, `selector`. - `pdf`: `password`, `owner_password`, `permissions`, `metadata`, `form` (fillable fields). - `filename`, `expires_in`, `metadata`, `async`, `webhook_url`, `destination: "s3"`. Templates are HTML with Liquid placeholders (`{{ customer.name }}`, `{{ total | money }}`), loops and conditions as attributes (``, `data-if`), on top of a built-in print stylesheet. ## Endpoints - `POST /v1/render`: create a PDF or image from a template, HTML or URL. - `POST /v1/render/batch`: queue many documents in one request (`items` array plus shared fields). - `GET /v1/batches/:id`: batch progress. - `GET /v1/documents`, `GET /v1/documents/:id`, `DELETE /v1/documents/:id`: the document log and stored files. - `GET /v1/templates`, `POST /v1/templates`, `GET|PATCH|DELETE /v1/templates/:id`, `POST /v1/templates/:id/duplicate`: manage templates. - `POST /v1/templates/generate`: design a template from a plain-English `prompt`. - `POST /v1/templates/:id/revise`: change a template with a plain-English `prompt`. - `POST /v1/templates/validate`, `POST /v1/templates/preview`: check or preview a template without saving or rendering. - `POST /v1/templates/upload`: upload a `.docx` or `.xlsx` file with `{{placeholders}}` as a template. - `POST /v1/pdf/merge`, `/v1/pdf/split`, `/v1/pdf/protect`, `/v1/pdf/fill`, `/v1/pdf/fields`: work on existing PDFs (inputs are document ids, https URLs or base64). - `GET /v1/webhooks`, `POST /v1/webhooks`, `DELETE /v1/webhooks/:id`: webhook endpoints. Events: `document.succeeded`, `document.failed`, `batch.completed`. - `POST /v1/embed-tokens`: short-lived token for the embeddable template editor (Growth and up). - `GET /v1/usage`, `GET /v1/account`, `GET /v1/plans`: usage, account and plan limits. - `POST /mcp`: MCP server (Streamable HTTP, same bearer key). Tools: `list_templates`, `get_template`, `create_template`, `render_document`, `get_usage`. ## Errors Failures return a non-2xx status and `{ "error": { "type": "...", "message": "..." } }`. Types: `invalid_request` (400), `unauthorized` (401), `forbidden` (403), `plan_limit` (403), `not_found` (404), `payload_too_large` (413), `template_error` (422, with `line` and `col`), `render_error` (422), `ai_refused` (422), `quota_exceeded` (429, with `limit` and `resets_at`), `rate_limited` (429), `internal_error` (500), `ai_unavailable` (503), `not_configured` (503), `render_timeout` (504). Failed renders are not counted against usage. ## Limits - Rate limit: 600 requests per minute per account. - Render time: 30 seconds for templates and HTML, 45 seconds for URLs. - Any language: send `"locale": "fr-CA"` (or `de-DE`, `ja-JP`, `ar`, `hi-IN`, …) on a render. Fonts for every script load automatically (Latin, Cyrillic, Greek, Arabic, Hebrew, CJK, Indic, Thai, emoji); Arabic, Hebrew, Persian and Urdu pages mirror right to left; `money`, `number` and `local_date` filters use local formats; the seven starter templates are translated into 32 languages; `{{ "Label" | t }}` translates labels in your own templates and a `labels` object in the data overrides them. See /docs/languages. - Plans (documents per month, USD): Free 500 ($0), Starter 10,000 ($19), Growth 50,000 ($79), Business 150,000 ($199), Scale 500,000 ($499). Unlimited templates on every plan. Documents are counted, never pages. No overage charges; requests return `quota_exceeded` at the limit. Free-plan PDFs carry a small "Made with DevilPDF" line. - Hosted files are kept 24 hours (Free), 7 days (Starter) or 30 days (Growth, Business, Scale). ## Docs ### Get started - [Quickstart](https://devilpdf.com/docs/quickstart): Create an API key and render your first PDF in about two minutes. - [Authentication](https://devilpdf.com/docs/authentication): Authenticate API requests with a bearer API key. ### Rendering - [Render a document](https://devilpdf.com/docs/render): Full reference for POST /v1/render. - [HTML to PDF](https://devilpdf.com/docs/html-to-pdf): Render raw HTML and CSS without saving a template. - [URL to PDF](https://devilpdf.com/docs/url-to-pdf): Capture any public web page as a PDF or screenshot. - [Images](https://devilpdf.com/docs/images): Render to PNG, JPEG or WebP. - [Languages and locales](https://devilpdf.com/docs/languages): Any language: right-to-left, CJK, Indic and Thai scripts, local money and dates, translated labels. - [Async and batch](https://devilpdf.com/docs/async-and-batch): Background renders and many documents in one request. - [Documents](https://devilpdf.com/docs/documents): List, fetch and delete generated documents. ### Templates - [Templates](https://devilpdf.com/docs/templates): Create, update and manage templates, and use the starters. - [Template language](https://devilpdf.com/docs/template-language): Placeholders, loops, conditions, calculations and formatting filters. - [Print kit](https://devilpdf.com/docs/print-kit): The built-in stylesheet and page settings. - [AI templates](https://devilpdf.com/docs/ai-templates): Generate and revise templates from plain English. - [Forms and signatures](https://devilpdf.com/docs/forms-and-signatures): Fillable PDF fields, signature fields, and filling existing forms. - [Word and Excel templates](https://devilpdf.com/docs/word-and-excel): Fill .docx and .xlsx templates. ### Tools - [PDF tools](https://devilpdf.com/docs/pdf-tools): Merge, split, password-protect and fill PDFs. ### Platform - [Webhooks](https://devilpdf.com/docs/webhooks): Events, payloads, signature verification and retries. - [Storage](https://devilpdf.com/docs/storage): Download links, retention, your own S3 bucket, EU storage. - [MCP server](https://devilpdf.com/docs/mcp): Connect Claude, Cursor and other AI agents. - [Embeddable editor](https://devilpdf.com/docs/embed): Let your users edit a template inside your app. - [Zapier, Make, n8n and Bubble](https://devilpdf.com/docs/integrations): No-code setup. ### Reference - [API reference](https://devilpdf.com/docs/api): Every endpoint on one page. - [Errors](https://devilpdf.com/docs/errors): Every error type and what to do about it. - [Limits and plans](https://devilpdf.com/docs/limits): Plan allowances, rate, size and time limits.