Generate Report
generate_reportGenerate the data for any report over a date range - the same numbers the dashboard shows. The report selector is exactly one of report_id (a saved or custom report identifier) and template_key (a built-in template such as pnl or product_performance). Dates default to the report's own default timeframe ending today; narrower ranges reduce truncation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_date | No | End of the report date range as YYYY-MM-DD, resolved in the tenant's timezone. Defaults to today in the tenant's timezone. | |
| report_id | No | The internal MerchantFlow id of a saved or custom report from list_reports. Pass exactly one of report_id or template_key. | |
| start_date | No | Start of the report date range as YYYY-MM-DD, resolved in the tenant's timezone. Defaults to the report's own default timeframe measured back from end_date. | |
| template_key | No | The key of a built-in report template (e.g. pnl, product_performance) from list_reports. Pass exactly one of report_id or template_key. | |
| comparison_mode | No | How to compute the comparison_rows: "none" for no comparison, "previous_period" for the immediately preceding period of equal length, or "previous_year" for the same period one year earlier. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | One row per period. Which metric keys appear depends on the report configuration. | |
| _meta | No | ||
| report | No | ||
| _message | No | ||
| currency | No | ||
| _truncated | No | ||
| date_range | No | ||
| generated_at | No | ISO 8601. | |
| pnl_statement | No | ||
| summary_tiles | No | ||
| _tenant_context | No | ||
| comparison_rows | No | Present only when a comparison_mode other than "none" was requested and produced rows. | |
| expense_breakdown | No | ||
| marketing_campaigns | No | Top 50 campaigns. Revenue and ROAS here are per campaign; there is no per-campaign profit. | |
| marketing_platforms | No | ||
| product_performance | No | Top 50 products. Image URLs are stripped. |