Pular para o conteúdo 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