BizKitHub
DocsAPI ReferenceBranch/bff/branch/monthly-breakdown
getBranchAdmin BFF

/bff/branch/monthly-breakdown

Returns one row per calendar month over the requested window with: gross revenue (SUM(price × count − sale), storno items excluded), net credit balance, applied write-offs and the resulting "net" (revenue − franchise_fee + writeoff). On top of the rows the response carries window totals plus monthly average + monthly median + best-month + worst-month reference points the admin uses to colour-code each row relative to the branch's own baseline. Franchise fields are emitted as 0 when the branch has no franchise_fee_percentage configured. Revenue is bucketed by COALESCE(core__calendar_event.start_time, shop__order_item.inserted_date) — event-linked items (gym lessons, calendar appointments) land in the month they happened, non-event items in the month they were recorded.

BranchgetBffBranchMonthly-breakdown

Parameters

2 query

Query parameters

· 2
branchSlugstringRequired

Branch slug.

Examplegymroom-vinohrady
monthCountstringOptional

How many calendar months to return (default 24, clamped to [1, 60]). The window always ends with the current month.

Example12

Response schema

1 status code documented

200Success
branchIdstringRequired
branchSlugstringRequired
branchNamestringRequired
currencystringRequired

ISO 4217 code of the organisation default currency.

franchiseFeePercentagenumberOptional

Branch franchise fee in percent. Omitted when not configured.

monthCountnumberRequired

Effective number of returned months (post-clamp).

monthsobject[]Required
Each array item:
monthstringRequired

Month identifier in "YYYY-MM" format.

revenuenumberRequired

Gross revenue (storno excluded).

cashInAmountnumberRequired

Real money actually received in this calendar month: successful gateway transactions (status PAID/COMPLETE) + auto-matched Fio bank wires + manually-recorded bank transfers, all paired to orders that have at least one item attributed to the branch. Dated by the day the money moved, NOT by the order's revenue date — cash-flow figure, not turnover. Cross-branch orders are pro-rated by each branch's share of the order's revenue, so summing this column across branches reproduces the gateway/bank totals (no double-counting). Cash receipts, manual_mark write-offs and credit/voucher redemptions are excluded; multiple gateway attempts collapse naturally (only PAID/COMPLETE rows contribute); manual price edits on the order do NOT change payment-row price, so this figure is free of operator distortion.

creditAmountnumberRequired

Net credit balance moved in the month.

writeoffnumberRequired

Sum of write-offs effective in the month.

writeoffAgainstFranchisornumberRequired

Subset of writeoff whose SUPPLIER (příjemce) is the franchisor / organisation contact. Since 2026-07 this is the ONLY figure that feeds the settlement / vyrovnání — write-offs with a third-party supplier or with the supplier still unset remain visible under writeoff for record-keeping but do NOT contribute to the branch↔org settlement price (they are settled outside the franchisee relationship).

franchiseFeePercentagenumberRequired

Franchise-fee rate that fired in this month, picked from shop__branch_franchise_fee by the rule whose [fromDate, toDate] window covers the month's last day. 0 when no rule covers it. Equals the top-level franchiseFeePercentage for months in which the current rule has been in force; differs for older months whose rule has since been superseded — the whole point of the history table.

franchiseFeeAmountnumberRequired

revenue × franchiseFeePercentage ÷ 100 (rounded). Computed with the per-MONTH rate, not the live rate — a mid-year rate change is attributed to the months that actually experienced each rate.

franchiseFeeNotestring | nullOptional

Free-form description attached to the franchise-fee rule that fired for this month (services, agreement scope). Rendered into the finance-report PDF. null when no rule covers the month or the rule has no note.

One of 2:
Variant 1
string
Variant 2
null
gatewayFeeAmountnumberRequired

Money the payment gateway pocketed as commission on the gateway-routed slice of this month's cash-in. Only the gateway leg of cashInAmount is fee-bearing (bank wires and auto-matched Fio transfers contribute zero). The rate applied to each transaction is the commission period (configured on the gateway detail) whose [fromDate, toDate] window covers the payment date; latest fromDate wins when overlaps exist. Pro-rated across branches the same way as cashInAmount. Subtracted in net. Zero when no commission period is configured.

costAmountnumberRequired

Sum of recurring FIXED branch costs (rent, energy, …) that apply to this month, computed from shop__branch_cost + variable monthly entries. Displayed as "Fixní náklady" in the Finance grid.

costAmountAgainstFranchisornumberRequired

