Skip to content

Render HTML to PDF

POST
/render
curl --request POST \
--url https://necodoc.example.com/api/v1/render \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "html": "example", "css": "example", "themeId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "header": { "html": "example", "height": 1, "firstPageHtml": "example" }, "footer": { "html": "example", "height": 1, "firstPageHtml": "example" }, "page": { "size": "Letter", "orientation": "portrait", "margins": { "top": 20, "right": 20, "bottom": 20, "left": 20 } }, "data": {}, "filename": "example", "partials": { "additionalProperty": "example" }, "signers": [ { "id": "example", "role": "example", "routingOrder": 1, "name": "", "email": "" } ], "output": { "pdfa": null, "pdfua": false, "certify": false, "lang": "en" }, "translations": { "additionalProperty": { "additionalProperty": "example" } }, "response": "pdf", "async": false, "signing": true, "subject": "example" }'

HTML with Liquid (rendered with data), optional CSS, theme, header and footer bands, and page setup. output.lang is the document language: date, number and currency format for it, t looks text up in translations, and right-to-left languages lay out right to left. Logged in the generation log with source api.

Media typeapplication/json

HTML (Liquid allowed) to render as a PDF.

object
html
required
string
>= 1 characters
css
string
themeId
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
header
object
html
required
string
height
required
number
> 0 <= 200
firstPageHtml
string
footer
object
html
required
string
height
required
number
> 0 <= 200
firstPageHtml
string
page
object
size
string
default: Letter
Allowed values: Letter A4 Legal
orientation
string
default: portrait
Allowed values: portrait landscape
margins
object
top
required
number
<= 200
right
required
number
<= 200
bottom
required
number
<= 200
left
required
number
<= 200
data
object
key
additional properties
filename
string
>= 1 characters <= 200 characters
partials
object
key
additional properties
string
signers
Array<object>
<= 50 items
object
id
required
string
<= 64 characters /^[a-z][a-z0-9_]*$/
role
required
string
>= 1 characters <= 100 characters
routingOrder
integer
default: 1 >= 1 <= 100
name
string
"" <= 1000 characters
email
string
"" <= 1000 characters
output

PDF/A, PDF/UA, certification and the document language.

object
pdfa
Any of:
string
Allowed values: 2b 2u
pdfua

Tagged PDF/UA-1. HTML renders only: overlays and packets have no structure to tag.

boolean
certify

Certify with the server’s certificate (PAdES, DocMDP: form filling and signing stay allowed).

boolean
lang

The document language (BCP 47): date, number and currency formatting, translations, text direction, and the PDF language.

string
default: en /^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/
translations

Per language, source text to its translation: { "fr": { "Invoice": "Facture" } }.

object
key
additional properties
object
key
additional properties
string
<= 20000 characters
response

pdf returns the bytes; json returns the generation and a link.

string
default: pdf
Allowed values: pdf json
async

Answer 202 with the generation id at once instead of waiting.

boolean
signing
Any of:
boolean
subject

Who the document is about (an email, a customer number), for erasure.

string
>= 1 characters <= 200 characters

Rendered. response: pdf (default) returns the bytes; response: json returns the generation. With signing, the signing package.

string format: binary
X-Generation-Id
string

The generation log entry.

X-Page-Count
integer

Pages in the PDF.

Still queued or running (async, or the wait ran out). Poll the generation.

Media typeapplication/json
object
generationId
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
status
required
string
Allowed values: queued running success error cancelled

Example

{
"status": "queued"
}

Missing, unknown, revoked or expired key, or the key’s account is disabled.

Media typeapplication/json
object
error
required
string
code
required
string
fieldErrors
object
key
additional properties
Array<string>
generationId
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/

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.

Media typeapplication/json
object
error
required
string
code
required
string
fieldErrors
object
key
additional properties
Array<string>
generationId
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/

Example generated

{
"error": "example",
"code": "example",
"fieldErrors": {
"additionalProperty": [
"example"
]
},
"generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Invalid request or data; fieldErrors lists each.

Media typeapplication/json
object
error
required
string
code
required
string
fieldErrors
object
key
additional properties
Array<string>
generationId
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/

Example generated

{
"error": "example",
"code": "example",
"fieldErrors": {
"additionalProperty": [
"example"
]
},
"generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Rate limit exceeded.

Media typeapplication/json
object
error
required
string
code
required
string
fieldErrors
object
key
additional properties
Array<string>
generationId
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/

Example generated

{
"error": "example",
"code": "example",
"fieldErrors": {
"additionalProperty": [
"example"
]
},
"generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}
Retry-After
integer

Seconds until the key may call again.