> For the complete documentation index, see [llms.txt](https://www.center.daxium-air.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.center.daxium-air.com/api-reference/mail-merge.md).

# Mail Merge

Generate documents from templates and submissions

## GET /{app\_short}/reports/{report\_id}

> Get a generated document

```json
{"openapi":"3.0.0","info":{"title":"Daxium Air API","version":"v1.3"},"tags":[{"name":"publipostages"}],"servers":[{"url":"https://api.daxium-air.com","description":"Production"}],"security":[{"oauth2":[]}],"components":{"securitySchemes":{"oauth2":{"type":"oauth2","description":"Send the access token as `Authorization: Bearer <token>`.","flows":{"password":{"tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}},"authorizationCode":{"authorizationUrl":"/oauth/v2/auth","tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}}}}},"parameters":{"XAcceptVersion":{"name":"X-Accept-Version","in":"header","description":"API version to apply. Defaults to `v1.0` when omitted; an unknown value falls back to the latest version.","required":false,"schema":{"type":"string","default":"v1.3","enum":["v1.0","v1.1","v1.2","v1.3"]}}},"schemas":{"Report":{"description":"Generated mail merge","properties":{"errorMessage":{"description":"Error message, if any","type":"string"},"id":{"description":"Mail merge identifier","type":"integer"},"original_document":{"description":"File generated in the original format","properties":{"file_name":{"description":"Name of the generated file","type":"string"},"file_uuid":{"description":"UUID of the generated file","type":"string"}},"type":"object"},"pdf_document":{"description":"File generated in PDF format","properties":{"file_name":{"type":"string"},"file_uuid":{"type":"string"}},"type":"object"},"status":{"description":"Mail merge status (e.g. finished, error)","type":"string"}},"type":"object"},"ErrorResponse":{"description":"Standardised error body returned by the REST exception subscriber.","properties":{"code":{"description":"Daxium error code.","type":"string"},"message":{"type":"string"},"url":{"description":"Link to the error code in the error reference.","type":"string"},"api_version":{"type":"string"},"infos":{"description":"Additional context about the error, when the exception carries any.","type":"array","items":{}},"server_time":{"type":"integer"}},"type":"object"}},"responses":{"Unauthorized":{"description":"Missing or invalid access token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/{app_short}/reports/{report_id}":{"get":{"tags":["publipostages"],"summary":"Get a generated document","operationId":"getReport","parameters":[{"name":"app_short","in":"path","description":"Short name of the workspace, as found in the URL of the back-office.","required":true,"schema":{"type":"string"}},{"name":"report_id","in":"path","required":true,"schema":{"type":"string","pattern":"[0-9]+"}},{"$ref":"#/components/parameters/XAcceptVersion"}],"responses":{"200":{"description":"Document object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No document with this identifier in the workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## List the mail merge templates

> Templates can be filtered by form or by submission.

```json
{"openapi":"3.0.0","info":{"title":"Daxium Air API","version":"v1.3"},"tags":[{"name":"publipostages"}],"servers":[{"url":"https://api.daxium-air.com","description":"Production"}],"security":[{"oauth2":[]}],"components":{"securitySchemes":{"oauth2":{"type":"oauth2","description":"Send the access token as `Authorization: Bearer <token>`.","flows":{"password":{"tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}},"authorizationCode":{"authorizationUrl":"/oauth/v2/auth","tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}}}}},"parameters":{"XAcceptVersion":{"name":"X-Accept-Version","in":"header","description":"API version to apply. Defaults to `v1.0` when omitted; an unknown value falls back to the latest version.","required":false,"schema":{"type":"string","default":"v1.3","enum":["v1.0","v1.1","v1.2","v1.3"]}}},"schemas":{"ReportTemplateListResponse":{"properties":{"server_time":{"type":"integer","format":"int64"},"templates":{"type":"array","items":{"$ref":"#/components/schemas/ReportTemplate"}},"total_count":{"type":"integer"},"total_pages":{"type":"integer"}},"type":"object"},"ReportTemplate":{"description":"Mail-merge template","properties":{"id":{"description":"Template identifier","type":"integer"},"listingMode":{"description":"Whether the template is in listing mode","type":"boolean"},"mailBody":{"description":"Body of the email sent alongside the generated document, when sent by mail.","type":"string"},"mailSubject":{"description":"Subject of the email sent alongside the generated document, when sent by mail.","type":"string"},"name":{"description":"Template name","type":"string"},"reportName":{"description":"Name given to the generated document.","type":"string"},"sendAsHtml":{"description":"Whether the email body above is sent as HTML.","type":"boolean"},"templateEngine":{"description":"Template generation engine (e.g. docxopenxml, xlsxaspose)","type":"string"}},"type":"object"},"ErrorResponse":{"description":"Standardised error body returned by the REST exception subscriber.","properties":{"code":{"description":"Daxium error code.","type":"string"},"message":{"type":"string"},"url":{"description":"Link to the error code in the error reference.","type":"string"},"api_version":{"type":"string"},"infos":{"description":"Additional context about the error, when the exception carries any.","type":"array","items":{}},"server_time":{"type":"integer"}},"type":"object"}},"responses":{"Unauthorized":{"description":"Missing or invalid access token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/{app_short}/report_templates":{"get":{"tags":["publipostages"],"summary":"List the mail merge templates","description":"Templates can be filtered by form or by submission.","operationId":"listReportTemplates","parameters":[{"name":"page","in":"query","description":"Page number","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"0","pattern":"\\d+"}},{"name":"per_page","in":"query","description":"Number of result by page (Max 1000)","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"10","pattern":"-?\\d+"}},{"name":"updated_since","in":"query","description":"Get only templates updated from this date","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"","pattern":"\\d+"}},{"name":"structure","in":"query","description":"Structure id","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"","pattern":"[0-9]+"}},{"name":"submission","in":"query","description":"Submission id","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"","pattern":"[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"}},{"name":"app_short","in":"path","description":"Short name of the workspace, as found in the URL of the back-office.","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/XAcceptVersion"}],"responses":{"200":{"description":"Paginated list of templates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportTemplateListResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## List the generated documents

> Returns the documents generated for the given submission.

```json
{"openapi":"3.0.0","info":{"title":"Daxium Air API","version":"v1.3"},"tags":[{"name":"publipostages"}],"servers":[{"url":"https://api.daxium-air.com","description":"Production"}],"security":[{"oauth2":[]}],"components":{"securitySchemes":{"oauth2":{"type":"oauth2","description":"Send the access token as `Authorization: Bearer <token>`.","flows":{"password":{"tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}},"authorizationCode":{"authorizationUrl":"/oauth/v2/auth","tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}}}}},"parameters":{"XAcceptVersion":{"name":"X-Accept-Version","in":"header","description":"API version to apply. Defaults to `v1.0` when omitted; an unknown value falls back to the latest version.","required":false,"schema":{"type":"string","default":"v1.3","enum":["v1.0","v1.1","v1.2","v1.3"]}}},"schemas":{"ReportListResponse":{"properties":{"next_page":{"type":"integer"},"reports":{"type":"array","items":{"$ref":"#/components/schemas/Report"}},"server_time":{"type":"integer","format":"int64"},"total_count":{"type":"integer"}},"type":"object"},"Report":{"description":"Generated mail merge","properties":{"errorMessage":{"description":"Error message, if any","type":"string"},"id":{"description":"Mail merge identifier","type":"integer"},"original_document":{"description":"File generated in the original format","properties":{"file_name":{"description":"Name of the generated file","type":"string"},"file_uuid":{"description":"UUID of the generated file","type":"string"}},"type":"object"},"pdf_document":{"description":"File generated in PDF format","properties":{"file_name":{"type":"string"},"file_uuid":{"type":"string"}},"type":"object"},"status":{"description":"Mail merge status (e.g. finished, error)","type":"string"}},"type":"object"},"ErrorResponse":{"description":"Standardised error body returned by the REST exception subscriber.","properties":{"code":{"description":"Daxium error code.","type":"string"},"message":{"type":"string"},"url":{"description":"Link to the error code in the error reference.","type":"string"},"api_version":{"type":"string"},"infos":{"description":"Additional context about the error, when the exception carries any.","type":"array","items":{}},"server_time":{"type":"integer"}},"type":"object"}},"responses":{"Unauthorized":{"description":"Missing or invalid access token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/{app_short}/reports":{"get":{"tags":["publipostages"],"summary":"List the generated documents","description":"Returns the documents generated for the given submission.","operationId":"listReports","parameters":[{"name":"page","in":"query","description":"Page number","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"0","pattern":"\\d+"}},{"name":"per_page","in":"query","description":"Number of result by page (Max 1000)","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"10","pattern":"-?\\d+"}},{"name":"updated_since","in":"query","description":"Get only pp updated from this date","required":false,"allowEmptyValue":false,"schema":{"type":"string","default":"","pattern":"\\d+"}},{"name":"submission","in":"query","description":"Submission id","required":true,"allowEmptyValue":false,"schema":{"type":"string","default":"","pattern":"[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"}},{"name":"app_short","in":"path","description":"Short name of the workspace, as found in the URL of the back-office.","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/XAcceptVersion"}],"responses":{"200":{"description":"Paginated list of documents","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportListResponse"}}}},"400":{"description":"`submission` is missing or is not a valid UUID.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Generate a document

> Generates a document from a template and a submission.

```json
{"openapi":"3.0.0","info":{"title":"Daxium Air API","version":"v1.3"},"tags":[{"name":"publipostages"}],"servers":[{"url":"https://api.daxium-air.com","description":"Production"}],"security":[{"oauth2":[]}],"components":{"securitySchemes":{"oauth2":{"type":"oauth2","description":"Send the access token as `Authorization: Bearer <token>`.","flows":{"password":{"tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}},"authorizationCode":{"authorizationUrl":"/oauth/v2/auth","tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}}}}},"parameters":{"XAcceptVersion":{"name":"X-Accept-Version","in":"header","description":"API version to apply. Defaults to `v1.0` when omitted; an unknown value falls back to the latest version.","required":false,"schema":{"type":"string","default":"v1.3","enum":["v1.0","v1.1","v1.2","v1.3"]}}},"schemas":{"ReportInput":{"description":"Body for starting a mail merge","required":["template_id","submission_id","api_callback"],"properties":{"api_callback":{"description":"URL called (PUT) when generation completes; `{publipostage_id}` is substituted (mandatory)","type":"string"},"header_name":{"description":"HTTP header name to send during the callback (optional)","type":"string"},"header_value":{"description":"HTTP header value to send during the callback (optional)","type":"string"},"join_format":{"description":"Output format: `original`, `pdf`, or `original,pdf` (two reports generated)","type":"string","enum":["original","pdf","original,pdf"]},"submission_id":{"description":"Submission identifier (mandatory)","type":"string","format":"uuid"},"template_id":{"description":"Template identifier (mandatory)","type":"integer"}},"type":"object"},"Report":{"description":"Generated mail merge","properties":{"errorMessage":{"description":"Error message, if any","type":"string"},"id":{"description":"Mail merge identifier","type":"integer"},"original_document":{"description":"File generated in the original format","properties":{"file_name":{"description":"Name of the generated file","type":"string"},"file_uuid":{"description":"UUID of the generated file","type":"string"}},"type":"object"},"pdf_document":{"description":"File generated in PDF format","properties":{"file_name":{"type":"string"},"file_uuid":{"type":"string"}},"type":"object"},"status":{"description":"Mail merge status (e.g. finished, error)","type":"string"}},"type":"object"},"ErrorResponse":{"description":"Standardised error body returned by the REST exception subscriber.","properties":{"code":{"description":"Daxium error code.","type":"string"},"message":{"type":"string"},"url":{"description":"Link to the error code in the error reference.","type":"string"},"api_version":{"type":"string"},"infos":{"description":"Additional context about the error, when the exception carries any.","type":"array","items":{}},"server_time":{"type":"integer"}},"type":"object"}},"responses":{"Unauthorized":{"description":"Missing or invalid access token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/{app_short}/reports":{"post":{"tags":["publipostages"],"summary":"Generate a document","description":"Generates a document from a template and a submission.","operationId":"createReport","parameters":[{"name":"app_short","in":"path","description":"Short name of the workspace, as found in the URL of the back-office.","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/XAcceptVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportInput"}}}},"responses":{"200":{"description":"Document generation started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"400":{"description":"The payload is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## GET /{app\_short}/reports/{report\_id}/results/{file\_uuid}

> Download the result of a generated document

```json
{"openapi":"3.0.0","info":{"title":"Daxium Air API","version":"v1.3"},"tags":[{"name":"publipostages"}],"servers":[{"url":"https://api.daxium-air.com","description":"Production"}],"security":[{"oauth2":[]}],"components":{"securitySchemes":{"oauth2":{"type":"oauth2","description":"Send the access token as `Authorization: Bearer <token>`.","flows":{"password":{"tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}},"authorizationCode":{"authorizationUrl":"/oauth/v2/auth","tokenUrl":"/oauth/v2/token","refreshUrl":"/oauth/v2/token","scopes":{}}}}},"parameters":{"XAcceptVersion":{"name":"X-Accept-Version","in":"header","description":"API version to apply. Defaults to `v1.0` when omitted; an unknown value falls back to the latest version.","required":false,"schema":{"type":"string","default":"v1.3","enum":["v1.0","v1.1","v1.2","v1.3"]}}},"responses":{"Unauthorized":{"description":"Missing or invalid access token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"ErrorResponse":{"description":"Standardised error body returned by the REST exception subscriber.","properties":{"code":{"description":"Daxium error code.","type":"string"},"message":{"type":"string"},"url":{"description":"Link to the error code in the error reference.","type":"string"},"api_version":{"type":"string"},"infos":{"description":"Additional context about the error, when the exception carries any.","type":"array","items":{}},"server_time":{"type":"integer"}},"type":"object"}}},"paths":{"/{app_short}/reports/{report_id}/results/{file_uuid}":{"get":{"tags":["publipostages"],"summary":"Download the result of a generated document","operationId":"getReportResult","parameters":[{"name":"app_short","in":"path","description":"Short name of the workspace, as found in the URL of the back-office.","required":true,"schema":{"type":"string"}},{"name":"report_id","in":"path","required":true,"schema":{"type":"string","pattern":"[0-9]+"}},{"name":"file_uuid","in":"path","required":true,"schema":{"type":"string","pattern":"[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"}},{"$ref":"#/components/parameters/XAcceptVersion"}],"responses":{"200":{"description":"Binary content of the produced document","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No document with this identifier in the workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.center.daxium-air.com/api-reference/mail-merge.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
