Skip to content

Generated files

This is the call most integrations are built for: your CRM closes a deal, sends the client’s data to POST /v1/generate, and gets a finished service agreement back as a PDF. The other endpoints here read the record each generation leaves, download a saved PDF and keep the list tidy. They do what the Generated files tab does in the app.

To manage the templates themselves, go to Templates.

Northbridge Advisory keeps its deals in a CRM. When a deal closes, the service agreement should appear there without anyone opening Doxtly. Here is how that usually comes together:

  1. Someone designs the template in the app and copies its identifier with Copy ID.
  2. While building the integration, a developer calls data_structure once to see which values the template needs, and maps them to CRM fields.
  3. On each closed deal, the CRM sends the client’s data to POST /v1/generate and attaches the PDF it gets back to the deal.
  4. Once a day, a small job reads the failed generations and tells someone, since a template edited in the meantime may now ask for a value the CRM does not send.

A key made for this needs only Generate document, Read template and List generated files. Give a key no more than its job takes.

The overview explains sending requests and lists, and the errors page the errors every endpoint can answer. Each list below names the fields it accepts. Authentication explains how keys work.

POST/v1/generate

Available when: you are within your plan's limit of document generation for this billing period, or your subscription allows overage

Fills a template with your data and answers with a finished PDF. The call waits until the document is ready, so you have the file in the response.

Key permission: generate_document

Headers

Header Value
X-Api-Key The key.
X-Api-Secret Its secret.
Content-Type application/json
Accept application/json: the answer is JSON with the PDF inside as base64. Anything else, or no header: the answer is the PDF itself.
Field Type Required Rules
templateId string Yes The template’s UUID.
data object Yes The values for the template. Use data_structure to learn what it needs, and Data and variables for how paths work. It can carry _metadata and _params.
filename string No Default document.pdf. It cannot be blank. A name that does not end in .pdf gets the extension, so contract no. 12.2026 becomes contract no. 12.2026.pdf, while Contract.PDF stays as it is. Up to 255 characters, the extension included.
persist boolean No Default false: you get the document, and only a record of it, with the data it was made from, stays in Doxtly. true also saves the file, so you can download it later. Leave it off when your own system keeps the PDF: an unsaved document takes up none of your disk space.
password string No The password that opens the PDF. Fixed text, {{ variables }} from data, or both, as in a workflow. Blank means no password. Doxtly does not keep it.
options object No options.pdf holds page settings, see below. Doxtly ignores anything else here.

options.pdf changes how the PDF is laid out. A PDF template is already laid out, so it ignores all of these, and a Word template only reads landscape.

Option Type Default Applies to Meaning
landscape boolean false Word, SVG Turns the page sideways.
paper_size string A4 SVG A3, A4, A5, Letter or Legal. Any other value sets no size, so stick to these.
print_background boolean true SVG Prints background colors and images.
margin_top, margin_bottom, margin_left, margin_right number none SVG Margins in inches. Send all four, or they are ignored. With none, the drawing reaches the edges of the page.
scale number none SVG How much to scale the page.

Doxtly merges your _metadata with the template’s own, in depth. Where both set the same value, the template’s wins. A [SIGNATURE:...] marker inside a data value does not create a place to sign: only the template decides who signs.

Response with the PDF: 200 with the file. Besides Content-Type: application/pdf, Content-Disposition and Content-Length, the header X-Generation-Time gives the time taken in seconds.

Response with Accept: application/json: 200.

Field Type Meaning
templateType string word, svg or pdf.
isPersisted boolean Whether the file was saved.
hasPassword boolean Whether the PDF needs a password to open.
filename string The file’s name.
fileSize integer Its size in bytes.
fileId string or null The saved file’s identifier. null if it was not saved.
fileContent string The PDF as base64, also when it was saved.
metadata.generationTime number The time taken in seconds.
metadata.templateMetadata object The template’s metadata. Left out when it has none.

When storage is full. If you ask for persist: true and your organization’s disk space cannot hold the file, you still get the document. isPersisted is false, fileId is null, and your organization gets a notification. Check isPersisted if you rely on the saved copy.

What a generation sets off. It counts towards your plan only if it succeeds. It appears in the list of generated files, updates the template’s lastUsedAt, and starts any workflow with a Document generated trigger for this template. If the template follows a cloud file, Doxtly also looks at that file soon after, unless it just did. The document itself always comes from the approved copy.

