Credith exposes four analytical report endpoints that cover different scopes of the business: product-level performance across a company, a day-by-day store gain series over a custom date range, a monthly revenue and staffing summary for a single store, and aggregated financials rolled up to the company level. All four operate against theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/RoyGeova07/Credith/llms.txt
Use this file to discover all available pages before exploring further.
cd schema using raw PostgreSQL queries with CTEs, and all return pre-computed grossGain and netGain figures calculated from sell_price - buy_price margins.
All four report endpoints are restricted by role.
GET /api/reports/products and GET /api/reports/companies require the OWNER role. GET /api/reports/stores and GET /api/reports/stores/range accept either OWNER or ADMIN. The API-level roleMiddleware enforces this — requests from EMPLOYEE-role users are rejected with 403. Ensure the JWT in the Authorization header belongs to a user with the appropriate role.GET /api/reports/products
Returns product performance data for a company, broken down by product and store. For each product the response includes total quantity sold, current in-stock units, gross gain (sell price margin × qty), and net gain (line total margin × qty) — both for the company as a whole and per individual store.
When no month/year is provided the report covers all historical sales. When a period is specified, only bills created within that calendar month are included.
Query parameters
Limits the report to products sold by or stocked in stores belonging to this company.
Optional. Narrows both the sales and inventory queries to a single store within the company.
Optional. Accepts either a numeric month (
1–12) alongside year, or a combined YYYY-MM string (e.g. "2026-05"). When omitted together with year, the report covers all historical data.The four-digit calendar year. Required when
month is sent as a plain integer.Maximum number of products to return per page. Capped at
100.Number of products to skip (for pagination).
Describes the date range applied to the query.
Paginated list of product performance objects.
| Status | Cause |
|---|---|
400 | companyId missing, invalid month/year combination |
GET /api/reports/stores
Returns the monthly revenue summary and employee roster for a single store. If no month/year is specified, the current calendar month is used by default. Requires ADMIN or OWNER role.
Query parameters
UUID of the store to report on.
Optional. Numeric month (
1–12) with year, or YYYY-MM string. Defaults to the current month.Required when
month is a plain integer.Monthly performance snapshot for the requested store.
| Status | Cause |
|---|---|
400 | storeId missing or invalid date parameters |
404 | No store found for the given storeId |
GET /api/reports/stores/range
Returns a day-by-day series of gross and net gain for a store between two calendar dates. Each entry in data corresponds to a single calendar day; days with no sales return grossGain: 0, netGain: 0. Requires ADMIN or OWNER role.
Query parameters
UUID of the store.
Inclusive start date in
YYYY-MM-DD format.Inclusive end date in
YYYY-MM-DD format.| Status | Cause |
|---|---|
400 | storeId, startDate, or endDate missing; dates not in YYYY-MM-DD format |
GET /api/reports/companies
Returns aggregated monthly revenue for every active store within a company. Defaults to the current calendar month if no period is specified. Requires OWNER role.
Query parameters
UUID of the company to report on.
Optional. Numeric month (
1–12) with year, or YYYY-MM string. Defaults to the current month.Required when
month is a plain integer.Aggregated company report.
| Status | Cause |
|---|---|
400 | companyId missing or invalid date parameters |
404 | No company found for the given companyId |