Skip to main content
GET
/
api
/
v1
/
accounts
/
statement
Account Statements
curl --request GET \
  --url https://api.example.com/api/v1/accounts/statement
{
  "statements": [
    {
      "id": "<string>",
      "date": "<string>",
      "totalSales": 123,
      "totalPayouts": 123,
      "commissionUser": 123,
      "commissionVentana": 123,
      "totalPaid": 123,
      "totalCollected": 123,
      "remainingBalance": 123,
      "isSaldado": true,
      "byVendedor": [
        {}
      ]
    }
  ],
  "totals": {
    "totalSales": 123,
    "totalPayouts": 123,
    "totalRemainingBalance": 123
  }
}

Overview

Returns account statements showing daily sales, payouts, commissions, payments, and balances. Supports multiple scopes and dimensions with RBAC filtering.

Authentication

Requires JWT authentication:
  • VENDEDOR: scope=mine + dimension=vendedor (forced to own ID)
  • VENTANA: scope=mine (own window) or scope=ventana (sellers breakdown)
  • ADMIN: Any scope/dimension

Query Parameters

month
string
Month in YYYY-MM format (e.g., 2024-03)
date
enum
Date preset: today, yesterday, week, month, year, range
fromDate
string
Start date YYYY-MM-DD (custom range)
toDate
string
End date YYYY-MM-DD (custom range)
scope
enum
required
Data scope: mine, ventana, all
dimension
enum
required
Breakdown dimension: vendedor, ventana, banca
ventanaId
string
Filter by ventana (admin only)
vendedorId
string
Filter by seller (admin/ventana)
bancaId
string
Filter by banca (admin only)
sort
enum
default:"desc"
Sort order: asc, desc

Response

statements
array
Daily statement records
totals
object
Period totals

ETags and Caching

Supports HTTP ETags for efficient caching:
  • ETag header included in response
  • If-None-Match request header returns 304 Not Modified if unchanged
  • Cache-Control: private, max-age=60, stale-while-revalidate=120

Example Request

GET /api/v1/accounts/statement?month=2024-03&scope=mine&dimension=ventana

Example Response

{
  "success": true,
  "data": {
    "statements": [
      {
        "id": "stmt-001",
        "date": "2024-03-15",
        "totalSales": 500000,
        "totalPayouts": 250000,
        "commissionUser": 12500,
        "commissionVentana": 5000,
        "totalPaid": 100000,
        "totalCollected": 0,
        "remainingBalance": 132500,
        "isSaldado": false
      },
      {
        "id": "stmt-002",
        "date": "2024-03-14",
        "totalSales": 450000,
        "totalPayouts": 200000,
        "commissionUser": 11250,
        "commissionVentana": 4500,
        "totalPaid": 220000,
        "totalCollected": 0,
        "remainingBalance": 14750,
        "isSaldado": true
      }
    ],
    "totals": {
      "totalSales": 950000,
      "totalPayouts": 450000,
      "totalRemainingBalance": 147250
    }
  }
}

Balance Calculation

Balance per day (for VENTANA/ADMIN viewing windows):
remainingBalance = totalSales - totalPayouts - commissionVentana - totalPaid + totalCollected
Balance for VENDEDOR:
remainingBalance = totalPayouts + commissionUser - totalPaid

Build docs developers (and LLMs) love