Sending a request twice. This endpoint has no way to recognize a repeat. Every successful call makes a new document, adds a row to the list and counts towards your plan. If a call times out on your side and you send it again, the first one may have finished too, so check the list before you repeat a call that matters.

Status When Recorded as failed
400 Request data is missing required variables: ..., with the list of them. Yes
400 The password could not be completed: a variable in it is missing, empty or not a single value, or the password came out empty. Yes
403 Your plan does not include generation, or you reached the limit for this billing period and extra documents are not allowed. No
404 The template was not found (Template not found). No
422 Validation failed: templateId missing or not a UUID, data missing or not an object, filename blank (Enter a file name.) or too long, or a field of the wrong type. No
422 The PDF template has manual areas, such as a signature area, which only a person can fill or sign. Use the template in a Create documents workflow step or an interactive document, or change those areas. No
422 The template has a syntax error, or could not be filled in on a given line because the data is missing or shaped differently. detail gives the line. Yes
422 The template uses a tag, filter or function that document templates do not allow. Yes
422 An image in data is not a valid data URI, has no type or a type that is not supported, is over 10 MB, or is not a PNG, JPEG, GIF or BMP for a Word document. Yes
422 The template’s file cannot be read as a Word document. Yes
500 Generation failed on our side, the PDF could not be locked with its password, or the template’s file is missing. If it is missing, upload the file again. Yes
503 The service that renders PDF templates cannot be reached right now. Try again in a moment. Yes

Failures marked Yes add a row with the status error to the generated files. The reason is only in this response, so log it on your side.

The errors every endpoint can answer apply here too.

Get the PDF straight into a file:

Terminal window
curl -X POST 'https://api.doxtly.com/v1/generate' \
-H "X-Api-Key: $DOXTLY_API_KEY" \
-H "X-Api-Secret: $DOXTLY_API_SECRET" \
-H 'Content-Type: application/json' \
-o service-agreement-lakeside.pdf \
-d '{
"templateId": "01a1aaf4-d812-7f81-87f3-a2a24628d795",
"filename": "service-agreement-lakeside.pdf",
"data": {
"agreement": {
"number": "SA/2026/214",
"date": "2026-11-05",
"start_date": "2026-11-16",
"end_date": "2027-11-15",
"payment_days": 14,
"total": "EUR 18,000"
},
"client": {
"name": "Lakeside Clinic",
"address": "Nadbrzeżna 4, 80-822 Gdańsk",
"representative": "Maria Lis",
"vat_id": "PL5851234567"
},
"services": {
"name": "GDPR workshop and follow-up audit",
"delivery": "On site in Gdańsk",
"fee": "EUR 18,000"
}
}
}'

The response is the file itself. Its headers:

HTTP/2 200
content-type: application/pdf
content-disposition: attachment; filename=service-agreement-lakeside.pdf
content-length: 49327
x-generation-time: 0.317

Save the file in Doxtly, lock it with a password and get JSON back:

Terminal window
curl -X POST 'https://api.doxtly.com/v1/generate' \
-H "X-Api-Key: $DOXTLY_API_KEY" \
-H "X-Api-Secret: $DOXTLY_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"templateId": "01a1aaf4-d812-7f81-87f3-a2a24628d795",
"filename": "service-agreement-lakeside.pdf",
"persist": true,
"password": "NB-{{ client.vat_id }}",
"data": {
"agreement": {
"number": "SA/2026/214",
"date": "2026-11-05",
"start_date": "2026-11-16",
"end_date": "2027-11-15",
"payment_days": 14,
"total": "EUR 18,000"
},
"client": {
"name": "Lakeside Clinic",
"address": "Nadbrzeżna 4, 80-822 Gdańsk",
"representative": "Maria Lis",
"vat_id": "PL5851234567"
},
"services": {
"name": "GDPR workshop and follow-up audit",
"delivery": "On site in Gdańsk",
"fee": "EUR 18,000"
}
}
}'

Response 200:

{
"templateType": "word",
"isPersisted": true,
"hasPassword": true,
"filename": "service-agreement-lakeside.pdf",
"fileSize": 45853,
"fileId": "01a1abe4-1c19-737a-b4b8-1ff43bf8f82c",
"fileContent": "JVBERi0xLjcKJb/3ov4KMSAw...",
"metadata": {
"generationTime": 0.1275,
"templateMetadata": { "company": {"name": "Northbridge Advisory sp. z o.o."} }
}
}

