Skip to main content
Use this guide for the recurring Reporter workflow: manage a template, generate a report, verify the result, and download the finished file.

Prerequisites

Before you begin, make sure that:
  • Reporter is running and you can authenticate with its API.
  • An operator has configured at least one data source for the data your template queries.
  • You have a .tpl file that matches the intended output format. For PDF output, author the template as HTML. See Template examples and the template reference.

Manage templates

Reporter uses uploaded .tpl files to define report content and layout.

Upload a template

Call Upload a template as a multipart request with all three required fields:
  • template: the .tpl file.
  • outputFormat: the generated file format, such as HTML, PDF, XML, CSV, or TXT.
  • description: a human-readable description of the template.
Reporter returns the template identifier that you use when generating reports.

Maintain existing templates

Use the template endpoints to: Deleting a template is a soft delete. Reporter excludes it from standard queries but preserves reports already created from it.

Generate a report with filters

Call Create a report with both required fields:
  • templateId: the identifier returned when you uploaded the template.
  • filters: the conditions grouped by data source, table, and field.
The following request limits the report to one transaction:
To generate a report without filtering rows, send an empty object. Don’t omit the field:
Reporter returns the report identifier in the id field. Store this value as REPORT_ID to check the generation status and retrieve the output. See Advanced filtering for the supported operators and filter structure.

Discover data source schemas

Inspect the configured data sources before building templates or dynamic filter interfaces:
  • List data sources returns a page of registered connections without credentials.
  • Retrieve a data source returns one connection configuration by dataSourceId; credentials remain hidden.
  • GET /v1/data-sources/{dataSourceId}/schema introspects the live tables or collections and their typed fields.
The API owns the registry lifecycle: create a data source, partially update it, test the connection, inspect its schema, or soft-delete it. Reporter refuses deletion while a live Template still references the source. Single-tenant deployments can also seed entries from DATASOURCE_* variables at startup; multi-tenant deployments create entries per tenant through the API.

Interpret report statuses and errors

Call Check report status with REPORT_ID. Treat only Finished as downloadable. A Partial result requires investigation even when Reporter produced some data.

Verify and download the report

When the status is Finished:
  1. Call Download a report with REPORT_ID.
  2. Confirm that the response has the expected content type and Content-Disposition header.
  3. Open the file and verify that its data and layout match the template and filters.
The download endpoint serves only reports with Finished status.

Troubleshooting


Operator configuration

The following deployment settings are for operators. Application users don’t need them for the report generation workflow.

Configure object storage

Reporter stores templates and generated reports in one S3-compatible bucket. It uses the templates/ and reports/ prefixes. Reporter supports AWS S3, MinIO, and SeaweedFS.
The MinIO and SeaweedFS examples below use HTTP only for local development. Production deployments require HTTPS and TLS.
S3 doesn’t support per-object TTL. Configure S3 bucket lifecycle policies if generated reports must expire automatically.

Configure external data sources

Set DATASOURCE_CRED_ENC_KEY to a persistent hexadecimal AES key before Reporter starts. Generate a 32-byte key with openssl rand -hex 32; the Manager fails startup when the key is absent or malformed. Keep the same key available to every Reporter runtime that reads the registry, because stored passwords are encrypted with it. Use the API for the normal data-source lifecycle. In multi-tenant mode, Reporter skips environment seeding and each tenant creates its own entries through the API. In single-tenant mode, you may seed PostgreSQL or MongoDB entries at startup with DATASOURCE_<NAME>_* variables: For a source whose CONFIG_NAME is midaz_onboarding:
Reference it in a template by its CONFIG_NAME:
For multiple PostgreSQL schemas, derive the schema variable from CONFIG_NAME. For example, external_db maps to DATASOURCE_EXTERNAL_DB_SCHEMAS:
Use database:schema.table in templates and schema.table as the filter table key:
When the schema variable isn’t set, Reporter uses the public schema. The Manager loads data source configuration and connects on demand. The Worker connects during startup and retries unavailable sources. It can continue with reduced functionality when a source remains unavailable.