Subset of costAmount whose supplier (shop__branch_cost.contact_id) matches the parent branch's branchContact (or the org internal contact for top-level branches). Flows into the settlement — the rest is paid to unrelated third parties (energy, cleaning, …) and settled outside this report.

variableCostnumberRequired

Variable cost — sum of shop__order_item.cost × count (snapshotted internal cost per unit at item-create time, FX-converted to the order currency) for every non-storno item attributed to this branch whose revenue date falls in the month. Positive magnitude; subtracted from net and displayed as a signed negative number in the Finance grid + PDF report ("Variabilní náklady" column).

netnumberRequired

revenue − franchiseFeeAmount + writeoff − costAmount − gatewayFeeAmount − variableCost (what the branch keeps).

invoiceobjectOptional

Most recent settlement order for this month, including storno rows so the Finance grid can render "storno" as a distinct icon state. Omitted only when no order has ever been issued.

orderIdnumberRequired

Internal shop__order.id.

orderHashstringRequired

Hash used by the admin order detail URL (/order/{orderHash}).

orderNumberstringRequired

Human-facing order number from the order group sequence.

direction"org-to-branch" | "branch-to-org"Required

org-to-branch (default since 2026-07-03) = organisation invoices the branch. branch-to-org is kept for legacy orders issued before the direction was unified — never produced by new issue calls.

paidDatestring | nullRequired

ISO timestamp when the settlement order was marked as paid (shop__order.order_pay_date). null while the order is still awaiting payment. Deferred statements (org owes branch, 0-Kč order + writeoff) stay null forever — the debt is cleared by an actual bank transfer that lands as cashIn in the settlement formula.

One of 2:
Variant 1
string
Variant 2
null
dueDatestring | nullRequired

ISO date the order becomes overdue (shop__order.due_date). Drives the Finance-grid month icon: past-due unpaid orders render red, still-open unpaid ones render amber. null on legacy rows created before the field was set explicitly — treated as "no overdue signal".

One of 2:
Variant 1
string
Variant 2
null
isStornobooleanRequired

True when the order is currently in a storno-typed status. Rendered as its own state in the Finance grid so the operator sees "storno" instead of "no order" when a settlement invoice is voided.

totalsobjectRequired
revenuenumberRequired
cashInAmountnumberRequired

Sum of cashInAmount over the window.

creditAmountnumberRequired
writeoffnumberRequired
franchiseFeeAmountnumberRequired
gatewayFeeAmountnumberRequired
costAmountnumberRequired
variableCostnumberRequired

Sum of variableCost (internal item cost) over the window.

netnumberRequired
monthlyAverageRevenuenumberRequired
monthlyMedianRevenuenumberRequired
monthlyAverageNetnumberRequired
monthlyMedianNetnumberRequired
bestMonthnull | objectRequired
One of 2:
Variant 1
null
Variant 2
monthstringRequired
netnumberRequired
worstMonthnull | objectRequired
One of 2:
Variant 1
null
Variant 2
monthstringRequired
netnumberRequired

Response example

application/json
{
  "branchId": "example_branchId",
  "branchSlug": "example_branchSlug",
  "branchName": "example_branchName",
  "currency": "example_currency",
  "franchiseFeePercentage": 0,
  "monthCount": 0,
  "months": [
    {
      "month": "example_month",
      "revenue": 0,
      "cashInAmount": 0,
      "creditAmount": 0,
      "writeoff": 0,
      "writeoffAgainstFranchisor": 0,
      "franchiseFeePercentage": 0,
      "franchiseFeeAmount": 0,
      "gatewayFeeAmount": 0,
      "costAmount": 0,
      "costAmountAgainstFranchisor": 0,
      "variableCost": 0,
      "net": 0,
      "invoice": {
        "orderId": 0,
        "orderHash": "example_orderHash",
        "orderNumber": "example_orderNumber",
        "isStorno": false
      }
    }
  ],
  "totals": {
    "revenue": 0,
    "cashInAmount": 0,
    "creditAmount": 0,
    "writeoff": 0,
    "franchiseFeeAmount": 0,
    "gatewayFeeAmount": 0,
    "costAmount": 0,
    "variableCost": 0,
    "net": 0,
    "monthlyAverageRevenue": 0,
    "monthlyMedianRevenue": 0,
    "monthlyAverageNet": 0,
    "monthlyMedianNet": 0
  }
}

Request example

GET /bff/branch/monthly-breakdown

get
curl -X GET "https://api.bizkithub.com/bff/branch/monthly-breakdown?branchSlug=gymroom-vinohrady&monthCount=12" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"

Need an API key?

All BizKitHub public API endpoints require authentication via API key.

Get API Key