Shortened: fileContent holds the whole PDF.

Set the page of an SVG template:

Terminal window
curl -X POST 'https://api.doxtly.com/v1/generate' \
-H "X-Api-Key: $DOXTLY_API_KEY" \
-H "X-Api-Secret: $DOXTLY_API_SECRET" \
-H 'Content-Type: application/json' \
-o commercial-offer.pdf \
-d '{
"templateId": "01a1aaf4-dae7-783f-9518-142ec32fa1e5",
"filename": "commercial-offer-lakeside.pdf",
"options": {
"pdf": {
"paper_size": "A4",
"landscape": false,
"margin_top": 0,
"margin_bottom": 0,
"margin_left": 0,
"margin_right": 0
}
},
"data": {
"offer": { "number": "OF/2026/88", "title": "GDPR workshop", "summary": "One day on site", "total": "EUR 4,200", "valid_until": "2026-12-15", "accept_url": "https://northbridge.example/accept/88" },
"client": { "name": "Lakeside Clinic", "contact": "Maria Lis", "email": "maria.lis@lakesideclinic.example" },
"adviser": { "name": "Piotr Nowak", "email": "piotr.nowak@northbridge.example" },
"items": [{ "name": "GDPR workshop", "days": 1, "rate": "EUR 4,200", "amount": "EUR 4,200" }]
}
}'

Each generation leaves a record, whether or not you saved its file. Failed generations leave one too, except for the failures marked No above. Generated files covers the same list in the app. It also holds what your workflows generate, not only what came through the API.

Field Type Meaning
id string The generation’s identifier.
templateInfo object or null The template: id, name and type.
templateVersion integer or null The template’s version when the document was made. null for documents made before this was recorded.
status string success or error. The app shows them as Successful and Failed.
hasPassword boolean Whether the PDF needs a password. The password itself is not kept.
filename string The file’s name.
generatedFileId string or null The saved file’s identifier, the fileId of the generate response. null when no file was saved.
generatedAt string When it ran.
generationTime string The time taken in seconds, as text with four decimals. Zero for a failure, which the app shows as a dash.
accessKey object or null The key that made it: id and name. null when no key was used, or the key was deleted. Only in the list, not in GET /v1/generated_files/{id}.

GET/v1/generated_files

Reads the generations, a page at a time. Use it for reports, to look for failures, or to find the record of a document you saved.

Key permission: get_generated_files

Headers: X-Api-Key, X-Api-Secret

This list takes the common list parameters.

You can use Fields
filter id, status, filename, generatedAt, generationTime, hasPassword, templateVersion, template.name, template.type, accessKey.name
filter[template][eq] Only the generations of one template, by its id.
filter[accessKey][eq] Only the generations made with one key, by its id. isNull keeps those made without a key.
filter[generatedFile] eq with a saved file’s id finds its record. isNotNull keeps the rows with a saved file and isNull the rows without.
filter[since][gte] Generations from this moment on. It takes gte only, and a date and time with its offset: 2026-10-23T09:30:00+02:00.
search filename, template.name, accessKey.name
sort id, status, filename, generatedAt, generationTime, hasPassword, templateVersion, template.name, template.type, accessKey.name

Response: 200 with items and meta. Each row is a generated file object.

Errors: only the common ones, and 400 for a list parameter it cannot use, including a since value without an offset.

What one key generated in the last week, newest first:

Terminal window
curl -G 'https://api.doxtly.com/v1/generated_files' \
-H "X-Api-Key: $DOXTLY_API_KEY" \
-H "X-Api-Secret: $DOXTLY_API_SECRET" \
--data-urlencode 'filter[accessKey.name][eq]=Partner portal' \
--data-urlencode 'filter[since][gte]=2026-10-29T00:00:00+01:00' \
--data-urlencode 'sort=-generatedAt' \
--data-urlencode 'perPage=2'

Response 200:

