Skip to main content
This guide walks through the reporting lifecycle in Reporter, from uploading your first template to downloading a finished report. It focuses on the concepts and decisions involved at each stage. For step-by-step API instructions with request and response examples, see the Reporter API quick start.

The reporting lifecycle


Every report in Reporter follows the same four-stage lifecycle:
1

Design a template

Write a .tpl file that defines the structure and content of your report.
2

Upload the template

Register the template with Reporter so it can be reused across report runs.
3

Generate a report

Submit a request with optional filters to produce a report from the template.
4

Download the output

Retrieve the finished file in the format you need.
The sections below explain each stage.

Design a template


A template is a plain-text file with a .tpl extension that defines how your report looks and what data it includes. Templates mirror the structure of the final output — if you want an XML report, you write XML inside the .tpl file; if you want HTML, you write HTML. Instead of writing SQL queries, you reference data through placeholders that follow a simple path syntax:
{{ datasource.table.field }}
For example, {{ midaz_onboarding.account.name }} pulls the account name from the Midaz onboarding database.

What you can do in templates

CapabilityDescription
LoopsIterate over collections of records
ConditionsShow or hide content based on data values
AggregationsCalculate sums, averages, counts, min, and max
ArithmeticPerform calculations on numeric fields
FiltersTransform values inline (format numbers, replace strings, extract substrings)
CountersTrack and display running totals across iterations

Supported output formats

Template contentOutput format
CSV-structured .tplCSV file
XML-structured .tplXML file
HTML-structured .tplHTML or PDF file
TXT-structured .tplTXT file
See Template formats for complete examples of each format.

Upload the template


Once your .tpl file is ready, upload it to Reporter. During upload, you specify:
  • The template file — your .tpl file
  • Output format — the format Reporter should generate (CSV, XML, HTML, PDF, or TXT)
  • Description — an optional label to help identify the template later
Reporter stores the template in S3-compatible object storage and assigns it a unique ID. You can then list, update, or delete templates as your reporting needs evolve.
Templates are reusable. Upload once, generate reports from the same template as many times as needed with different filters.

Generate a report


To generate a report, submit a request with the template ID and optional filters that narrow the data.

How filters work

Filters follow a structured path: data source > table > field. You can filter by equality, ranges, greater/less than, and list membership. For example, to generate a report for a specific date range and account status:
FilterWhat it does
createdAt: between ["2024-01-01", "2024-01-31"]Only include records from January 2024
status: in ["active", "pending"]Only include active or pending accounts
id: eq ["123", "456"]Only include specific account IDs

Supported filter operators

OperatorDescription
eqEqual to
gt / gteGreater than / greater than or equal
lt / lteLess than / less than or equal
betweenValue falls within a range
in / ninValue is / is not in a list

Processing

Report generation is asynchronous. After submitting a request, Reporter returns a report ID that you use to check progress. Reports move through two statuses:
StatusMeaning
processingReporter is querying data and rendering the template
finishedThe report is ready for download

Download the output


Once a report reaches finished status, download it. The file is returned in the format specified during template upload — CSV, XML, HTML, PDF, or TXT.
API reference: Download report

Data sources


Reporter connects to your databases and pulls data based on what your templates reference. It supports:
DatabaseUse case
PostgreSQLRelational data — accounts, transactions, ledger entries
MongoDBDocument data — metadata, flexible schemas
Data sources are configured at the infrastructure level through environment variables. Once configured, they become available to all templates through their assigned name (for example, midaz_onboarding or midaz_transaction).

Multi-schema support

For PostgreSQL databases with multiple schemas, templates can query across schemas using explicit syntax:
{{ datasource:schema.table.field }}
This is useful when your data spans schemas like sales, inventory, and reporting within a single database.

Example scenario


A fintech company needs to generate a daily account summary for its operations team. Setup:
  • A template designer writes an HTML template with account balances, transaction counts, and daily totals using Reporter’s aggregation tags
  • The template is uploaded once with output format set to PDF
Daily workflow:
  1. An automated job submits a report request with a date filter for the current day.
  2. Reporter queries the Midaz database, applies the template logic, and renders the output.
  3. The report reaches finished status within seconds.
  4. The operations team downloads the PDF and reviews the daily summary.
  5. The same template is reused every day — only the date filter changes.

Brazilian regulatory reporting


Reporter includes ready-to-use templates for Brazilian Central Bank (BACEN) regulatory reports:
TemplatePurpose
CADOC 4010 / 4016Trial balance and balance sheet reporting
CADOC 4111Detailed transaction reporting
CCSCustomer and account registry reporting
These templates follow the official BACEN structure and can be customized to match your institution’s chart of accounts.
See BACEN templates for details on each regulatory template.

Next steps