Skip to content

Generate report

POST/api/v1/reports

Queue a report for generation and return task ID for tracking.

Operation ID: generate_report·View as markdown·OpenAPI slice

Authentication

Bearer token authentication. Pass your DayZero API token in the Authorization header and the target business UUID in x-business-id.

Request body

report_namestringrequired

Report type identifier. Must match a supported report_name from the /reports endpoint. Examples: 'master_transactions', 'trial_balance', 'general_ledger', 'profit_and_loss_comparative', 'ar_report', 'cogs_report', 'shareholder_loans'. See GET /reports for the complete list of available report types.

period_typeReportPeriodType

Controls how report dates are determined. 'custom' (default): Use start_date/end_date fields directly. 'tax_year': Calculate full fiscal year dates from business's tax_year_end_month config. 'tax_quarter': Calculate quarter dates within a fiscal year. When using tax_year or tax_quarter, the resolved dates will be stored in generation_params.

tax_yearinteger

The tax/fiscal year for period calculation. Required when period_type is 'tax_year' or 'tax_quarter'. Example: 2026. The actual date range depends on the business's tax_year_end_month setting. For a business with tax year ending March 31, tax_year=2026 covers April 1, 2025 through March 31, 2026.

tax_quarterinteger

The quarter within the tax year (1-4). Required when period_type is 'tax_quarter'. Q1 is the FIRST quarter of the fiscal year, which may start in the prior calendar year for non-calendar fiscal years. Example: For a March fiscal year-end, Q1 of tax_year=2026 covers April 1-June 30, 2025.

start_datestring

Report period start date in YYYY-MM-DD format (e.g., '2026-01-01'). Required when period_type='custom' for reports with input_type='date_start_end' or similar. Ignored when period_type is 'tax_year' or 'tax_quarter' (dates calculated automatically).

end_datestring

Report period end date in YYYY-MM-DD format (e.g., '2026-12-31'). Required when period_type='custom' for date-range reports. For point-in-time reports (input_type='date_end_only'), only end_date is needed. Ignored when period_type is 'tax_year' or 'tax_quarter'.

comparison_period_typeReportPeriodType

Period type for the comparison/prior period in comparative reports. Same options as period_type: 'custom', 'tax_year', or 'tax_quarter'. Used with reports like 'profit_and_loss_comparative' and 'balance_sheet_comparative' to enable variance analysis between two periods.

comparison_tax_yearinteger

Tax year for the comparison period. Used when comparison_period_type is 'tax_year' or 'tax_quarter'. Example: Set to 2025 to compare against the current period's 2026 for year-over-year analysis.

comparison_tax_quarterinteger

Quarter (1-4) for the comparison period. Required when comparison_period_type is 'tax_quarter'. Example: comparison_tax_quarter=1 with comparison_tax_year=2025 compares Q1 2025 against the current period.

comparison_start_datestring

Start date for comparison period in YYYY-MM-DD format. Used when comparison_period_type='custom' for comparative reports. Example: '2025-01-01' to compare against prior year.

comparison_end_datestring

End date for comparison period in YYYY-MM-DD format. Used when comparison_period_type='custom' for comparative reports. Example: '2025-12-31' to compare full prior year.

ledger_idstring

UUID of a specific ledger account to filter the report. Currently used with 'general_ledger' report to show transactions for only one account instead of all accounts. When omitted, the general_ledger report includes all accounts. Example: '019ab37c-1ed6-7000-8000-000000000001'.

instance_idstring

Legacy ledger-engine instance override. Optional and normally omitted; reports run against the business's own books.

file_s3_keystring

S3 object key for file-based report inputs. Required for reports with input_type='file_upload' (e.g., 'cogs_report'). The file should be uploaded first via the upload endpoint. Example: 'uploads/business-123/cogs-data-2026.csv'.

s3_keysarray · string

Array of S3 object keys when a report requires multiple input files. Each key should reference a previously uploaded file. Example: ['uploads/business-123/sales-q1.csv', 'uploads/business-123/sales-q2.csv'].

tag_group_idstring

UUID of a specific tag group to filter the report. Used with 'pnl_by_department' to segment by tags within this group.

tag_idsarray · string

List of specific tag UUIDs to filter the report. When multiple tags are provided for 'pnl_by_department', it generates a multi-sheet report with one P&L statement per tag.

additional_paramsobject

Report-specific parameters that vary by report type. Supported parameters: customer_id (UUID): Filter customer_statements or pnl_by_customer to a specific customer. vendor_id (UUID): Filter vendor_statements to a specific vendor. include_zero_balances (bool): Include zero-balance accounts in trial_balance report. tag_group_id (UUID): Filter pnl_by_department to tags in a specific tag group. forecast_days (int): Number of days to forecast in cash_flow_forecast (default: 90). raw (bool): For general_ledger only — return a single flat sheet with no formatting or headers (default: false). include_period_columns (bool): Any report — insert a '<column> Quarter Ending' and a '<column> Calendar Year Ending' column immediately after every date column in the file (e.g. a 02/14/2026 Date yields Date Quarter Ending 03/31/2026 and Date Calendar Year Ending 12/31/2026). Calendar quarters/years, formatted like the source date column; applies to xlsx, csv and html output (default: false). basis ('accrual' | 'cash'): Accounting basis for the reports that support one. Omitted means the business's configured default, which may be cash — it is not always accrual. The generated file states the basis it was built on and the stored report record records it. Example: {'customer_id': '019abc-uuid', 'include_zero_balances': true}, {'include_period_columns': true}, {'basis': 'cash'}.

output_formatReportOutputFormatReportOutputFormat

Output file format for the report. 'xlsx' (default): Excel format with formatting, multiple tabs, headers, and currency formatting. 'csv': Comma-separated values format as a single flat file without formatting. 'html': HTML format. CSV is useful for importing into other systems or programmatic analysis.

Responses

202Successful Response

successboolean
messagestring
codestring
dataReportTaskResponse

400Bad Request - Invalid input

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

401Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

403Forbidden - Insufficient permissions

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

404Not Found - Resource does not exist

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

422Validation Error

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.