Saltar al contenido principal

Accounting Template Endpoints

Manage invoice and estimate templates for custom document layouts.

Base Pathโ€‹

/api/accounting-template

Endpointsโ€‹

List Templatesโ€‹

GET /api/accounting-template
Authorization: Bearer {token}

Query Parameters:

ParameterTypeDescription
templateTypestringINVOICE or ESTIMATE
languageCodestringLanguage code (e.g., en)

Get Template by IDโ€‹

GET /api/accounting-template/:id
Authorization: Bearer {token}

Create Templateโ€‹

POST /api/accounting-template
Authorization: Bearer {token}

Request Body:

{
"name": "Professional Invoice",
"languageCode": "en",
"templateType": "INVOICE",
"mjml": "<mjml>...</mjml>",
"hbs": "<div>{{invoiceNumber}}</div>"
}

Update Templateโ€‹

PUT /api/accounting-template/:id
Authorization: Bearer {token}

Delete Templateโ€‹

DELETE /api/accounting-template/:id
Authorization: Bearer {token}

Generate Previewโ€‹

POST /api/accounting-template/template/preview
Authorization: Bearer {token}

Renders a template with sample data for preview.

Save Templateโ€‹

POST /api/accounting-template/template/save
Authorization: Bearer {token}

Template Typesโ€‹

TypeDescription
INVOICEInvoice document
ESTIMATEEstimate/quote document
RECEIPTPayment receipt

Template Variablesโ€‹

Templates use Handlebars syntax for data interpolation:

VariableDescription
{{invoiceNumber}}Invoice number
{{invoiceDate}}Invoice date
{{dueDate}}Payment due date
{{terms}}Payment terms
{{fromOrganization}}Sender details
{{toContact}}Recipient details
{{invoiceItems}}Line items array
{{totalValue}}Invoice total
{{tax}}Tax amount
{{discountValue}}Discount amount