# Report sales

::: info
Har bir javob umumiy konvertda qaytadi — `code`, `message`, `messages`, `status_code`, `time` — foydali yuk esa `data` ichida. Quyidagi jadvallar faqat `data` ichini tavsiflaydi.
:::

## POST /reports/trade/pagin

Paginated list of trades for the reporting window.

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/trade/pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "limit": 0,
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "limit": 0,
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/trade/pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "limit": 0,
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "limit": 0,
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `limit` | `number` | Ha | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `date_from` | `string (date-time)` | Yo‘q | Start of the date range. |
| `date_to` | `string (date-time)` | Yo‘q | End of the date range. |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `state` | `string` | Yo‘q | Mumkin qiymatlar: `canceled`, `done` |

```json
{
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "sort": {
    "name": 1
  },
  "state": "canceled"
}
```

**Javob**

| Maydon | Tur | Tavsif |
|---|---|---|
| `list` | `object[]` |  |
| `total` | `number` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "list": [
      {}
    ],
    "total": 0
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## POST /reports/trade/by-product/pagin

Trade aggregation grouped by product.

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-product/pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "limit": 0,
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-product/pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "limit": 0,
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-product/pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "limit": 0,
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "limit": 0,
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-product/pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `limit` | `number` | Ha | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `category_id` | `string` | Yo‘q |  |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `date_from` | `string (date-time)` | Yo‘q | Start of the date range. |
| `date_to` | `string (date-time)` | Yo‘q | End of the date range. |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `trade_state` | `string` | Yo‘q | Mumkin qiymatlar: `new`, `in_progress`, `canceled`, `done` |
| `trade_states` | `string[]` | Yo‘q |  |
| `state` | `string` | Yo‘q | Mumkin qiymatlar: `canceled`, `done` |

