PDF templates
Learn about the built-in PDF templates.
Monite offers several built-in PDF templates for receivables and purchase orders, and entities can choose the default template for their documents.
The templates can also be customized to include the entity logo.
PDF translation and localization
Monite supports the translation and localization of PDF templates. PDF translation defines the language used on all Monite PDFs. PDF translation depends on the counterpart's assigned language. Monite provides translation of PDFs for counterparts in English, French, German, Spanish, and Dutch.
The language
field on the POST /counterparts
and PATCH /counterparts/:id
payloads accepts the ISO 639-1 standard and defines the language translation for all PDFs sent to the counterpart. If not provided, all PDFs sent to the counterpart are in English. For more information, see Create a counterpart.
Monite handles the formatting of delimiters and decimal separators on amounts displayed on the PDFs based on the entity's country.
List the available templates
To get a list of available supported templates, call GET /document_templates
:
curl -X GET 'https://api.sandbox.monite.com/v1/document_templates' \
-H 'X-Monite-Version: 2024-01-31' \
-H 'X-Monite-Entity-Id: ENTITY_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN'
The response contains a list of all PDF templates with their language codes and some other internal metadata. The fields of note are id
(template ID), name
(template name), and template
(HTML content of the template). The template ID can be used later to preview the template and set the default template.
{
"data": [
{
"id": "94f9280b-d7d2-48ca-8290-3727d1b61861",
"created_at": "2024-01-08T11:47:35.451048",
"updated_at": "2024-01-08T11:47:35.451054",
"blocks": [],
"document_type": "receivable",
"is_default": false,
"language": "en",
"name": "classic",
"preview": null,
"template": "<!doctype html>\n<html lang=\"en\" class=\"template-1\">\n...........</html>",
"template_type": "source_object"
},
...
]
}
Get all system templates
System templates refer to Monite's built-in PDF templates. To retrieve all Monite's built-in PDF templates, send a GET
request to the /document_templates/system
endpoint as shown:
curl -X GET 'https://api.sandbox.monite.com/v1/document_templates/system' \
-H 'X-Monite-Version: 2024-01-31' \
-H 'X-Monite-Entity-Id: ENTITY_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN'
Customize the templates with entity logo
PDFs templates for receivables include the entity logo. You can upload the logo by using PUT /entities/{entity_id}/logo
:
curl -X PUT 'https://api.sandbox.monite.com/v1/entities/aea39...912/logo' \
-H 'X-Monite-Version: 2024-01-31' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-F file=@path/to/image.png
Preview the templates
After you have obtained the IDs of the PDF templates from GET /document_templates
, you can preview each template by calling GET /document_templates/{document_template_id}/preview
. The response is a sample PDF invoice generated using the specified template.
curl 'https://api.sandbox.monite.com/document_templates/94f9280b-d7d2-48ca-8290-3727d1b61861/preview' \
-H 'X-Monite-Version: 2024-01-31' \
-H 'X-Monite-Entity-Id: ENTITY_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-o ./file.pdf
Set the default template
Entities can set or change the default PDF template at any time. The specified template will be used for all new receivables and purchase orders created by the entity. Existing PDFs previously generated by the entity are not affected.
To set the default template call POST /document_templates/{document_template_id}/make_default
, replacing {document_template_id}
with the ID of the desired template:
curl -X POST 'https://api.sandbox.monite.com/v1/document_templates/{document_template_id}/make_default' \
-H 'X-Monite-Version: 2024-01-31' \
-H 'X-Monite-Entity-Id: ENTITY_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN'
Updated 16 days ago