Reports

Beta

The 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.

GET/api/v1/reports

List the reports hub

Public — no scope required

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

JSON
{
  "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

GET/api/v1/reports/{slug}

Run a report

Public — no scope required

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

NameInTypeRequiredDescription
slugpathstringRequiredReport slug from the hub.
rangequerystringOptionalthis-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.
fromquerystringOptionalCustom range start, YYYY-MM-DD.
toquerystringOptionalCustom range end, YYYY-MM-DD.
customerIdquerystringOptionalCustomer filter.
vendorIdquerystringOptionalVendor filter.
warehouseIdquerystringOptionalWarehouse filter.
gstRegistrationIdquerystringOptionalGST registration filter.
salespersonIdquerystringOptionalSalesperson filter (forced to their own for restricted sales members).
itemIdquerystringOptionalItem trends: the item to follow.
granularityquerystringOptionalitem-sales-trend: day, week or month. Default: month.
monthquerystringOptionalgst-filing: the return month, 1-12 (with year).
yearquerystringOptionalgst-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

JSON
{
  "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

GET/api/v1/reports/{slug}/pdf

Download a report as a PDF

Public — no scope required

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

NameInTypeRequiredDescription
slugpathstringRequiredReport slug from the hub.
rangequerystringOptionalthis-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.
fromquerystringOptionalCustom range start, YYYY-MM-DD.
toquerystringOptionalCustom range end, YYYY-MM-DD.
customerIdquerystringOptionalCustomer filter.
vendorIdquerystringOptionalVendor filter.
warehouseIdquerystringOptionalWarehouse filter.
gstRegistrationIdquerystringOptionalGST registration filter.
salespersonIdquerystringOptionalSalesperson filter (forced to their own for restricted sales members).
itemIdquerystringOptionalItem trends: the item to follow.
monthquerystringOptionalgst-filing: the return month, 1-12 (with year).
yearquerystringOptionalgst-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

Binary response — application/pdf. The report as a PDF attachment, with a Content-Disposition filename.

Possible errors: unauthorized, not_found, validation_error

GET/api/v1/reports/{slug}/csv

Download a report as CSV

Public — no scope required

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

NameInTypeRequiredDescription
slugpathstringRequiredReport slug from the hub.
rangequerystringOptionalthis-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.
fromquerystringOptionalCustom range start, YYYY-MM-DD.
toquerystringOptionalCustom range end, YYYY-MM-DD.
customerIdquerystringOptionalCustomer filter.
vendorIdquerystringOptionalVendor filter.
warehouseIdquerystringOptionalWarehouse filter.
gstRegistrationIdquerystringOptionalGST registration filter.
salespersonIdquerystringOptionalSalesperson filter (forced to their own for restricted sales members).
itemIdquerystringOptionalItem 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

Binary response — text/csv; charset=utf-8. The table as a CSV attachment, with a Content-Disposition filename.

Possible errors: unauthorized, not_found, validation_error

GET/api/v1/reports/gst-filing/json

Download the GSTN JSON for a GST period

Scope: gstFiling.read

The 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

NameInTypeRequiredDescription
monthquerystringOptionalThe return month, 1-12 (with year). Default: this month.
yearquerystringOptionalThe return year, YYYY (with month).
gstRegistrationIdquerystringOptionalThe GST registration. Default: the organization's default registration. An unknown id is 422.
typequerystringOptionalgstr1 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

Binary 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