```json
{
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "sort": {
    "name": 1
  },
  "trade_state": "new",
  "trade_states": [
    "new"
  ],
  "state": "canceled"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/trade/by-customer/pagin

Trade aggregation grouped by customer.

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-customer/pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "limit": 0,
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-customer/pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "limit": 0,
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-customer/pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "limit": 0,
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "limit": 0,
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/by-customer/pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `limit` | `number` | Ha | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `date_from` | `string (date-time)` | Yo‘q | Start of the date range. |
| `date_to` | `string (date-time)` | Yo‘q | End of the date range. |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `state` | `string` | Yo‘q | Mumkin qiymatlar: `canceled`, `done` |

```json
{
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "sort": {
    "name": 1
  },
  "state": "canceled"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/trade/items/pagin

Paginated list of individual trade line items.

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/trade/items/pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "limit": 0,
  "page": 0,
  "_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/items/pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "limit": 0,
    "page": 0,
    "_id": "64b7f4d9e2b3b6a0b7c5d7ff"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/trade/items/pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "limit": 0,
        "page": 0,
        "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "limit": 0,
  "page": 0,
  "_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/trade/items/pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `limit` | `number` | Ha | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `_id` | `string` | Ha |  |

```json
{
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/sales/items/unsold-paging

Products that have not been sold in the reporting window.

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/items/unsold-paging' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/items/unsold-paging', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/items/unsold-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/items/unsold-paging');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `sale_type` | `string` | Yo‘q | Mumkin qiymatlar: `receipt`, `sale_contract`, `trade` |
| `from_date` | `string (date-time)` | Yo‘q | Start of the reporting window. |
| `to_date` | `string (date-time)` | Yo‘q | End of the reporting window. |
| `organizations` | `string[]` | Yo‘q |  |
| `employees` | `string[]` | Yo‘q |  |
| `responsible_ids` | `string[]` | Yo‘q |  |
| `mediator_ids` | `string[]` | Yo‘q |  |
| `divider` | `string` | Yo‘q | Time bucket of the chart series.. Mumkin qiymatlar: `hour`, `day`, `week`, `month`, `quarter`, `year`. Standart: `"day"` |
| `field` | `string` | Yo‘q | Metric the chart plots.. Mumkin qiymatlar: `gross_sales`, `refund`, `discount`, `gift`, `net_sales`, `profit`. Standart: `"gross_sales"` |
| `limit` | `number` | Yo‘q | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `sort_by` | `string` | Yo‘q | Field name to sort by. |
| `category_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `supplier_id` | `string` | Yo‘q |  |
| `supplier_category_id` | `string` | Yo‘q |  |
| `asc` | `integer` | Yo‘q | Sort direction: `1` ascending, `-1` descending.. Mumkin qiymatlar: `1`, `-1`. Standart: `-1` |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `report_by` | `string` | Yo‘q | Mumkin qiymatlar: `created_by`, `responsible` |
| `is_product` | `boolean` | Yo‘q |  |
| `is_material` | `boolean` | Yo‘q |  |
| `is_semi_product` | `boolean` | Yo‘q |  |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `product`, `customer`, `employee`, `payment`, `category` |
| `min_items_sold` | `number` | Yo‘q |  |
| `min_gross_sales` | `number` | Yo‘q |  |
| `product_type` | `string` | Yo‘q | Mumkin qiymatlar: `is_semi_product`, `is_product`, `is_material`, `is_service` |
| `quantity` | `number` | Yo‘q |  |
| `min_quantity` | `number` | Yo‘q |  |
| `stock_status` | `string` | Yo‘q | Mumkin qiymatlar: `out_of_stock`, `in_stock` |

```json
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort_by": "string",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "asc": 1,
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort": {
    "name": 1
  },
  "report_by": "created_by",
  "is_product": false,
  "is_material": false,
  "is_semi_product": false,
  "type": "product",
  "min_items_sold": 0,
  "min_gross_sales": 0,
  "product_type": "is_semi_product",
  "quantity": 0,
  "min_quantity": 0,
  "stock_status": "out_of_stock"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/sales/by-employee-pagin

Sales aggregated by employee (salesperson).

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-employee-pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-employee-pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-employee-pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-employee-pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `sale_type` | `string` | Yo‘q | Mumkin qiymatlar: `receipt`, `sale_contract`, `trade` |
| `from_date` | `string (date-time)` | Yo‘q | Start of the reporting window. |
| `to_date` | `string (date-time)` | Yo‘q | End of the reporting window. |
| `organizations` | `string[]` | Yo‘q |  |
| `employees` | `string[]` | Yo‘q |  |
| `responsible_ids` | `string[]` | Yo‘q |  |
| `mediator_ids` | `string[]` | Yo‘q |  |
| `divider` | `string` | Yo‘q | Time bucket of the chart series.. Mumkin qiymatlar: `hour`, `day`, `week`, `month`, `quarter`, `year`. Standart: `"day"` |
| `field` | `string` | Yo‘q | Metric the chart plots.. Mumkin qiymatlar: `gross_sales`, `refund`, `discount`, `gift`, `net_sales`, `profit`. Standart: `"gross_sales"` |
| `limit` | `number` | Yo‘q | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `sort_by` | `string` | Yo‘q | Field name to sort by. |
| `category_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `supplier_id` | `string` | Yo‘q |  |
| `supplier_category_id` | `string` | Yo‘q |  |
| `asc` | `integer` | Yo‘q | Sort direction: `1` ascending, `-1` descending.. Mumkin qiymatlar: `1`, `-1`. Standart: `-1` |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `date_from` | `string (date-time)` | Yo‘q | Start of the date range. |
| `date_to` | `string (date-time)` | Yo‘q | End of the date range. |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `report_by` | `string` | Yo‘q | Mumkin qiymatlar: `created_by`, `responsible` |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `product`, `customer`, `employee`, `payment`, `category` |

```json
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort_by": "string",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "asc": 1,
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "sort": {
    "name": 1
  },
  "report_by": "created_by",
  "type": "product"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/sales/by-payment-method-pagin

Sales aggregated by payment method.

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-payment-method-pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "report_by": "created_by",
  "type": "product"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-payment-method-pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "sale_type": "receipt",
    "from_date": "2025-05-01T12:00:00Z",
    "to_date": "2025-05-01T12:00:00Z",
    "organizations": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "employees": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "responsible_ids": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "mediator_ids": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "divider": "hour",
    "field": "gross_sales",
    "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "product_ids": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "report_by": "created_by",
    "type": "product"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-payment-method-pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "sale_type": "receipt",
        "from_date": "2025-05-01T12:00:00Z",
        "to_date": "2025-05-01T12:00:00Z",
        "organizations": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "employees": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "responsible_ids": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "mediator_ids": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "divider": "hour",
        "field": "gross_sales",
        "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "product_ids": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "report_by": "created_by",
        "type": "product",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "report_by": "created_by",
  "type": "product"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-payment-method-pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `sale_type` | `string` | Yo‘q | Mumkin qiymatlar: `receipt`, `sale_contract`, `trade` |
| `from_date` | `string (date-time)` | Yo‘q | Start of the reporting window. |
| `to_date` | `string (date-time)` | Yo‘q | End of the reporting window. |
| `organizations` | `string[]` | Yo‘q |  |
| `employees` | `string[]` | Yo‘q |  |
| `responsible_ids` | `string[]` | Yo‘q |  |
| `mediator_ids` | `string[]` | Yo‘q |  |
| `divider` | `string` | Yo‘q | Time bucket of the chart series.. Mumkin qiymatlar: `hour`, `day`, `week`, `month`, `quarter`, `year`. Standart: `"day"` |
| `field` | `string` | Yo‘q | Metric the chart plots.. Mumkin qiymatlar: `gross_sales`, `refund`, `discount`, `gift`, `net_sales`, `profit`. Standart: `"gross_sales"` |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `category_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `supplier_id` | `string` | Yo‘q |  |
| `supplier_category_id` | `string` | Yo‘q |  |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `report_by` | `string` | Yo‘q | Mumkin qiymatlar: `created_by`, `responsible` |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `product`, `customer`, `employee`, `payment`, `category` |

```json
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "report_by": "created_by",
  "type": "product"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/sales/by-category-pagin

Sales aggregated by product category.

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `sale_type` | `string` | Yo‘q | Mumkin qiymatlar: `receipt`, `sale_contract`, `trade` |
| `from_date` | `string (date-time)` | Yo‘q | Start of the reporting window. |
| `to_date` | `string (date-time)` | Yo‘q | End of the reporting window. |
| `organizations` | `string[]` | Yo‘q |  |
| `employees` | `string[]` | Yo‘q |  |
| `responsible_ids` | `string[]` | Yo‘q |  |
| `mediator_ids` | `string[]` | Yo‘q |  |
| `divider` | `string` | Yo‘q | Time bucket of the chart series.. Mumkin qiymatlar: `hour`, `day`, `week`, `month`, `quarter`, `year`. Standart: `"day"` |
| `field` | `string` | Yo‘q | Metric the chart plots.. Mumkin qiymatlar: `gross_sales`, `refund`, `discount`, `gift`, `net_sales`, `profit`. Standart: `"gross_sales"` |
| `limit` | `number` | Yo‘q | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `category_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `supplier_id` | `string` | Yo‘q |  |
| `supplier_category_id` | `string` | Yo‘q |  |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `report_by` | `string` | Yo‘q | Mumkin qiymatlar: `created_by`, `responsible` |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `product`, `customer`, `employee`, `payment`, `category` |

```json
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort": {
    "name": 1
  },
  "report_by": "created_by",
  "type": "product"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/sales/by-category-all

Sales aggregated by category (full / non-paged variant).

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-all' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "field": "gross_sales",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "report_by": "created_by",
  "type": "product"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-all', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "sale_type": "receipt",
    "from_date": "2025-05-01T12:00:00Z",
    "to_date": "2025-05-01T12:00:00Z",
    "organizations": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "employees": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "responsible_ids": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "mediator_ids": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "field": "gross_sales",
    "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "product_ids": [
      "64b7f4d9e2b3b6a0b7c5d7ff"
    ],
    "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "report_by": "created_by",
    "type": "product"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-all",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "sale_type": "receipt",
        "from_date": "2025-05-01T12:00:00Z",
        "to_date": "2025-05-01T12:00:00Z",
        "organizations": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "employees": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "responsible_ids": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "mediator_ids": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "field": "gross_sales",
        "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "product_ids": [
            "64b7f4d9e2b3b6a0b7c5d7ff",
        ],
        "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "report_by": "created_by",
        "type": "product",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "field": "gross_sales",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "report_by": "created_by",
  "type": "product"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-category-all');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `sale_type` | `string` | Yo‘q | Mumkin qiymatlar: `receipt`, `sale_contract`, `trade` |
| `from_date` | `string (date-time)` | Yo‘q | Start of the reporting window. |
| `to_date` | `string (date-time)` | Yo‘q | End of the reporting window. |
| `organizations` | `string[]` | Yo‘q |  |
| `employees` | `string[]` | Yo‘q |  |
| `responsible_ids` | `string[]` | Yo‘q |  |
| `mediator_ids` | `string[]` | Yo‘q |  |
| `field` | `string` | Yo‘q | Metric the chart plots.. Mumkin qiymatlar: `gross_sales`, `refund`, `discount`, `gift`, `net_sales`, `profit`. Standart: `"gross_sales"` |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `category_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `supplier_id` | `string` | Yo‘q |  |
| `supplier_category_id` | `string` | Yo‘q |  |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `report_by` | `string` | Yo‘q | Mumkin qiymatlar: `created_by`, `responsible` |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `product`, `customer`, `employee`, `payment`, `category` |

```json
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "field": "gross_sales",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "report_by": "created_by",
  "type": "product"
}
```

**Javob**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {},
  "time": "2025-05-01T12:00:00Z"
}
```

## POST /reports/sales/by-mediator-pagin

Sales aggregated by mediator (broker / referrer).

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-mediator-pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-mediator-pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-mediator-pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-mediator-pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `sale_type` | `string` | Yo‘q | Mumkin qiymatlar: `receipt`, `sale_contract`, `trade` |
| `from_date` | `string (date-time)` | Yo‘q | Start of the reporting window. |
| `to_date` | `string (date-time)` | Yo‘q | End of the reporting window. |
| `organizations` | `string[]` | Yo‘q |  |
| `employees` | `string[]` | Yo‘q |  |
| `responsible_ids` | `string[]` | Yo‘q |  |
| `mediator_ids` | `string[]` | Yo‘q |  |
| `divider` | `string` | Yo‘q | Time bucket of the chart series.. Mumkin qiymatlar: `hour`, `day`, `week`, `month`, `quarter`, `year`. Standart: `"day"` |
| `field` | `string` | Yo‘q | Metric the chart plots.. Mumkin qiymatlar: `gross_sales`, `refund`, `discount`, `gift`, `net_sales`, `profit`. Standart: `"gross_sales"` |
| `limit` | `number` | Yo‘q | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `sort_by` | `string` | Yo‘q | Field name to sort by. |
| `category_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `supplier_id` | `string` | Yo‘q |  |
| `supplier_category_id` | `string` | Yo‘q |  |
| `asc` | `integer` | Yo‘q | Sort direction: `1` ascending, `-1` descending.. Mumkin qiymatlar: `1`, `-1`. Standart: `-1` |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `report_by` | `string` | Yo‘q | Mumkin qiymatlar: `created_by`, `responsible` |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `product`, `customer`, `employee`, `payment`, `category` |

