Skip to content
View as Markdown

Recipe: sales export to BI ​

Sales, refunds and cash flow go out of Bito to a BI tool, a warehouse or 1C — read only.

Permissions needed: sale, transactions.

Reports and permissions

The reports/* and sales/* report endpoints have no permission key. Once an app declares even one permission in required_permissions, they are closed to it (Create an integration). If you need reports, declare no permissions, or build the data from the get-paging methods below.

1. Sales ​

json
POST /trade/get-paging

{ "page": 1, "limit": 200, "organization_id": "…", "date_from": "2026-11-01T00:00:00Z", "date_to": "2026-11-05T23:59:59Z" }

date_from/date_to filter by sale time (sold_at). For an incremental export, send updated_at instead — that also returns sales that changed (cancelled, partly refunded).

The main row fields: number, state, sold_at, total_amount, total_to_pay, total_discount, total_cost, debt, total_refunded_amount, currency, customer, organization, responsible, order_id.

POS receipts are sales too. A receipt rung up at the till is written as a trade and shows up in this list — there is no separate receipts resource.

2. Sale lines ​

http
GET /trade/get-items/{id}

Each line has item_id (the line id), _id (the product id), amount, refunded_amount, price, total_price, total_to_pay, discounts, taxes and warehouse.

3. Refunds ​

A refund is a separate sale with is_refund: true. Refunds only:

json
POST /trade/get-paging

{ "page": 1, "limit": 200, "is_refund": true, "updated_at": "2026-11-05T00:00:00Z" }

The original sale's total_refunded_amount grows; "is_fully_refunded": true returns fully refunded sales. List rows carry no is_refund field — separate refunds with the filter.

4. Cash flow ​

json
POST /transaction/get-paging

{ "page": 1, "limit": 200, "organization_id": "…", "date_from": "2026-11-01T00:00:00Z", "date_to": "2026-11-05T23:59:59Z" }

type is income, expense, transfer, exchange or exchange_method; filter state with states. This method has no updated_at — re-read the last few days and upsert by _id.

5. Ready-made reports ​

For aggregates, see sales reports: totals by product, customer, employee, payment method, category and supplier, plus unsold products. Mind the permissions warning above.

Schedule ​

ModeWhenWhat
IncrementalHourlyStep 1 with updated_at, step 2 for new sales
By periodOnce a daySteps 1–4 for yesterday with date_from/date_to

Methods ​

StepMethod
SalesPOST /trade/get-paging
LinesGET /trade/get-items/{id}
Cash flowPOST /transaction/get-paging
ReportsReport sales

Bito 2.0 Integration API