{"openapi":"3.1.0","info":{"title":"DevilPDF API","version":"1.0.0","summary":"Turn JSON into PDFs, images and filled documents.","description":"DevilPDF is a document generation API. Send a template id and JSON, raw HTML, or a URL to POST /v1/render and get a PDF or image back. Every request is authenticated with an API key sent as a bearer token. Errors have the shape { error: { type, message } }. Guides: https://devilpdf.com/docs","termsOfService":"https://devilpdf.com/terms","contact":{"name":"DevilPDF","url":"https://devilpdf.com/docs","email":"hello@devilpdf.com"}},"externalDocs":{"description":"DevilPDF documentation","url":"https://devilpdf.com/docs"},"servers":[{"url":"https://devilpdf.com","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Render","description":"Create PDFs and images, one at a time or in batches.","externalDocs":{"url":"https://devilpdf.com/docs/render"}},{"name":"Documents","description":"The log of everything you have generated.","externalDocs":{"url":"https://devilpdf.com/docs/documents"}},{"name":"Templates","description":"Reusable document designs.","externalDocs":{"url":"https://devilpdf.com/docs/templates"}},{"name":"PDF tools","description":"Merge, split, protect and fill existing PDFs.","externalDocs":{"url":"https://devilpdf.com/docs/pdf-tools"}},{"name":"Webhooks","description":"HTTP callbacks when documents and batches finish.","externalDocs":{"url":"https://devilpdf.com/docs/webhooks"}},{"name":"Embed","description":"The embeddable template editor.","externalDocs":{"url":"https://devilpdf.com/docs/embed"}},{"name":"Account","description":"Usage, account and plans.","externalDocs":{"url":"https://devilpdf.com/docs/limits"}}],"paths":{"/v1/render":{"post":{"operationId":"render","tags":["Render"],"summary":"Render a document","description":"Creates one PDF or image from a template, HTML or a URL. Each successful render counts as one document. Failed renders are not counted.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderRequest"},"example":{"template":"invoice","data":{"number":"INV-1001","items":[{"name":"Consulting","quantity":3,"unit_price":150}]},"filename":"invoice-1001"}}}},"responses":{"200":{"description":"The document. With \"output\": \"file\", the response is the file itself, with the headers devilpdf-document-id and devilpdf-pages.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/pdf":{"schema":{"type":"string","format":"binary"}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Accepted, with \"async\": true. The document is queued.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"},"504":{"$ref":"#/components/responses/Timeout"}}}},"/v1/render/batch":{"post":{"operationId":"renderBatch","tags":["Render"],"summary":"Render a batch","description":"Queues many documents in one request. The whole batch is validated, and its documents are taken from your allowance, before anything is queued.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchRequest"},"example":{"template":"invoice","items":[{"data":{"number":"INV-1001"},"filename":"INV-1001"},{"data":{"number":"INV-1002"},"filename":"INV-1002"}]}}}},"responses":{"202":{"description":"The batch, with the ids of its queued documents.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/batches/{id}":{"get":{"operationId":"getBatch","tags":["Render"],"summary":"Get a batch","parameters":[{"name":"id","in":"path","required":true,"description":"The batch id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Progress of the batch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/documents":{"get":{"operationId":"listDocuments","tags":["Documents"],"summary":"List documents","description":"Newest first. When has_more is true, pass the id of the last document as before to get the next page.","parameters":[{"name":"limit","in":"query","required":false,"description":"1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"before","in":"query","required":false,"description":"A document id. Returns documents older than this one.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"Filter by status.","schema":{"type":"string","enum":["queued","processing","succeeded","failed"]}},{"name":"template","in":"query","required":false,"description":"Filter by template id.","schema":{"type":"string"}},{"name":"batch","in":"query","required":false,"description":"Filter by batch id.","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Search: an exact document id, or part of a filename or template name.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of documents.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"has_more":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/documents/{id}":{"get":{"operationId":"getDocument","tags":["Documents"],"summary":"Get a document","description":"The download url is signed again on every read.","parameters":[{"name":"id","in":"path","required":true,"description":"The document id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"operationId":"deleteDocument","tags":["Documents"],"summary":"Delete a document's file","description":"Deletes the stored file immediately. The log entry stays, without a download link.","parameters":[{"name":"id","in":"path","required":true,"description":"The document id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","required":["object","id","deleted"],"properties":{"object":{"const":"document"},"id":{"type":"string"},"deleted":{"const":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates":{"get":{"operationId":"listTemplates","tags":["Templates"],"summary":"List templates","description":"Your templates, most recently updated first, followed by the starters. html, css and sample_data are left out.","parameters":[{"name":"starters","in":"query","required":false,"description":"Pass \"false\" to leave out the built-in starters.","schema":{"type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"All templates.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}},"post":{"operationId":"createTemplate","tags":["Templates"],"summary":"Create a template","description":"Pass html to create a template, or from to copy an existing one (for example the \"invoice\" starter).","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/TemplateInput"}],"properties":{"from":{"type":"string","description":"A template id to copy. Use instead of html."}}},"example":{"name":"Receipt","html":"<h1>Receipt</h1><p>Thanks, {{ customer.name }}.</p>","sample_data":{"customer":{"name":"Dana"}}}}}},"responses":{"201":{"description":"The new template.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/generate":{"post":{"operationId":"generateTemplate","tags":["Templates"],"summary":"Generate a template with AI","description":"Designs a template from a plain-English prompt. Uses one AI generation. Failed generations are not counted.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string","minLength":3,"maxLength":4000,"description":"What the document is and what it contains."},"name":{"type":"string","description":"Name for the saved template."},"save":{"type":"boolean","default":true,"description":"Set false to get a draft back without saving it."}}},"example":{"prompt":"A packing slip with our logo, the ship-to address, and a table of items with SKU and quantity. Letter size."}}}},"responses":{"200":{"description":"A draft, when save is false.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDraft"}}}},"201":{"description":"The saved template.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/templates/validate":{"post":{"operationId":"validateTemplate","tags":["Templates"],"summary":"Validate a template","description":"Checks html and settings without saving anything. Free.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["html"],"properties":{"html":{"type":"string"},"settings":{"$ref":"#/components/schemas/TemplateSettings"}}}}}},"responses":{"200":{"description":"The template is valid.","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"const":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/preview":{"post":{"operationId":"previewTemplate","tags":["Templates"],"summary":"Preview a template","description":"Merges an unsaved template with data and returns the composed HTML page. No file is created and nothing is counted.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["html"],"properties":{"html":{"type":"string"},"css":{"type":"string"},"settings":{"$ref":"#/components/schemas/TemplateSettings"},"data":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"The composed page.","content":{"application/json":{"schema":{"type":"object","properties":{"html":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/upload":{"post":{"operationId":"uploadTemplate","tags":["Templates"],"summary":"Upload a Word or Excel template","description":"Saves a .docx or .xlsx file with {{placeholders}} as a template.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"The .docx or .xlsx file as base64, or an https URL to download it from. Up to 10 MB."},"name":{"type":"string"},"filename":{"type":"string","description":"Original file name, used for the default name."},"description":{"type":"string","maxLength":500},"sample_data":{"description":"Example data."}}}}}},"responses":{"201":{"description":"The new template.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{id}":{"get":{"operationId":"getTemplate","tags":["Templates"],"summary":"Get a template","parameters":[{"name":"id","in":"path","required":true,"description":"A template id (tpl_...) or a starter id such as \"invoice\".","schema":{"type":"string"}}],"responses":{"200":{"description":"The template, with html, css and sample_data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}},"patch":{"operationId":"updateTemplate","tags":["Templates"],"summary":"Update a template","description":"Send only the fields to change. settings is replaced as a whole. Starters are read-only.","parameters":[{"name":"id","in":"path","required":true,"description":"A template id (tpl_...) or a starter id such as \"invoice\".","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateInput"}}}},"responses":{"200":{"description":"The updated template.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}},"delete":{"operationId":"deleteTemplate","tags":["Templates"],"summary":"Delete a template","parameters":[{"name":"id","in":"path","required":true,"description":"A template id (tpl_...) or a starter id such as \"invoice\".","schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","required":["object","id","deleted"],"properties":{"object":{"const":"template"},"id":{"type":"string"},"deleted":{"const":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{id}/duplicate":{"post":{"operationId":"duplicateTemplate","tags":["Templates"],"summary":"Duplicate a template","parameters":[{"name":"id","in":"path","required":true,"description":"A template id (tpl_...) or a starter id such as \"invoice\".","schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"The copy.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/templates/{id}/revise":{"post":{"operationId":"reviseTemplate","tags":["Templates"],"summary":"Revise a template with AI","description":"Applies a plain-English change to an HTML template. Uses one AI generation.","parameters":[{"name":"id","in":"path","required":true,"description":"A template id (tpl_...) or a starter id such as \"invoice\".","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string","description":"The change to make."},"save":{"type":"boolean","default":true,"description":"Set false to get the revision back as a draft and leave the saved template alone."},"html":{"type":"string","description":"Optional working copy to revise instead of the saved version."},"css":{"type":"string"},"settings":{"$ref":"#/components/schemas/TemplateSettings"},"sample_data":{}}},"example":{"prompt":"Add a PO number under the date and make it Letter size."}}}},"responses":{"200":{"description":"The updated template, or a draft when save is false or the template is a starter.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Template"},{"$ref":"#/components/schemas/TemplateDraft"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/pdf/merge":{"post":{"operationId":"mergePdfs","tags":["PDF tools"],"summary":"Merge PDFs","description":"Joins 2 to 50 PDFs into one, in order. Counts as one document.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["files"],"properties":{"files":{"type":"array","minItems":2,"maxItems":50,"items":{"type":"string","description":"A PDF given as a document id (doc_...), a public https URL, or base64 content (a data: URI also works). Up to 30 MB."}},"metadata":{"type":"object","description":"Document properties written into the PDF.","properties":{"title":{"type":"string"},"author":{"type":"string"},"subject":{"type":"string"},"keywords":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"creator":{"type":"string"}}},"output":{"type":"string","enum":["url","file","base64"],"default":"url","description":"\"url\" returns a document with a download link. \"base64\" also includes the file in the JSON. \"file\" returns the raw PDF and stores nothing."},"filename":{"type":"string","description":"File name without extension."}}},"example":{"files":["doc_nWWGc4ehhC44vpOsHFGn","https://example.com/terms.pdf"],"filename":"order-8813"}}}},"responses":{"200":{"description":"The merged document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/pdf/split":{"post":{"operationId":"splitPdf","tags":["PDF tools"],"summary":"Split a PDF","description":"Cuts one PDF into several. Each output file counts as one document. \"output\": \"file\" is not available because there are several files.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"A PDF given as a document id (doc_...), a public https URL, or base64 content (a data: URI also works). Up to 30 MB."},"ranges":{"type":"array","items":{"type":"string"},"description":"One output file per range: \"3\", \"1-3\", \"4-\" or \"-2\"."},"every":{"type":"integer","minimum":1,"default":1,"description":"Instead of ranges: one file per this many pages."},"password":{"type":"string","description":"The password, if the PDF is protected."},"output":{"type":"string","enum":["url","file","base64"],"default":"url","description":"\"url\" returns a document with a download link. \"base64\" also includes the file in the JSON. \"file\" returns the raw PDF and stores nothing."},"filename":{"type":"string","description":"File name without extension."}}},"example":{"file":"doc_nWWGc4ehhC44vpOsHFGn","ranges":["1-3","4-"]}}}},"responses":{"200":{"description":"One document per part.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"split":{"const":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/pdf/protect":{"post":{"operationId":"protectPdf","tags":["PDF tools"],"summary":"Protect a PDF","description":"Adds a password and permissions. Counts as one document.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"A PDF given as a document id (doc_...), a public https URL, or base64 content (a data: URI also works). Up to 30 MB."},"password":{"type":"string","description":"Needed to open the file."},"owner_password":{"type":"string","description":"Needed to change permissions. Defaults to password."},"permissions":{"type":"object","description":"What a reader may do without the owner password. Takes effect when a password is set.","properties":{"printing":{"type":"boolean","default":true},"copying":{"type":"boolean","default":true},"annotating":{"type":"boolean","default":true},"filling_forms":{"type":"boolean","default":true},"modifying":{"type":"boolean","default":false}}},"current_password":{"type":"string","description":"The existing password, if the file is already protected."},"output":{"type":"string","enum":["url","file","base64"],"default":"url","description":"\"url\" returns a document with a download link. \"base64\" also includes the file in the JSON. \"file\" returns the raw PDF and stores nothing."},"filename":{"type":"string","description":"File name without extension."}}}}}},"responses":{"200":{"description":"The protected document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/pdf/fill":{"post":{"operationId":"fillPdf","tags":["PDF tools"],"summary":"Fill a PDF form","description":"Fills form fields by name. Counts as one document.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["file","fields"],"properties":{"file":{"type":"string","description":"A PDF given as a document id (doc_...), a public https URL, or base64 content (a data: URI also works). Up to 30 MB."},"fields":{"type":"object","additionalProperties":true,"description":"Field name to value. Text takes a string, checkboxes take true or false, dropdowns and radio groups take the option to select."},"flatten":{"type":"boolean","default":false,"description":"Make the values permanent and remove the fields."},"password":{"type":"string","description":"The password, if the PDF is protected."},"output":{"type":"string","enum":["url","file","base64"],"default":"url","description":"\"url\" returns a document with a download link. \"base64\" also includes the file in the JSON. \"file\" returns the raw PDF and stores nothing."},"filename":{"type":"string","description":"File name without extension."}}},"example":{"file":"https://example.com/forms/w9.pdf","fields":{"name":"Dana Whitfield","agree":true},"flatten":true}}}},"responses":{"200":{"description":"The filled document, with the names of the fields that were filled and those that do not exist in the PDF.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Document"}],"properties":{"filled":{"type":"array","items":{"type":"string"}},"unknown_fields":{"type":"array","items":{"type":"string"}}}}},"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/pdf/fields":{"post":{"operationId":"listPdfFields","tags":["PDF tools"],"summary":"List a PDF's form fields","description":"Returns the name and type of every form field. Produces no document and is not counted.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"A PDF given as a document id (doc_...), a public https URL, or base64 content (a data: URI also works). Up to 30 MB."},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"The fields.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/FormField"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List webhook endpoints","responses":{"200":{"description":"Your endpoints, and the event types you can subscribe to.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}},"event_types":{"type":"array","items":{"$ref":"#/components/schemas/EventType"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Add a webhook endpoint","description":"Up to 10 endpoints per account. The response includes your signing secret.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"A public https URL."},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventType"},"description":"Event types to receive. Leave out to receive all of them."}}},"example":{"url":"https://example.com/hooks/devilpdf","events":["document.succeeded","document.failed"]}}}},"responses":{"201":{"description":"The new endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/webhooks/{id}":{"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Remove a webhook endpoint","parameters":[{"name":"id","in":"path","required":true,"description":"The webhook id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","required":["object","id","deleted"],"properties":{"object":{"const":"webhook"},"id":{"type":"string"},"deleted":{"const":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/embed-tokens":{"post":{"operationId":"createEmbedToken","tags":["Embed"],"summary":"Create an embed token","description":"Creates a short-lived token that lets one of your users edit one template in an iframe. Pro and Scale plans.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["template"],"properties":{"template":{"type":"string","description":"An HTML template on your account. Starters must be copied first."},"expires_in":{"type":"integer","minimum":60,"maximum":86400,"default":3600,"description":"Seconds the token is valid."}}},"example":{"template":"tpl_8sK2mQx7Lp0aVn3RtYc1","expires_in":3600}}}},"responses":{"201":{"description":"The token and the URL to load in an iframe.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbedToken"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/usage":{"get":{"operationId":"getUsage","tags":["Account"],"summary":"Get usage","description":"Documents and AI generations used this month, and what is left.","responses":{"200":{"description":"This month's usage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/account":{"get":{"operationId":"getAccount","tags":["Account"],"summary":"Get the account","responses":{"200":{"description":"Your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/plans":{"get":{"operationId":"listPlans","tags":["Account"],"summary":"List plans","responses":{"200":{"description":"The plans and their limits.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"webhooks":{"event":{"post":{"operationId":"onEvent","summary":"Document or batch finished","description":"Sent to each of your webhook endpoints. Verify the devilpdf-signature header: t=<unix timestamp>,v1=<hex HMAC-SHA256 of `${t}.${rawBody}` with your signing secret>. Respond with any 2xx within 15 seconds. Failed deliveries are retried.","security":[],"parameters":[{"name":"devilpdf-signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"devilpdf-event","in":"header","required":true,"schema":{"$ref":"#/components/schemas/EventType"}},{"name":"devilpdf-event-id","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Acknowledged."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"An API key from the dashboard, sent as: Authorization: Bearer dp_live_..."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","message"],"additionalProperties":true,"properties":{"type":{"type":"string","enum":["invalid_request","unauthorized","forbidden","not_found","template_error","render_error","render_timeout","quota_exceeded","plan_limit","rate_limited","payload_too_large","ai_unavailable","ai_refused","not_configured","internal_error"],"description":"Stable, machine-readable error name."},"message":{"type":"string","description":"What went wrong, written for a person."},"line":{"type":"integer","description":"template_error: line of the problem, when known."},"col":{"type":"integer","description":"template_error: column of the problem, when known."},"limit":{"type":"integer","description":"quota_exceeded: your plan's monthly allowance."},"resets_at":{"type":"string","format":"date-time","description":"quota_exceeded: when the allowance resets."},"retryable":{"type":"boolean","description":"render_error: true when the same request is likely to work on a second try."}}}}},"RenderOptions":{"type":"object","description":"Page setup and capture options. All optional. For a template, values here override the template's settings for this render.","properties":{"page_size":{"type":"string","enum":["A3","A4","A5","Letter","Legal","Tabloid"],"default":"A4"},"orientation":{"type":"string","enum":["portrait","landscape"],"default":"portrait"},"margin":{"type":"string","default":"15mm 16mm 17mm","description":"One to four CSS lengths, like the CSS margin shorthand. Units: mm, cm, in, pt, px."},"font":{"type":"string","enum":["inter","source-serif","jetbrains-mono","system"],"default":"inter","description":"Body font. Templates and print kit documents only."},"heading_font":{"type":"string","enum":["inter","source-serif","jetbrains-mono","system"],"description":"Font for headings. Defaults to the body font."},"accent":{"type":"string","default":"#111827","description":"Accent colour as hex."},"page_numbers":{"type":"boolean","default":false,"description":"Print \"1 / 3\" in the bottom right of every page."},"header_text":{"type":"string","maxLength":200,"description":"Short text at the top left of every page."},"footer_text":{"type":"string","maxLength":200,"description":"Short text at the bottom left of every page."},"kit":{"type":"boolean","description":"html only: include the print kit (fonts, table and layout classes). Off by default for raw HTML."},"javascript":{"type":"boolean","description":"html only: run scripts in the HTML before capture. Off by default."},"media":{"type":"string","enum":["print","screen"],"description":"CSS media type. Defaults to print for PDFs from templates and HTML, screen for URLs and images."},"wait_for":{"type":"string","description":"A CSS selector. Capture waits until an element matches."},"delay":{"type":"integer","minimum":0,"maximum":10000,"description":"Extra milliseconds to wait before capture."},"scale":{"type":"number","minimum":0.1,"maximum":2,"description":"PDF only: zoom factor."},"page_ranges":{"type":"string","description":"PDF only: pages to keep, for example \"1-3, 5\"."},"width":{"type":"integer","minimum":16,"maximum":4000,"description":"Images only: viewport width in CSS pixels."},"height":{"type":"integer","minimum":16,"maximum":8000,"description":"Images only: viewport height in CSS pixels."},"device_scale":{"type":"number","minimum":1,"maximum":3,"description":"Images only: pixel density. Default 2 for templates, otherwise 1."},"full_page":{"type":"boolean","default":true,"description":"Images only: capture the whole scrollable page."},"quality":{"type":"integer","minimum":1,"maximum":100,"default":90,"description":"Images only: compression quality for jpeg and webp."},"transparent":{"type":"boolean","default":false,"description":"Images only: transparent background. png and webp."},"selector":{"type":"string","description":"Images only: capture just the first element matching this CSS selector."}}},"PdfOptions":{"type":"object","description":"PDF only. Using it with an image format returns invalid_request.","properties":{"password":{"type":"string","description":"Password needed to open the file (AES-256)."},"owner_password":{"type":"string","description":"Password needed to change permissions. Defaults to the open password."},"permissions":{"type":"object","description":"What a reader may do without the owner password. Takes effect when a password is set.","properties":{"printing":{"type":"boolean","default":true},"copying":{"type":"boolean","default":true},"annotating":{"type":"boolean","default":true},"filling_forms":{"type":"boolean","default":true},"modifying":{"type":"boolean","default":false}}},"metadata":{"type":"object","description":"Document properties written into the PDF.","properties":{"title":{"type":"string"},"author":{"type":"string"},"subject":{"type":"string"},"keywords":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"creator":{"type":"string"}}},"form":{"type":"boolean","description":"Turn field placeholders into fillable form fields."},"watermark":{"description":"Text stamped across every page, for example \"DRAFT\". Pass a string, or an object to control how it looks. Latin letters, digits and punctuation only.","oneOf":[{"type":"string","maxLength":60},{"type":"object","required":["text"],"properties":{"text":{"type":"string","maxLength":60},"opacity":{"type":"number","minimum":0.02,"maximum":1,"default":0.12},"angle":{"type":"number","minimum":-90,"maximum":90,"default":45,"description":"Degrees, counter-clockwise."},"color":{"type":"string","default":"#6b7280","description":"Hex colour."}}}]}}},"RenderRequest":{"type":"object","description":"Pass exactly one source: template, html or url.","properties":{"template":{"type":"string","description":"Source: a saved template id (tpl_...) or a starter: \"invoice\", \"quote\", \"certificate\". Pass exactly one of template, html, url."},"html":{"type":"string","description":"Source: HTML to render. Pass exactly one of template, html, url."},"url":{"type":"string","format":"uri","description":"Source: a public web page to capture. Pass exactly one of template, html, url."},"data":{"type":"object","additionalProperties":true,"description":"JSON merged into the template. With html, sending data turns the HTML into an inline template."},"css":{"type":"string","description":"Extra CSS. Used with html."},"format":{"type":"string","enum":["pdf","png","jpeg","webp"],"default":"pdf"},"output":{"type":"string","enum":["url","file","base64"],"default":"url","description":"\"url\" returns a document with a download link. \"file\" returns the raw bytes and stores nothing. \"base64\" returns the document with the file in a base64 field."},"locale":{"type":"string","description":"Language tag such as \"en-US\", \"fr-CA\", \"de-DE\", \"ja-JP\" or \"ar\". Sets money, number and date formats, the label language on starter templates, the fonts, and right-to-left layout for Arabic, Hebrew, Persian and Urdu. Default en-US.","example":"fr-CA"},"direction":{"type":"string","enum":["auto","ltr","rtl"],"description":"Text direction. auto (the default) follows the locale."},"options":{"$ref":"#/components/schemas/RenderOptions"},"pdf":{"$ref":"#/components/schemas/PdfOptions"},"filename":{"type":"string","description":"File name without extension. Defaults to the template name."},"expires_in":{"type":"integer","minimum":60,"description":"Seconds the download link stays valid. The maximum, and the default, is your plan's retention."},"destination":{"type":"string","enum":["s3"],"description":"Deliver the file to your own bucket instead of hosted storage. Paid plans."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"maxProperties":20,"description":"Your own key/value pairs, returned on the document and in webhooks. Keys up to 60 characters, values up to 500."},"webhook_url":{"type":"string","format":"uri","description":"An https URL to notify when this document succeeds or fails, in addition to your webhook endpoints."},"async":{"type":"boolean","default":false,"description":"Return 202 immediately and render in the background."}}},"BatchRequest":{"type":"object","required":["items"],"description":"Shared render fields at the top level, plus one entry in items per document. Each item can override any shared field. Output is always a hosted link.","properties":{"template":{"type":"string","description":"Source: a saved template id (tpl_...) or a starter: \"invoice\", \"quote\", \"certificate\". Pass exactly one of template, html, url."},"html":{"type":"string","description":"Source: HTML to render. Pass exactly one of template, html, url."},"url":{"type":"string","format":"uri","description":"Source: a public web page to capture. Pass exactly one of template, html, url."},"data":{"type":"object","additionalProperties":true,"description":"JSON merged into the template. With html, sending data turns the HTML into an inline template."},"css":{"type":"string","description":"Extra CSS. Used with html."},"format":{"type":"string","enum":["pdf","png","jpeg","webp"],"default":"pdf"},"output":{"type":"string","enum":["url","file","base64"],"default":"url","description":"\"url\" returns a document with a download link. \"file\" returns the raw bytes and stores nothing. \"base64\" returns the document with the file in a base64 field."},"locale":{"type":"string","description":"Language tag such as \"en-US\", \"fr-CA\", \"de-DE\", \"ja-JP\" or \"ar\". Sets money, number and date formats, the label language on starter templates, the fonts, and right-to-left layout for Arabic, Hebrew, Persian and Urdu. Default en-US.","example":"fr-CA"},"direction":{"type":"string","enum":["auto","ltr","rtl"],"description":"Text direction. auto (the default) follows the locale."},"options":{"$ref":"#/components/schemas/RenderOptions"},"pdf":{"$ref":"#/components/schemas/PdfOptions"},"filename":{"type":"string","description":"File name without extension. Defaults to the template name."},"expires_in":{"type":"integer","minimum":60,"description":"Seconds the download link stays valid. The maximum, and the default, is your plan's retention."},"destination":{"type":"string","enum":["s3"],"description":"Deliver the file to your own bucket instead of hosted storage. Paid plans."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"maxProperties":20,"description":"Your own key/value pairs, returned on the document and in webhooks. Keys up to 60 characters, values up to 500."},"webhook_url":{"type":"string","format":"uri","description":"An https URL to notify when this document succeeds or fails, in addition to your webhook endpoints."},"items":{"type":"array","minItems":1,"maxItems":1000,"description":"One object per document, usually with its own data, filename and metadata. The maximum depends on your plan: 25 on Free, 100 on Starter, 500 on Growth, 1,000 on Business and Scale.","items":{"type":"object","additionalProperties":true}}}},"Document":{"type":"object","required":["object","id","status","format"],"properties":{"object":{"const":"document"},"id":{"type":"string","examples":["doc_nWWGc4ehhC44vpOsHFGn"]},"status":{"type":"string","enum":["queued","processing","succeeded","failed"]},"format":{"type":"string","enum":["pdf","png","jpeg","webp","docx","xlsx"]},"url":{"type":["string","null"],"description":"Signed download link. null when nothing is stored or the link has expired. For S3 delivery, the object's URL in your bucket."},"filename":{"type":["string","null"]},"pages":{"type":["integer","null"],"description":"Page count. null for images."},"bytes":{"type":["integer","null"]},"duration_ms":{"type":["integer","null"]},"template":{"type":["string","null"],"description":"Template id, when rendered from a template."},"source":{"type":"string","enum":["template","html","url","tool"]},"batch":{"type":["string","null"],"description":"Batch id, when part of a batch."},"metadata":{"type":["object","null"],"additionalProperties":{"type":"string"}},"error":{"type":["object","null"],"description":"Set when status is failed.","properties":{"type":{"type":"string"},"message":{"type":"string"}}},"expires_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"base64":{"type":"string","description":"The file, base64 encoded. Only with \"output\": \"base64\"."}}},"Batch":{"type":"object","required":["object","id","status","total"],"properties":{"object":{"const":"batch"},"id":{"type":"string","examples":["batch_eKcpMkp96fGjxDtcjhdw"]},"status":{"type":"string","enum":["queued","processing","completed"]},"total":{"type":"integer"},"succeeded":{"type":"integer","description":"Returned by GET /v1/batches/{id}."},"failed":{"type":"integer","description":"Returned by GET /v1/batches/{id}."},"documents":{"type":"array","description":"Returned when the batch is created: one entry per item, in order.","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}}}}}},"TemplateSettings":{"type":"object","description":"Page setup stored with a template.","properties":{"page_size":{"type":"string","enum":["A3","A4","A5","Letter","Legal","Tabloid"],"default":"A4"},"orientation":{"type":"string","enum":["portrait","landscape"],"default":"portrait"},"margin":{"type":"string","default":"15mm 16mm 17mm","description":"One to four CSS lengths, like the CSS margin shorthand. Units: mm, cm, in, pt, px."},"font":{"type":"string","enum":["inter","source-serif","jetbrains-mono","system"],"default":"inter","description":"Body font. Templates and print kit documents only."},"heading_font":{"type":"string","enum":["inter","source-serif","jetbrains-mono","system"],"description":"Font for headings. Defaults to the body font."},"accent":{"type":"string","default":"#111827","description":"Accent colour as hex."},"page_numbers":{"type":"boolean","default":false,"description":"Print \"1 / 3\" in the bottom right of every page."},"header_text":{"type":"string","maxLength":200,"description":"Short text at the top left of every page."},"footer_text":{"type":"string","maxLength":200,"description":"Short text at the bottom left of every page."}}},"Template":{"type":"object","required":["object","id","name","kind"],"properties":{"object":{"const":"template"},"id":{"type":"string","examples":["tpl_8sK2mQx7Lp0aVn3RtYc1","invoice"]},"name":{"type":"string"},"description":{"type":"string"},"kind":{"type":"string","enum":["html","docx","xlsx"]},"settings":{"$ref":"#/components/schemas/TemplateSettings"},"source":{"type":"string","enum":["blank","starter","ai","upload"]},"starter":{"type":"boolean","description":"true for the built-in, read-only starters."},"version":{"type":"integer","description":"Starts at 1 and goes up by one on every update."},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"html":{"type":"string","description":"Template body. Left out of list responses."},"css":{"type":"string","description":"Left out of list responses."},"sample_data":{"description":"Example JSON for the template. Left out of list responses."}}},"TemplateInput":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":"string","maxLength":500},"html":{"type":"string","maxLength":600000,"description":"Template body, with template language placeholders."},"css":{"type":"string","maxLength":300000},"settings":{"$ref":"#/components/schemas/TemplateSettings"},"sample_data":{"description":"Any JSON."}}},"TemplateDraft":{"type":"object","description":"An unsaved template returned by the AI endpoints when save is false.","properties":{"object":{"const":"template_draft"},"name":{"type":"string"},"description":{"type":"string"},"html":{"type":"string"},"css":{"type":"string"},"settings":{"$ref":"#/components/schemas/TemplateSettings"},"sample_data":{}}},"Webhook":{"type":"object","required":["object","id","url","events"],"properties":{"object":{"const":"webhook"},"id":{"type":"string","examples":["whk_PGgbPmNMKw0a1shpuiPu"]},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},"enabled":{"type":"boolean"},"last_status":{"type":["integer","null"],"description":"HTTP status of the most recent delivery. 0 means the server could not be reached."},"last_attempt_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"signing_secret":{"type":"string","description":"Returned when the endpoint is created. The same secret signs every event for the account."}}},"EventType":{"type":"string","enum":["document.succeeded","document.failed","batch.completed"]},"WebhookEvent":{"type":"object","description":"The body DevilPDF posts to your webhook endpoints.","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","examples":["evt_dUo8MnOy2yAozbGdRGKx"]},"type":{"$ref":"#/components/schemas/EventType"},"created_at":{"type":"string","format":"date-time"},"data":{"description":"A document for document.* events, or a batch summary for batch.completed.","oneOf":[{"$ref":"#/components/schemas/Document"},{"$ref":"#/components/schemas/Batch"}]}}},"EmbedToken":{"type":"object","properties":{"object":{"const":"embed_token"},"token":{"type":"string"},"template":{"type":"string"},"url":{"type":"string","format":"uri","description":"Load this in an iframe."},"expires_at":{"type":"string","format":"date-time"}}},"Usage":{"type":"object","properties":{"object":{"const":"usage"},"plan":{"type":"string","enum":["free","starter","growth","business","scale"]},"period":{"type":"string","examples":["2026-03"]},"resets_at":{"type":"string","format":"date-time"},"documents":{"$ref":"#/components/schemas/Allowance"},"ai_generations":{"$ref":"#/components/schemas/Allowance"},"templates":{"type":"object","properties":{"limit":{"type":["integer","null"],"description":"null means unlimited."}}},"daily":{"type":"array","description":"Documents per day for the last 30 days. Days without documents are left out.","items":{"type":"object","properties":{"day":{"type":"string","format":"date"},"documents":{"type":"integer"}}}}}},"Allowance":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":"integer"},"remaining":{"type":"integer"}}},"Account":{"type":"object","properties":{"object":{"const":"account"},"id":{"type":"string"},"email":{"type":"string","format":"email"},"plan":{"type":"string","enum":["free","starter","growth","business","scale"]},"subscription_status":{"type":["string","null"]},"storage_region":{"type":"string","enum":["auto","eu"]},"s3_configured":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}}},"Plan":{"type":"object","properties":{"id":{"type":"string","enum":["free","starter","growth","business","scale"]},"name":{"type":"string"},"price":{"type":"number","description":"USD per month."},"documents":{"type":"integer","description":"Documents per month."},"templates":{"type":["integer","null"],"description":"Saved templates. null means unlimited."},"ai_generations":{"type":"integer","description":"AI generations per month."},"retention_hours":{"type":"integer","description":"How long hosted files and links are kept."},"batch_size":{"type":"integer","description":"Largest batch."},"max_payload":{"type":"integer","description":"Largest html accepted by a render, in bytes."},"features":{"type":"object","properties":{"s3":{"type":"boolean"},"pdf_tools":{"type":"boolean"},"embed":{"type":"boolean"},"eu_storage":{"type":"boolean"}}}}},"FormField":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["text","checkbox","dropdown","radio","list","signature","unknown"]}}}},"responses":{"BadRequest":{"description":"invalid_request: the request is malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"invalid_request","message":"Pass one of \"template\" (a template id), \"html\" (raw HTML) or \"url\" (a page to capture)."}}}}},"Unauthorized":{"description":"unauthorized: the API key is missing or not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"unauthorized","message":"Missing API key. Send it as: Authorization: Bearer dp_live_..."}}}}},"Forbidden":{"description":"plan_limit or forbidden: not included in your plan, or not allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"plan_limit","message":"The embeddable editor is available on the Growth plan and up."}}}}},"NotFound":{"description":"not_found: no such object on your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"not_found","message":"Template \"tpl_missing\" not found."}}}}},"PayloadTooLarge":{"description":"payload_too_large: the body, a field or an input file is over the size limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"payload_too_large","message":"The request body is too large."}}}}},"Unprocessable":{"description":"template_error, render_error or ai_refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"template_error","message":"undefined filter: currancy"}}}}},"TooManyRequests":{"description":"quota_exceeded or rate_limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"rate_limited","message":"Too many requests. The limit is 600 per minute per account; slow down and retry."}}}}},"ServerError":{"description":"internal_error: something went wrong on our side.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"internal_error","message":"Something went wrong on our side."}}}}},"Unavailable":{"description":"ai_unavailable or not_configured: temporarily unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"ai_unavailable","message":"The template generator is busy. Try again in a moment. This attempt was not counted."}}}}},"Timeout":{"description":"render_timeout: the render ran out of time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"render_timeout","message":"Rendering took too long and was stopped. Check for slow images or fonts, or a wait_for selector that never appears."}}}}}}}}