```json
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort_by": "string",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "asc": 1,
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort": {
    "name": 1
  },
  "report_by": "created_by",
  "type": "product"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/sales/by-supplier-pagin

Sales aggregated by supplier (for products sourced from each supplier).

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-supplier-pagin' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-supplier-pagin', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-supplier-pagin",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "page": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/by-supplier-pagin');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `sale_type` | `string` | Yo‘q | Mumkin qiymatlar: `receipt`, `sale_contract`, `trade` |
| `from_date` | `string (date-time)` | Yo‘q | Start of the reporting window. |
| `to_date` | `string (date-time)` | Yo‘q | End of the reporting window. |
| `organizations` | `string[]` | Yo‘q |  |
| `employees` | `string[]` | Yo‘q |  |
| `responsible_ids` | `string[]` | Yo‘q |  |
| `mediator_ids` | `string[]` | Yo‘q |  |
| `divider` | `string` | Yo‘q | Time bucket of the chart series.. Mumkin qiymatlar: `hour`, `day`, `week`, `month`, `quarter`, `year`. Standart: `"day"` |
| `field` | `string` | Yo‘q | Metric the chart plots.. Mumkin qiymatlar: `gross_sales`, `refund`, `discount`, `gift`, `net_sales`, `profit`. Standart: `"gross_sales"` |
| `limit` | `number` | Yo‘q | Maximum number of rows to return. |
| `page` | `number` | Ha | Page number, starting from 1. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `warehouse_id` | `string` | Yo‘q |  |
| `category_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `supplier_id` | `string` | Yo‘q |  |
| `supplier_category_id` | `string` | Yo‘q |  |
| `product_id` | `string` | Yo‘q |  |
| `product_ids` | `string[]` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `contract_id` | `string` | Yo‘q |  |
| `sort` | `object` | Yo‘q |  |
| `sort.name` | `integer` | Yo‘q | Mumkin qiymatlar: `1`, `-1` |
| `report_by` | `string` | Yo‘q | Mumkin qiymatlar: `created_by`, `responsible` |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `product`, `customer`, `employee`, `payment`, `category` |

