Reports
BetaThe reports hub, the table, chart and GST filing reports and their PDF, CSV and GSTN JSON exports, with the same filters, hidden cost columns, 2,000-row cap, totals and insight as the web.
/api/v1/reportsList the reports hub
Every report the member may open: its report family and extra permissions (token scopes and role), its module switched on, and on the organization's plan. kind is how the app opens it: table, line, heatmap, funnel or gst for reports this API runs; web reports open webUrl in a browser. Custom reports are two web entries (category custom, categoryLabel Custom reports, filters []): slug custom-reports (webUrl /reports/custom) when the plan includes custom reports and the member holds reports.read, and slug custom-report-builder (webUrl /reports/custom/new) when they also hold reports.create. Their category is not one of the categories list. Needs reports.read or any report family read, else 403.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/reports" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"entries": [
{
"slug": "sales-register",
"title": "Sales Register",
"category": "sales",
"categoryLabel": "Sales & Receivables",
"description": "All invoices in the period, grouped by customer, with totals.",
"filters": [
"dateRange"
],
"kind": "table",
"webUrl": "https://avsinvoice.app/reports/sales-register"
}
],
"categories": [
{
"key": "sales",
"label": "Sales & Receivables"
}
]
}Possible errors: unauthorized, forbidden
/api/v1/reports/{slug}Run a report
Runs a report; kind says its shape. table: a built-in report, or a bespoke page served as a table (stock movement ledger, e-invoice status, e-way bill tracking, PO vs bill variance, reorder suggestions, balance sheet). Cost, margin and stock-value columns the member may not see are removed. Rows are capped at 2,000 (truncated, total); totals cover all rows, except when notice is set (the balance sheet stopped at its own 2,000-invoice limit; totalsPartial is then true). groups is set for grouped reports, rows otherwise. line (dso-trend, item-sales-trend, purchase-price-trend): { title, series: [{ label, value }], valueFormat: days | money, table } where table is the table report under the chart. heatmap (overdue-heatmap): { buckets, rows: [{ label, cells, total }], insight }. funnel (quote-conversion): { stages: [{ label, count, ofIssuedPct, ofPreviousPct }], note }. gst (gst-filing): { period: { month, year }, gstin, selectedRegistrationId, filterOptions: { gstRegistration: [{ value, label }] }, gstr1 and gstr3b: [{ key, label, count, taxable, tax, rows }] where rows is a table report, liability: { cgst, sgst, igst, total } }; period is the one used (this month when neither month nor year is asked; one without the other is 422). gstin and selectedRegistrationId are those of the registration the return ran on (the one asked for with gstRegistrationId, else the default; an organization without registrations has one entry with id __legacy_org_gst__); filterOptions.gstRegistration lists the registrations to choose from. Unknown, web-only or hidden reports are 404. A bad custom range (from after to, invalid date), an unknown range a bad GST period (month 1-12, year 2000-2100) or an unknown gstRegistrationId is 422. applied.range is null for reports without a date range.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
slug | path | string | Required | Report slug from the hub. |
range | query | string | Optional | this-month, last-month, this-quarter, this-fy, last-fy, last-30d, all or custom. Default: the report's own. Ignored by reports without a date range. |
from | query | string | Optional | Custom range start, YYYY-MM-DD. |
to | query | string | Optional | Custom range end, YYYY-MM-DD. |
customerId | query | string | Optional | Customer filter. |
vendorId | query | string | Optional | Vendor filter. |
warehouseId | query | string | Optional | Warehouse filter. |
gstRegistrationId | query | string | Optional | GST registration filter. |
salespersonId | query | string | Optional | Salesperson filter (forced to their own for restricted sales members). |
itemId | query | string | Optional | Item trends: the item to follow. |
granularity | query | string | Optional | item-sales-trend: day, week or month. Default: month. |
month | query | string | Optional | gst-filing: the return month, 1-12 (with year). |
year | query | string | Optional | gst-filing: the return year, YYYY (with month). |
Example request
curl "https://pre-invoice.avscorp.in/api/v1/reports/sales-register" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"kind": "table",
"slug": "sales-register",
"title": "Sales Register",
"category": "sales",
"description": "All invoices in the period, grouped by customer, with totals.",
"filters": [
"dateRange"
],
"defaultRange": "this-month",
"applied": {
"range": "this-month",
"from": "2026-11-01",
"to": "2026-11-30"
},
"columns": [
{
"key": "invoiceNumber",
"label": "Invoice #",
"format": "text"
},
{
"key": "total",
"label": "Total",
"format": "money",
"total": "sum"
}
],
"groupBy": "customerName",
"groups": [
{
"key": "Alpha Traders",
"label": "Alpha Traders",
"subtotals": {
"total": 1000
},
"rows": [
{
"invoiceNumber": "INV-1",
"customerName": "Alpha Traders",
"total": 1000
}
]
}
],
"rows": null,
"totals": {
"total": 1000
},
"truncated": false,
"total": 1,
"insight": null,
"comparisonLabel": "vs same days last month",
"emptyCopy": "No data for this period. Try a longer period or clear a filter.",
"filterOptions": {}
}Possible errors: unauthorized, not_found, validation_error
/api/v1/reports/{slug}/pdfDownload a report as a PDF
The same PDF the web exports for the report, with the same filters and hidden columns. Table reports, the trend reports (their table) and GST filing export; other reports are 404 "This report can't be exported". Hidden reports are 404. The file name is <slug>-<from>-<to>.pdf (gst-filing-<yyyy>-<mm>.pdf).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
slug | path | string | Required | Report slug from the hub. |
range | query | string | Optional | this-month, last-month, this-quarter, this-fy, last-fy, last-30d, all or custom. Default: the report's own. Ignored by reports without a date range. |
from | query | string | Optional | Custom range start, YYYY-MM-DD. |
to | query | string | Optional | Custom range end, YYYY-MM-DD. |
customerId | query | string | Optional | Customer filter. |
vendorId | query | string | Optional | Vendor filter. |
warehouseId | query | string | Optional | Warehouse filter. |
gstRegistrationId | query | string | Optional | GST registration filter. |
salespersonId | query | string | Optional | Salesperson filter (forced to their own for restricted sales members). |
itemId | query | string | Optional | Item trends: the item to follow. |
month | query | string | Optional | gst-filing: the return month, 1-12 (with year). |
year | query | string | Optional | gst-filing: the return year, YYYY (with month). |
Example request
curl "https://pre-invoice.avscorp.in/api/v1/reports/sales-register/pdf" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
application/pdf. The report as a PDF attachment, with a Content-Disposition filename.Possible errors: unauthorized, not_found, validation_error
/api/v1/reports/{slug}/csvDownload a report as CSV
The report's table as CSV, as the web exports it, without the columns the member may not see. Table reports and the trend reports (their table) export; others are 404 "This report can't be exported". The file name is <slug>-<from>-<to>.csv (<slug>.csv without a date range).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
slug | path | string | Required | Report slug from the hub. |
range | query | string | Optional | this-month, last-month, this-quarter, this-fy, last-fy, last-30d, all or custom. Default: the report's own. Ignored by reports without a date range. |
from | query | string | Optional | Custom range start, YYYY-MM-DD. |
to | query | string | Optional | Custom range end, YYYY-MM-DD. |
customerId | query | string | Optional | Customer filter. |
vendorId | query | string | Optional | Vendor filter. |
warehouseId | query | string | Optional | Warehouse filter. |
gstRegistrationId | query | string | Optional | GST registration filter. |
salespersonId | query | string | Optional | Salesperson filter (forced to their own for restricted sales members). |
itemId | query | string | Optional | Item trends: the item to follow. |
Example request
curl "https://pre-invoice.avscorp.in/api/v1/reports/sales-register/csv" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
text/csv; charset=utf-8. The table as a CSV attachment, with a Content-Disposition filename.Possible errors: unauthorized, not_found, validation_error
/api/v1/reports/gst-filing/jsonDownload the GSTN JSON for a GST period
gstFiling.readThe JSON file the GST Filing page downloads for the GSTN portal: GSTR-1 by default, GSTR-3B with type=gstr3b. The file name is GSTR1_<gstin>_<mmyyyy>.json (GSTR3B_ for GSTR-3B). Needs gstFiling.read; the report's own gate applies too (404 when hidden). A bad period or type is 422.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
month | query | string | Optional | The return month, 1-12 (with year). Default: this month. |
year | query | string | Optional | The return year, YYYY (with month). |
gstRegistrationId | query | string | Optional | The GST registration. Default: the organization's default registration. An unknown id is 422. |
type | query | string | Optional | gstr1 or gstr3b. Default: gstr1. |
Example request
curl "https://pre-invoice.avscorp.in/api/v1/reports/gst-filing/json" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
application/json; charset=utf-8. The GSTR-1 or GSTR-3B JSON as an attachment, with a Content-Disposition filename.Possible errors: unauthorized, forbidden, not_found, validation_error