Generate a PDF from a template
const url = 'https://necodoc.example.com/api/v1/templates/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/versions/latest/generate';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"data":{},"filename":"example","async":false,"output":{"pdfa":"2b","pdfua":true,"certify":true,"lang":"example"},"subject":"example","response":"pdf","signing":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://necodoc.example.com/api/v1/templates/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/versions/latest/generate \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "data": {}, "filename": "example", "async": false, "output": { "pdfa": "2b", "pdfua": true, "certify": true, "lang": "example" }, "subject": "example", "response": "pdf", "signing": true }'Validates data against the version’s fields (422 with every field error), then renders it. output.lang makes the PDF in another language than the template’s: formatting, the template’s translations and text direction follow it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Data for a published template version.
object
object
Answer 202 with the generation id at once instead of waiting.
Overrides the version’s output settings. lang makes the PDF in that language (formatting, translations, text direction).
object
Tagged PDF/UA-1. HTML renders only: overlays and packets have no structure to tag.
Certify with the server’s certificate (PAdES, DocMDP: form filling and signing stay allowed).
The document language (BCP 47): date, number and currency formatting, translations, text direction, and the PDF language.
Who the document is about (an email, a customer number), for erasure.
pdf returns the bytes; json returns the generation and a link.
object
Provider JSON to include.
Keep the invisible anchor text in the PDF. false costs one more Chromium pass.
Put the PDF in provider JSON as base64 (DocuSign documentBase64).
DocuSign tabs by page coordinates, or by anchor string.
Responses
Section titled “Responses”Rendered. response: pdf (default) returns the bytes; response: json returns the generation. With signing, the signing package.
object
Signed; works without a key for 1 hour.
/api/v1/generations/{id}/pdf, with a key.
The PDF’s signers and sign boxes, for an e-sign provider.
object
A signer, with name and email rendered from the data.
object
object
PDF points in the page’s user space, origin bottom-left (what pdf-lib uses).
object
Points (pixels at 72 dpi) from the top-left of the page as displayed (DocuSign, Dropbox Sign, Adobe Sign).
object
Fractions (0..1) of the displayed page, origin top-left.
object
Invisible text at the box’s top-left corner, for anchor-based tab placement. Null when the PDF has none.
object
Signed; works without a key for 1 hour.
/api/v1/generations/{id}/pdf, with a key.
Provider JSON, as asked for in formats.
object
DocuSign eSignature v2.1 envelope definition: POST it to /restapi/v2.1/accounts/{accountId}/envelopes.
object
Dropbox Sign signers and form_fields_per_document for /signature_request/send.
object
Adobe Acrobat Sign participantSetsInfo (POST /agreements) and formFields (PUT /agreements/{id}/formFields).
object
Example
{ "status": "success"}Headers
Section titled “Headers”The generation log entry.
Pages in the PDF.
Still queued or running (async, or the wait ran out). Poll the generation.
object
Example
{ "status": "queued"}Missing, unknown, revoked or expired key, or the key’s account is disabled.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}The key lacks the scope, role, template or source address this call needs.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Not found, or not yours.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}The template is archived.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Invalid request or data; fieldErrors lists each.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Rate limit exceeded.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Headers
Section titled “Headers”Seconds until the key may call again.