```json
{
  "sale_type": "receipt",
  "from_date": "2025-05-01T12:00:00Z",
  "to_date": "2025-05-01T12:00:00Z",
  "organizations": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "employees": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "mediator_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "divider": "hour",
  "field": "gross_sales",
  "limit": 0,
  "page": 0,
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "supplier_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "product_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "contract_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort": {
    "name": 1
  },
  "report_by": "created_by",
  "type": "product"
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/trade/pagin](#post-reports-trade-pagin).

## POST /reports/sales/settlements

Sales settlements report (cash-vs-bank / settlement reconciliation).

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/reports/sales/settlements' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 0,
  "limit": 0
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/settlements', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 0,
    "limit": 0
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/reports/sales/settlements",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 0,
        "limit": 0,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "page": 0,
  "limit": 0
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/reports/sales/settlements');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `organization_ids` | `string[]` | Yo‘q | Organization ObjectIds. |
| `responsible_id` | `string` | Yo‘q |  |
| `customer_id` | `string` | Yo‘q |  |
| `customer_category_id` | `string` | Yo‘q |  |
| `paid_states` | `string[]` | Yo‘q |  |
| `page` | `number` | Ha | Page number, starting from 1. |
| `limit` | `number` | Ha | Maximum number of rows to return. |
| `search` | `string` | Yo‘q | Free-text search. |
| `date_from` | `string (date-time)` | Yo‘q | Start of the date range. |
| `date_to` | `string (date-time)` | Yo‘q | End of the date range. |
| `organization_id` | `string` | Yo‘q | Organization ObjectId. |
| `sort_by` | `string` | Yo‘q | Field name to sort by. |
| `asc` | `integer` | Yo‘q | Sort direction: `1` ascending, `-1` descending.. Mumkin qiymatlar: `-1`, `1` |

```json
{
  "organization_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "responsible_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "customer_category_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "paid_states": [
    "fully_paid"
  ],
  "page": 0,
  "limit": 0,
  "search": "string",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort_by": "string",
  "asc": -1
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /reports/sales/by-category-all](#post-reports-sales-by-category-all).

---

*Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.*
