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 be customized to include the entity logo.
List the available templates
To get a list of available templates, call GET /document_templates
:
curl -X GET 'https://api.sandbox.monite.com/v1/document_templates' \
-H 'X-Monite-Version: 2023-06-04' \
-H 'Authorization: Bearer ACCESS_TOKEN'
The response contains a list of templates with some internal metadata. The fields of note are id
(template ID), template
(HTML content of the template), and preview.url
(a link to the sample PDF file that uses this template). The template ID can be used later to set the default template.
{
"data": [
{
"document_type": "receivable",
"language": "en",
"name": "classic",
"template": "... HTML content of the template ...",
"template_type": "block",
"preview": {
"id": "2750f80c-5f1e-4ee4-bae3-245ac6d18a86",
"created_at": "2022-12-22T10:30:24.334868+00:00",
"file_type": "receivables",
"name": "receivables.pdf",
"region": "eu-central-1",
"md5": "6ad314422c96c1e35a8452c8382b8ed5",
"mimetype": "application/pdf",
"url": "https://monite-file-saver-receivables-eu-central-1-dev.s3.amazonaws.com/2750f80c-5f1e-4ee4-bae3-245ac6d18a86/a5d6e810-9be8-4715-9209-9f82a61e520a.pdf",
"size": 112394,
"previews": [
{
"url": "https://monite-file-saver-receivables-eu-central-1-dev.s3.amazonaws.com/2750f80c-5f1e-4ee4-bae3-245ac6d18a86/500x700/a5d6e810-9be8-4715-9209-9f82a61e520a.pdf",
"width": 500,
"height": 700
}
],
"pages": []
},
"id": "94f9280b-d7d2-48ca-8290-3727d1b61861",
"created_at": "2022-07-11T08:55:54.591602+00:00",
"updated_at": "2022-07-11T08:55:54.591623+00:00",
"blocks": [
"entity_info",
"entity_contact",
...
]
},
...
]
}
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: 2023-06-04' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-F file=@path/to/image.png
Preview the templates
The preview.url
fields in the response from GET /document_templates
contain the links to preview the templates with sample data:
{
"data": [
{
...
"preview": {
...
"url": "https://monite-file-saver-receivables-eu-central-1-dev.s3.amazonaws.com/2750f80c-5f1e-4ee4-bae3-245ac6d18a86/500x700/a5d6e810-9be8-4715-9209-9f82a61e520a.pdf",
...
},
"id": "94f9280b-d7d2-48ca-8290-3727d1b61861",
...
},
{
...
"preview": {
...
"https://monite-file-saver-receivables-eu-central-1-dev.s3.amazonaws.com/2178438f-99f6-4caa-9a34-f9eead3fa852/869eed47-2f90-42e6-ab1e-5c65eb44d3b5.pdf",
...
},
"id": "b9767779-562c-40d7-9604-6fc8f8986dff",
...
},
...
]
}
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: 2023-06-04' \
-H 'X-Monite-Entity-Id: ENTITY_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN'
Updated about 1 month ago