{
"items": [
{
"id": "01a1abe4-1a46-74e9-ba21-ad5d4032489b",
"templateInfo": {
"id": "01a1aaf4-d812-7f81-87f3-a2a24628d795",
"name": "Service agreement",
"type": "word"
},
"templateVersion": 1,
"status": "success",
"hasPassword": false,
"filename": "service-agreement-lakeside.pdf",
"generatedFileId": null,
"generatedAt": "2026-11-05T14:26:55+01:00",
"generationTime": "0.3170",
"accessKey": {
"id": "01a1abe1-9d3d-72a7-8339-56612e1646da",
"name": "Partner portal"
}
},
{
"id": "01a1abe4-1c1f-7884-8175-3c30c973d6f8",
"templateInfo": {
"id": "01a1aaf4-d812-7f81-87f3-a2a24628d795",
"name": "Service agreement",
"type": "word"
},
"templateVersion": 1,
"status": "success",
"hasPassword": true,
"filename": "service-agreement-lakeside.pdf",
"generatedFileId": "01a1abe4-1c19-737a-b4b8-1ff43bf8f82c",
"generatedAt": "2026-11-05T14:26:55+01:00",
"generationTime": "0.1275",
"accessKey": {
"id": "01a1abe1-9d3d-72a7-8339-56612e1646da",
"name": "Partner portal"
}
}
],
"meta": {
"total": 2,
"page": 1,
"perPage": 2,
"totalPages": 1,
"hasMore": false,
"hasPrevious": false
}
}

GET/v1/generated_files/{id}

Reads one generation record. It holds the facts about the generation, not the data it was made from.

Key permission: read_generated_file

Headers: X-Api-Key, X-Api-Secret

Path parameter Meaning
id The generation’s identifier. It is not the file’s id.

Response: 200 with the generated file object, without accessKey.

Errors: only the common ones.

Terminal window
curl 'https://api.doxtly.com/v1/generated_files/01a1abe4-1c1f-7884-8175-3c30c973d6f8' \
-H "X-Api-Key: $DOXTLY_API_KEY" \
-H "X-Api-Secret: $DOXTLY_API_SECRET"

Response 200:

{
"id": "01a1abe4-1c1f-7884-8175-3c30c973d6f8",
"templateInfo": {
"id": "01a1aaf4-d812-7f81-87f3-a2a24628d795",
"name": "Service agreement",
"type": "word"
},
"templateVersion": 1,
"status": "success",
"hasPassword": true,
"filename": "service-agreement-lakeside.pdf",
"generatedFileId": "01a1abe4-1c19-737a-b4b8-1ff43bf8f82c",
"generatedAt": "2026-11-05T14:26:55+01:00",
"generationTime": "0.1275"
}

GET/v1/generated_files/{id}/download

Returns a saved PDF. It works for generations that kept a file, which you can spot by a generatedFileId that is not null. A file locked with a password stays locked.

Key permission: download_generated_file

Headers: X-Api-Key, X-Api-Secret

Path parameter Meaning
id The generation’s identifier.

Response: 200 with the file. Content-Type, Content-Disposition and Content-Length describe it.

Status When
404 The generation was not found, or it has no saved file (Generated file not found): it failed, persist was off, or storage was full.

The errors every endpoint can answer apply here too.

Terminal window
curl 'https://api.doxtly.com/v1/generated_files/01a1abe4-1c1f-7884-8175-3c30c973d6f8/download' \
-H "X-Api-Key: $DOXTLY_API_KEY" \
-H "X-Api-Secret: $DOXTLY_API_SECRET" \
-o service-agreement-lakeside.pdf

The response is the file itself. Its headers:

HTTP/2 200
content-type: application/pdf
content-disposition: attachment; filename=service-agreement-lakeside.pdf
content-length: 45853

DELETE/v1/generated_files/{id}

Takes a generation off the list and deletes its saved PDF, which frees the space it used. If a signing document was made of that PDF, the document keeps its file and goes on as it was.

Key permission: delete_generated_file

Headers: X-Api-Key, X-Api-Secret

Path parameter Meaning
id The generation’s identifier.

Response: 204 with no body.

Errors: only the common ones.

Terminal window
curl -X DELETE 'https://api.doxtly.com/v1/generated_files/01a1abe4-1c1f-7884-8175-3c30c973d6f8' \
-H "X-Api-Key: $DOXTLY_API_KEY" \
-H "X-Api-Secret: $DOXTLY_API_SECRET"

The response is 204 with no body.