# Trade

::: info
Каждый ответ приходит в общем конверте — `code`, `message`, `messages`, `status_code`, `time` — а полезная нагрузка лежит в `data`. Таблицы ниже описывают содержимое `data`.
:::

## POST /trade/create

This method allows adding trade into the account.

**Нужное разрешение:** `sale_create` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/trade/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "64e24f4199a9a3c944444445",
  "state": "new",
  "responsible_id": "64e24f4199a9a3c944444451",
  "payments": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "products": [
    {
      "product_id": "64e24f4199a9a3c944444453",
      "order_item_id": "64e24f4199a9a3c944444454",
      "amount": 2,
      "box_count": 1,
      "box_item": 1,
      "price": 50,
      "total_to_pay": 100,
      "discounts": [],
      "marks": [],
      "tax_ids": [],
      "note": "This is a product note.",
      "extra_costs": [],
      "warehouse_id": "64e24f4199a9a3c944444458",
      "price_id": "64e24f4199a9a3c944444459",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ]
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "64e24f4199a9a3c944444445",
    "state": "new",
    "responsible_id": "64e24f4199a9a3c944444451",
    "payments": [
      {
        "external_transaction_id": "64e24f4199a9a3c944444453",
        "amount": 100,
        "payment_method": {
          "_id": null,
          "name": null,
          "type": null
        },
        "currency": {
          "_id": null,
          "name": null,
          "value": null,
          "side": null,
          "symbol": null
        },
        "paid": 50
      }
    ],
    "products": [
      {
        "product_id": "64e24f4199a9a3c944444453",
        "order_item_id": "64e24f4199a9a3c944444454",
        "amount": 2,
        "box_count": 1,
        "box_item": 1,
        "price": 50,
        "total_to_pay": 100,
        "discounts": [],
        "marks": [],
        "tax_ids": [],
        "note": "This is a product note.",
        "extra_costs": [],
        "warehouse_id": "64e24f4199a9a3c944444458",
        "price_id": "64e24f4199a9a3c944444459",
        "expiration_date": "2025-05-01T12:00:00Z",
        "used_measure": {
          "_id": null,
          "ratio": null,
          "amount": null
        }
      }
    ]
  }),
})
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/trade/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "64e24f4199a9a3c944444445",
        "state": "new",
        "responsible_id": "64e24f4199a9a3c944444451",
        "payments": [
            {
                "external_transaction_id": "64e24f4199a9a3c944444453",
                "amount": 100,
                "payment_method": {
                    "_id": None,
                    "name": None,
                    "type": None,
                },
                "currency": {
                    "_id": None,
                    "name": None,
                    "value": None,
                    "side": None,
                    "symbol": None,
                },
                "paid": 50,
            },
        ],
        "products": [
            {
                "product_id": "64e24f4199a9a3c944444453",
                "order_item_id": "64e24f4199a9a3c944444454",
                "amount": 2,
                "box_count": 1,
                "box_item": 1,
                "price": 50,
                "total_to_pay": 100,
                "discounts": [],
                "marks": [],
                "tax_ids": [],
                "note": "This is a product note.",
                "extra_costs": [],
                "warehouse_id": "64e24f4199a9a3c944444458",
                "price_id": "64e24f4199a9a3c944444459",
                "expiration_date": "2025-05-01T12:00:00Z",
                "used_measure": {
                    "_id": None,
                    "ratio": None,
                    "amount": None,
                },
            },
        ],
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "organization_id": "64e24f4199a9a3c944444445",
  "state": "new",
  "responsible_id": "64e24f4199a9a3c944444451",
  "payments": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "products": [
    {
      "product_id": "64e24f4199a9a3c944444453",
      "order_item_id": "64e24f4199a9a3c944444454",
      "amount": 2,
      "box_count": 1,
      "box_item": 1,
      "price": 50,
      "total_to_pay": 100,
      "discounts": [],
      "marks": [],
      "tax_ids": [],
      "note": "This is a product note.",
      "extra_costs": [],
      "warehouse_id": "64e24f4199a9a3c944444458",
      "price_id": "64e24f4199a9a3c944444459",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ]
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/create');
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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `code` | `string` | Нет |  |
| `organization_id` | `string` | Да |  |
| `order_id` | `string` | Нет |  |
| `open_ticket_id` | `string` | Нет |  |
| `open_ticket_uuid` | `string` | Нет |  |
| `state` | `string` | Да | Допустимые значения: `new`, `in_progress`, `done` |
| `customer_id` | `string` | Нет |  |
| `customer_assistant_id` | `string` | Нет |  |
| `state_id` | `string` | Нет |  |
| `responsible_id` | `string` | Да |  |
| `courier_id` | `string` | Нет |  |
| `currency` | `object` | Нет |  |
| `currency._id` | `string` | Да |  |
| `currency.name` | `string` | Да |  |
| `currency.value` | `number` | Да |  |
| `currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `currency.symbol` | `string` | Нет |  |
| `price_id` | `string` | Нет |  |
| `by_balance` | `object[]` | Нет |  |
| `by_balance[].amount` | `number` | Да |  |
| `by_balance[].currency` | `object` | Да |  |
| `by_balance[].currency._id` | `string` | Да |  |
| `by_balance[].currency.name` | `string` | Да |  |
| `by_balance[].currency.value` | `number` | Да |  |
| `by_balance[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `by_balance[].currency.symbol` | `string` | Нет |  |
| `by_balance[].paid` | `number` | Нет |  |
| `payments` | `object[]` | Да |  |
| `payments[].external_transaction_id` | `string` | Нет |  |
| `payments[].amount` | `number` | Да |  |
| `payments[].payment_method` | `object` | Нет |  |
| `payments[].payment_method._id` | `string` | Да |  |
| `payments[].payment_method.name` | `string` | Да |  |
| `payments[].payment_method.type` | `string` | Нет | Copy of the payment method's `type` at the time of sale; send the value `payment-method/get-by-id` returns (`cash` or `cashless`). The older values are still accepted so previously built payloads keep working. `gift` is no longer accepted.. Допустимые значения: `cash`, `cashless`, `system`, `card`, `debt`, `transfer`, `terminal`, `by_balance`, `by_cashback`, `trade_in`, `integration` |
| `payments[].currency` | `object` | Нет |  |
| `payments[].currency._id` | `string` | Да |  |
| `payments[].currency.name` | `string` | Да |  |
| `payments[].currency.value` | `number` | Да |  |
| `payments[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `payments[].currency.symbol` | `string` | Нет |  |
| `payments[].paid` | `number` | Нет |  |
| `applied_cashbacks` | `object[]` | Нет |  |
| `applied_cashbacks[].amount` | `number` | Да |  |
| `applied_cashbacks[].currency` | `object` | Да |  |
| `applied_cashbacks[].currency._id` | `string` | Да |  |
| `applied_cashbacks[].currency.name` | `string` | Да |  |
| `applied_cashbacks[].currency.value` | `number` | Да |  |
| `applied_cashbacks[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `applied_cashbacks[].currency.symbol` | `string` | Нет |  |
| `applied_cashbacks[].paid` | `number` | Нет |  |
| `changes` | `object[]` | Нет |  |
| `changes[].external_transaction_id` | `string` | Нет |  |
| `changes[].amount` | `number` | Да |  |
| `changes[].payment_method` | `object` | Нет |  |
| `changes[].payment_method._id` | `string` | Да |  |
| `changes[].payment_method.name` | `string` | Да |  |
| `changes[].payment_method.type` | `string` | Нет | Copy of the payment method's `type` at the time of sale; send the value `payment-method/get-by-id` returns (`cash` or `cashless`). The older values are still accepted so previously built payloads keep working. `gift` is no longer accepted.. Допустимые значения: `cash`, `cashless`, `system`, `card`, `debt`, `transfer`, `terminal`, `by_balance`, `by_cashback`, `trade_in`, `integration` |
| `changes[].currency` | `object` | Нет |  |
| `changes[].currency._id` | `string` | Да |  |
| `changes[].currency.name` | `string` | Да |  |
| `changes[].currency.value` | `number` | Да |  |
| `changes[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `changes[].currency.symbol` | `string` | Нет |  |
| `changes[].paid` | `number` | Нет |  |
| `note` | `string` | Нет |  |
| `products` | `object[]` | Да |  |
| `products[].product_id` | `string` | Да |  |
| `products[].order_item_id` | `string` | Нет |  |
| `products[].amount` | `number` | Да |  |
| `products[].box_count` | `number` | Нет |  |
| `products[].box_item` | `number` | Нет |  |
| `products[].price` | `number` | Нет |  |
| `products[].total_to_pay` | `number` | Нет |  |
| `products[].discounts` | `object[]` | Нет |  |
| `products[].discounts[]._id` | `string` | Нет | Required unless `is_custom` is true. |
| `products[].discounts[].is_custom` | `boolean` | Да |  |
| `products[].discounts[].value` | `number` | Да |  |
| `products[].discounts[].name` | `string` | Нет | Required unless `is_custom` is true. |
| `products[].discounts[].apply_type` | `string` | Да | Допустимые значения: `percent`, `cash` |
| `products[].marks` | `string[]` | Нет |  |
| `products[].tax_ids` | `string[]` | Нет |  |
| `products[].note` | `string` | Нет |  |
| `products[].extra_costs` | `object[]` | Нет |  |
| `products[].extra_costs[].cost_id` | `string` | Да |  |
| `products[].extra_costs[].amount` | `number` | Да |  |
| `products[].extra_costs[].index` | `number` | Нет |  |
| `products[].warehouse_id` | `string` | Нет |  |
| `products[].price_id` | `string` | Нет |  |
| `products[].expiration_date` | `string (date-time)` | Нет |  |
| `products[].used_measure` | `object` | Нет |  |
| `products[].used_measure._id` | `string` | Да |  |
| `products[].used_measure.ratio` | `number` | Да |  |
| `products[].used_measure.amount` | `number` | Да |  |
| `date` | `string (date-time)` | Нет |  |
| `paying_date` | `string (date-time)` | Нет |  |
| `delivery_date` | `string (date-time)` | Нет |  |
| `delivery_address` | `object` | Нет |  |
| `delivery_address.human_address` | `object` | Нет |  |
| `delivery_address.human_address.address` | `string` | Нет |  |
| `delivery_address.human_address.city` | `string` | Нет |  |
| `delivery_address.human_address.state` | `string` | Нет |  |
| `delivery_address.human_address.zip` | `string` | Нет |  |
| `delivery_address.lat` | `number` | Нет |  |
| `delivery_address.long` | `number` | Нет |  |
| `delivery_address.bearing` | `number` | Нет |  |
| `warehouse_id` | `string` | Нет |  |
| `discounts` | `object[]` | Нет |  |
| `discounts[]._id` | `string` | Нет | Required unless `is_custom` is true. |
| `discounts[].is_custom` | `boolean` | Да |  |
| `discounts[].value` | `number` | Да |  |
| `discounts[].name` | `string` | Нет | Required unless `is_custom` is true. |
| `discounts[].apply_type` | `string` | Да | Допустимые значения: `percent`, `cash` |
| `cover_by_balance` | `boolean` | Нет |  |
| `calc_tax_after_discount` | `boolean` | Нет |  |
| `installment_plan_interval` | `string` | Нет | Required when `installment_plan` is not empty.. Допустимые значения: `year`, `month` |
| `installment_plan` | `object[]` | Нет |  |
| `installment_plan[].date` | `string (date-time)` | Да |  |
| `installment_plan[].amount` | `number` | Да |  |
| `additional_costs` | `object[]` | Нет |  |
| `additional_costs[].cost_id` | `string` | Да |  |
| `additional_costs[].amount` | `number` | Да |  |
| `additional_costs[].customer_id` | `string` | Нет |  |
| `additional_costs[].employee_id` | `string` | Нет |  |
| `additional_costs[].supplier_id` | `string` | Нет |  |
| `additional_costs[].person_id` | `string` | Нет |  |
| `currency_values` | `object[]` | Нет |  |
| `currency_values[].to_currency_id` | `string` | Да |  |
| `currency_values[].denominator` | `string` | Да |  |
| `currency_values[].numerator` | `number` | Да |  |
| `to_send_customer` | `boolean` | Нет |  |
| `contract_id` | `string` | Нет |  |

```json
{
  "code": "TRADE-123",
  "organization_id": "64e24f4199a9a3c944444445",
  "order_id": "64e24f4199a9a3c944444446",
  "open_ticket_id": "64e24f4199a9a3c944444447",
  "open_ticket_uuid": "UUID-123",
  "state": "new",
  "customer_id": "64e24f4199a9a3c944444448",
  "customer_assistant_id": "64e24f4199a9a3c944444449",
  "state_id": "64e24f4199a9a3c944444450",
  "responsible_id": "64e24f4199a9a3c944444451",
  "courier_id": "64e24f4199a9a3c944444452",
  "currency": {
    "_id": "64e24f4199a9a3c944444453",
    "name": "USD",
    "value": 1,
    "side": "start",
    "symbol": "$"
  },
  "price_id": "64e24f4199a9a3c944444453",
  "by_balance": [
    {
      "amount": 100,
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "payments": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "applied_cashbacks": [
    {
      "amount": 100,
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "changes": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "note": "This is a note.",
  "products": [
    {
      "product_id": "64e24f4199a9a3c944444453",
      "order_item_id": "64e24f4199a9a3c944444454",
      "amount": 2,
      "box_count": 1,
      "box_item": 1,
      "price": 50,
      "total_to_pay": 100,
      "discounts": [],
      "marks": [],
      "tax_ids": [],
      "note": "This is a product note.",
      "extra_costs": [],
      "warehouse_id": "64e24f4199a9a3c944444458",
      "price_id": "64e24f4199a9a3c944444459",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ],
  "date": "2023-10-01T12:00:00Z",
  "paying_date": "2023-10-01T12:00:00Z",
  "delivery_date": "2023-10-01T12:00:00Z",
  "delivery_address": {
    "human_address": {
      "address": "123 Main St, New York, NY 10001",
      "city": "New York",
      "state": "NY",
      "zip": "10001"
    },
    "lat": 40.7128,
    "long": -74.006,
    "bearing": 0
  },
  "warehouse_id": "64e24f4199a9a3c944444460",
  "discounts": [
    {
      "_id": "64e24f4199a9a3c944444455",
      "is_custom": false,
      "value": 10,
      "name": "Discount 1",
      "apply_type": "percent"
    }
  ],
  "cover_by_balance": false,
  "calc_tax_after_discount": true,
  "installment_plan_interval": "month",
  "installment_plan": [
    {
      "date": "2023-10-01T12:00:00Z",
      "amount": 100
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64e24f4199a9a3c944444457",
      "amount": 5,
      "customer_id": "64e24f4199a9a3c944444457",
      "employee_id": "64e24f4199a9a3c944444457",
      "supplier_id": "64e24f4199a9a3c944444457",
      "person_id": "64e24f4199a9a3c944444457"
    }
  ],
  "currency_values": [
    {
      "to_currency_id": "64e24f4199a9a3c944444453",
      "denominator": "USD",
      "numerator": 1
    }
  ],
  "to_send_customer": false,
  "contract_id": "64e24f4199a9a3c944444461"
}
```

**Ответ**

| Поле | Тип | Описание |
|---|---|---|
| `created_at` | `string` |  |
| `updated_at` | `string` |  |
| `code` | `string` |  |
| `uuid` | `string` |  |
| `open_ticket_uuid` | `string` |  |
| `organization_id` | `string` |  |
| `organization` | `object` |  |
| `organization._id` | `string` |  |
| `organization.name` | `string` |  |
| `warehouse_id` | `string` |  |
| `warehouse` | `object` |  |
| `warehouse._id` | `string` |  |
| `warehouse.name` | `string` |  |
| `customer_id` | `string` |  |
| `customer` | `object` |  |
| `customer._id` | `string` |  |
| `customer.name` | `string` |  |
| `customer.type` | `string` |  |
| `customer.phone_number` | `string` |  |
| `customer.inn` | `string` |  |
| `customer.address` | `string` |  |
| `customer.description` | `string` |  |
| `customer.delivery_address` | `object` |  |
| `customer.delivery_address.lat` | `number` |  |
| `customer.delivery_address.long` | `number` |  |
| `customer.delivery_address.human_address` | `object` |  |
| `customer_assistant` | `object` |  |
| `customer_assistant._id` | `string` |  |
| `customer_assistant.name` | `string` |  |
| `customer_assistant.type` | `string` |  |
| `customer_assistant_hierarchy` | `string` |  |
| `responsible_id` | `string` |  |
| `note` | `string` |  |
| `responsible` | `object` |  |
| `responsible._id` | `string` |  |
| `responsible.full_name` | `string` |  |
| `responsible.phone_number` | `string` |  |
| `created_by` | `object` |  |
| `created_by._id` | `string` |  |
| `created_by.full_name` | `string` |  |
| `state` | `string` |  |
| `dynamic_state` | `string` |  |
| `is_refund` | `boolean` |  |
| `is_trash` | `boolean` |  |
| `refund_id` | `string` |  |
| `number` | `string` |  |
| `device` | `object` |  |
| `device._id` | `string` |  |
| `device.name` | `string` |  |
| `device.device_id` | `string` |  |
| `currency` | `object` |  |
| `currency_id` | `string` |  |
| `additional_costs` | `object[]` |  |
| `additional_costs[].cost_id` | `string` |  |
| `additional_costs[].payment_type_id` | `string` |  |
| `additional_costs[].payment_type` | `object` |  |
| `additional_costs[].amount` | `number` |  |
| `additional_costs[].employee` | `object` |  |
| `additional_costs[].supplier` | `object` |  |
| `additional_costs[].customer` | `object` |  |
| `additional_costs[].person` | `object` |  |
| `additional_costs[].cost` | `object` |  |
| `additional_costs[].price_id` | `string` |  |
| `additional_costs[].employee_assistant_id` | `string` |  |
| `additional_costs[].employee_assistant_hierarchy` | `object[]` |  |
| `additional_costs[].supplier_assistant_id` | `string` |  |
| `additional_costs[].supplier_assistant_hierarchy` | `object[]` |  |
| `additional_costs[].customer_assistant_id` | `string` |  |
| `additional_costs[].customer_assistant_hierarchy` | `object[]` |  |
| `additional_costs[].person_assistant_id` | `string` |  |
| `additional_costs[].person_assistant_hierarchy` | `object[]` |  |
| `additional_costs[].is_method_summary_zero` | `boolean` |  |
| `additional_costs[].item_count` | `number` |  |
| `total_extra_cost` | `number` |  |
| `total_effected_extra_cost` | `number` |  |
| `currency_values` | `object` |  |
| `currency_values.to_currency_id` | `string` |  |
| `currency_values.numerator` | `number` |  |
| `currency_values.denominator` | `number` |  |
| `price_id` | `number` |  |
| `price` | `object` |  |
| `price._id` | `string` |  |
| `price.name` | `string` |  |
| `price.short_name` | `string` |  |
| `price.code` | `string` |  |
| `invoice` | `object` |  |
| `invoice._id` | `string` |  |
| `invoice.to_be_paid` | `number` |  |
| `invoice.paid` | `number` |  |
| `invoice.paid_by_balance` | `number` |  |
| `invoice.paid_by_cashback` | `number` |  |
| `invoice.to_be_refunded` | `number` |  |
| `invoice.refunded` | `number` |  |
| `invoice.number` | `string` |  |
| `invoice.paid_state` | `string` |  |
| `invoice.installment_plan_interval` | `string` |  |
| `invoice.period` | `number` |  |
| `invoice.trade_id` | `string` |  |
| `invoice.items` | `object` |  |
| `invoice.items._id` | `string` |  |
| `invoice.items.to_be_paid` | `number` |  |
| `invoice.items.paid` | `number` |  |
| `invoice.items.paid_by_balance` | `number` |  |
| `invoice.items.paid_by_cashback` | `number` |  |
| `invoice.items.to_be_refunded` | `number` |  |
| `invoice.items.refunded` | `number` |  |
| `invoice.items.is_initial_payment` | `boolean` |  |
| `invoice.items.number` | `string` |  |
| `invoice.items.paid_state` | `string` |  |
| `invoice.items.date` | `string` |  |
| `invoice.currency_id` | `string` |  |
| `invoice.payment_type_id` | `string` |  |
| `invoice.is_refund` | `boolean` |  |
| `invoice.type` | `string` |  |
| `invoice.payment_type` | `object` |  |
| `invoice.payment_type._id` | `string` |  |
| `invoice.payment_type.name` | `string` |  |
| `payments` | `object` |  |
| `payments.payment_method` | `object` |  |
| `payments.payment_method._id` | `string` |  |
| `payments.payment_method.type` | `string` |  |
| `payments.payment_method.name` | `string` |  |
| `payments.amount` | `number` |  |
| `payments.paid` | `number` |  |
| `payments.currency` | `object` |  |
| `payments.currency._id` | `string` |  |
| `payments.currency.uuid` | `number` |  |
| `payments.currency.name` | `string` |  |
| `payments.currency.value` | `number` |  |
| `payments.currency.symbol` | `string` |  |
| `payments.currency.side` | `string` |  |
| `payments.base_currency` | `object` |  |
| `payments.base_currency.numerator` | `number` |  |
| `payments.base_currency.denominator` | `number` |  |
| `payments.base_currency_value` | `number` |  |
| `applied_cashbacks` | `object[]` |  |
| `applied_cashbacks[]._id` | `string` |  |
| `applied_cashbacks[].amount` | `number` |  |
| `applied_cashbacks[].currency` | `object` |  |
| `applied_cashbacks[].currency._id` | `string` |  |
| `applied_cashbacks[].currency.to_currency_id` | `string` |  |
| `applied_cashbacks[].currency.uuid` | `number` |  |
| `applied_cashbacks[].currency.name` | `string` |  |
| `applied_cashbacks[].currency.value` | `number` |  |
| `applied_cashbacks[].currency.symbol` | `string` |  |
| `applied_cashbacks[].currency.side` | `string` |  |
| `applied_cashbacks[].currency.numerator` | `number` |  |
| `applied_cashbacks[].currency.denominator` | `number` |  |
| `applied_cashbacks[].currency.round_type` | `string` |  |
| `applied_cashbacks[].currency.precision` | `number` |  |
| `applied_cashbacks[].paid` | `number` |  |
| `applied_cashbacks[].base_currency` | `object` |  |
| `applied_cashbacks[].base_currency.numerator` | `number` |  |
| `applied_cashbacks[].base_currency.denominator` | `number` |  |
| `applied_cashbacks[].installment_plan_changes` | `object[]` |  |
| `applied_cashbacks[].installment_plan_changes[].invoice_id` | `string` |  |
| `applied_cashbacks[].installment_plan_changes[].amount` | `number` |  |
| `earned_cashback` | `object` |  |
| `earned_cashback._id` | `string` |  |
| `earned_cashback.amount` | `number` |  |
| `earned_cashback.currency` | `object` |  |
| `earned_cashback.currency._id` | `string` |  |
| `earned_cashback.currency.to_currency_id` | `string` |  |
| `earned_cashback.currency.uuid` | `number` |  |
| `earned_cashback.currency.name` | `string` |  |
| `earned_cashback.currency.value` | `number` |  |
| `earned_cashback.currency.symbol` | `string` |  |
| `earned_cashback.currency.side` | `string` |  |
| `earned_cashback.currency.numerator` | `number` |  |
| `earned_cashback.currency.denominator` | `number` |  |
| `earned_cashback.currency.round_type` | `string` |  |
| `earned_cashback.currency.precision` | `number` |  |
| `earned_cashback.base_currency` | `object` |  |
| `earned_cashback.base_currency.numerator` | `number` |  |
| `earned_cashback.base_currency.denominator` | `number` |  |
| `changes` | `object[]` |  |
| `changes[].payment_method` | `object` |  |
| `changes[].payment_method._id` | `string` |  |
| `changes[].payment_method.type` | `string` |  |
| `changes[].payment_method.name` | `string` |  |
| `changes[].amount` | `number` |  |
| `changes[].paid` | `number` |  |
| `changes[].currency` | `object` |  |
| `changes[].currency._id` | `string` |  |
| `changes[].currency.to_currency_id` | `string` |  |
| `changes[].currency.uuid` | `number` |  |
| `changes[].currency.name` | `string` |  |
| `changes[].currency.value` | `number` |  |
| `changes[].currency.symbol` | `string` |  |
| `changes[].currency.side` | `string` |  |
| `changes[].currency.numerator` | `number` |  |
| `changes[].currency.denominator` | `number` |  |
| `changes[].currency.round_type` | `string` |  |
| `changes[].currency.precision` | `number` |  |
| `changes[].base_currency` | `object` |  |
| `changes[].base_currency.numerator` | `number` |  |
| `changes[].base_currency.denominator` | `number` |  |
| `changes[].base_currency_value` | `number` |  |
| `total_amount` | `number` |  |
| `total_refunded_amount` | `number` |  |
| `total_to_pay` | `number` |  |
| `total_to_refund` | `number` |  |
| `debt` | `number` |  |
| `total_price` | `number` |  |
| `total_added_tax` | `number` |  |
| `total_included_tax` | `number` |  |
| `discount` | `number` |  |
| `total_discount` | `number` |  |
| `discounts` | `object[]` |  |
| `discounts[].is_custom` | `boolean` | По умолчанию: `false` |
| `discounts[]._id` | `string` |  |
| `discounts[].name` | `string` |  |
| `discounts[].value` | `number` |  |
| `discounts[].apply_type` | `string` | Допустимые значения: `percent`, `cash` |
| `discounts[].currency_id` | `string` |  |
| `discounts[].value_in_percent` | `number` | По умолчанию: `0` |
| `change` | `number` |  |
| `delivery_date` | `string` |  |
| `sold_at` | `string` |  |
| `is_report_saved` | `boolean` |  |
| `products` | `object` |  |
| `installment_plan` | `object` |  |
| `installment_plan.date` | `string` |  |
| `installment_plan.amount` | `number` |  |
| `is_installment_plan` | `boolean` |  |
| `reason` | `object` |  |
| `reason._id` | `string` |  |
| `reason.name` | `string` |  |
| `reason.description` | `string` |  |
| `contract_id` | `string` |  |
| `by_balance` | `object[]` |  |
| `by_balance[]._id` | `string` |  |
| `by_balance[].amount` | `number` |  |
| `by_balance[].paid` | `number` |  |
| `by_balance[].currency` | `object` |  |
| `by_balance[].currency._id` | `string` |  |
| `by_balance[].currency.to_currency_id` | `string` |  |
| `by_balance[].currency.uuid` | `number` |  |
| `by_balance[].currency.name` | `string` |  |
| `by_balance[].currency.value` | `number` |  |
| `by_balance[].currency.symbol` | `string` |  |
| `by_balance[].currency.side` | `string` |  |
| `by_balance[].currency.numerator` | `number` |  |
| `by_balance[].currency.denominator` | `number` |  |
| `by_balance[].currency.round_type` | `string` |  |
| `by_balance[].currency.precision` | `number` |  |
| `by_balance[].base_currency` | `object` |  |
| `by_balance[].base_currency.numerator` | `number` |  |
| `by_balance[].base_currency.denominator` | `number` |  |
| `by_balance[].installment_plan_changes` | `object[]` |  |
| `by_balance[].installment_plan_changes[].invoice_id` | `string` |  |
| `by_balance[].installment_plan_changes[].amount` | `number` |  |
| `calc_tax_after_discount` | `boolean` |  |
| `calc_sale_discount_after_product` | `boolean` |  |
| `contract` | `object` |  |
| `contract._id` | `string` |  |
| `contract.created_at` | `string` |  |
| `contract.code` | `string` |  |
| `contract.name` | `string` |  |
| `contract.number` | `string` |  |
| `contract.currency_id` | `string` |  |
| `contract.organization_id` | `string` |  |
| `contract.amount` | `number` |  |
| `contract.date` | `string` |  |
| `contract.expire_date` | `string` |  |
| `contract.person_id` | `string` |  |
| `contract.note` | `string` |  |
| `contract.is_active` | `boolean` |  |
| `contract.contract_number` | `number` |  |
| `customer_before_balance` | `object[]` |  |
| `customer_before_balance[]._id` | `string` |  |
| `customer_before_balance[].currency_id` | `string` |  |
| `customer_before_balance[].amount` | `number` |  |
| `customer_before_balance[].organization_id` | `string` |  |
| `customer_before_balance[].payment_method_id` | `string` |  |
| `cashback_before_balance` | `object[]` |  |
| `cashback_before_balance[]._id` | `string` |  |
| `cashback_before_balance[].customer_id` | `string` |  |
| `cashback_before_balance[].person_id` | `string` |  |
| `cashback_before_balance[].currency_id` | `string` |  |
| `cashback_before_balance[].amount` | `number` |  |
| `customer_after_balance` | `object[]` |  |
| `customer_after_balance[]._id` | `string` |  |
| `customer_after_balance[].currency_id` | `string` |  |
| `customer_after_balance[].amount` | `number` |  |
| `customer_after_balance[].organization_id` | `string` |  |
| `customer_after_balance[].payment_method_id` | `string` |  |
| `cashback_after_balance` | `object[]` |  |
| `cashback_after_balance[]._id` | `string` |  |
| `cashback_after_balance[].customer_id` | `string` |  |
| `cashback_after_balance[].person_id` | `string` |  |
| `cashback_after_balance[].currency_id` | `string` |  |
| `cashback_after_balance[].amount` | `number` |  |
| `delivery_address` | `object` |  |
| `delivery_address.lat` | `number` |  |
| `delivery_address.long` | `number` |  |
| `delivery_address.human_address` | `object` |  |
| `delivery_address.human_address.address` | `string` |  |
| `delivery_address.human_address.city` | `string` |  |
| `delivery_address.human_address.state` | `string` |  |
| `delivery_address.human_address.zip` | `string` |  |
| `order_id` | `string` |  |
| `order` | `object` |  |
| `order._id` | `string` |  |
| `order.number` | `string` |  |
| `order.code` | `string` |  |
| `delivery_order` | `object` |  |
| `delivery_order._id` | `string` |  |
| `delivery_order.number` | `string` |  |
| `delivery_order.code` | `string` |  |
| `delivery_order.state` | `string` |  |
| `refund` | `object` |  |
| `refund.created_at` | `string` |  |
| `refund.updated_at` | `string` |  |
| `refund.code` | `string` |  |
| `refund.uuid` | `string` |  |
| `refund.open_ticket_uuid` | `string` |  |
| `refund.organization_id` | `string` |  |
| `refund.organization` | `object` |  |
| `refund.organization._id` | `string` |  |
| `refund.organization.name` | `string` |  |
| `refund.warehouse_id` | `string` |  |
| `refund.warehouse` | `object` |  |
| `refund.warehouse._id` | `string` |  |
| `refund.warehouse.name` | `string` |  |
| `refund.customer_id` | `string` |  |
| `refund.customer` | `object` |  |
| `refund.customer._id` | `string` |  |
| `refund.customer.name` | `string` |  |
| `refund.customer.type` | `string` |  |
| `refund.customer.phone_number` | `string` |  |
| `refund.customer.inn` | `string` |  |
| `refund.customer.address` | `string` |  |
| `refund.customer.description` | `string` |  |
| `refund.customer.delivery_address` | `object` |  |
| `refund.customer_assistant` | `object` |  |
| `refund.customer_assistant._id` | `string` |  |
| `refund.customer_assistant.name` | `string` |  |
| `refund.customer_assistant.type` | `string` |  |
| `refund.customer_assistant_hierarchy` | `string` |  |
| `refund.responsible_id` | `string` |  |
| `refund.note` | `string` |  |
| `refund.responsible` | `object` |  |
| `refund.responsible._id` | `string` |  |
| `refund.responsible.full_name` | `string` |  |
| `refund.responsible.phone_number` | `string` |  |
| `refund.created_by` | `object` |  |
| `refund.created_by._id` | `string` |  |
| `refund.created_by.full_name` | `string` |  |
| `refund.state` | `string` |  |
| `refund.dynamic_state` | `string` |  |
| `refund.is_refund` | `boolean` |  |
| `refund.is_trash` | `boolean` |  |
| `refund.refund_id` | `string` |  |
| `refund.number` | `string` |  |
| `refund.device` | `object` |  |
| `refund.device._id` | `string` |  |
| `refund.device.name` | `string` |  |
| `refund.device.device_id` | `string` |  |
| `refund.currency` | `object` |  |
| `refund.currency_id` | `string` |  |
| `refund.additional_costs` | `object[]` |  |
| `refund.additional_costs[].cost_id` | `string` |  |
| `refund.additional_costs[].payment_type_id` | `string` |  |
| `refund.additional_costs[].payment_type` | `object` |  |
| `refund.additional_costs[].amount` | `number` |  |
| `refund.additional_costs[].employee` | `object` |  |
| `refund.additional_costs[].supplier` | `object` |  |
| `refund.additional_costs[].customer` | `object` |  |
| `refund.additional_costs[].person` | `object` |  |
| `refund.additional_costs[].cost` | `object` |  |
| `refund.additional_costs[].price_id` | `string` |  |
| `refund.additional_costs[].employee_assistant_id` | `string` |  |
| `refund.additional_costs[].employee_assistant_hierarchy` | `object[]` |  |
| `refund.additional_costs[].supplier_assistant_id` | `string` |  |
| `refund.additional_costs[].supplier_assistant_hierarchy` | `object[]` |  |
| `refund.additional_costs[].customer_assistant_id` | `string` |  |
| `refund.additional_costs[].customer_assistant_hierarchy` | `object[]` |  |
| `refund.additional_costs[].person_assistant_id` | `string` |  |
| `refund.additional_costs[].person_assistant_hierarchy` | `object[]` |  |
| `refund.additional_costs[].is_method_summary_zero` | `boolean` |  |
| `refund.additional_costs[].item_count` | `number` |  |
| `refund.total_extra_cost` | `number` |  |
| `refund.total_effected_extra_cost` | `number` |  |
| `refund.currency_values` | `object` |  |
| `refund.currency_values.to_currency_id` | `string` |  |
| `refund.currency_values.numerator` | `number` |  |
| `refund.currency_values.denominator` | `number` |  |
| `refund.price_id` | `number` |  |
| `refund.price` | `object` |  |
| `refund.price._id` | `string` |  |
| `refund.price.name` | `string` |  |
| `refund.price.short_name` | `string` |  |
| `refund.price.code` | `string` |  |
| `refund.invoice` | `object` |  |
| `refund.invoice._id` | `string` |  |
| `refund.invoice.to_be_paid` | `number` |  |
| `refund.invoice.paid` | `number` |  |
| `refund.invoice.paid_by_balance` | `number` |  |
| `refund.invoice.paid_by_cashback` | `number` |  |
| `refund.invoice.to_be_refunded` | `number` |  |
| `refund.invoice.refunded` | `number` |  |
| `refund.invoice.number` | `string` |  |
| `refund.invoice.paid_state` | `string` |  |
| `refund.invoice.installment_plan_interval` | `string` |  |
| `refund.invoice.period` | `number` |  |
| `refund.invoice.trade_id` | `string` |  |
| `refund.invoice.items` | `object` |  |
| `refund.invoice.currency_id` | `string` |  |
| `refund.invoice.payment_type_id` | `string` |  |
| `refund.invoice.is_refund` | `boolean` |  |
| `refund.invoice.type` | `string` |  |
| `refund.invoice.payment_type` | `object` |  |
| `refund.payments` | `object` |  |
| `refund.payments.payment_method` | `object` |  |
| `refund.payments.amount` | `number` |  |
| `refund.payments.paid` | `number` |  |
| `refund.payments.currency` | `object` |  |
| `refund.payments.base_currency` | `object` |  |
| `refund.payments.base_currency_value` | `number` |  |
| `refund.applied_cashbacks` | `object[]` |  |
| `refund.applied_cashbacks[]._id` | `string` |  |
| `refund.applied_cashbacks[].amount` | `number` |  |
| `refund.applied_cashbacks[].currency` | `object` |  |
| `refund.applied_cashbacks[].paid` | `number` |  |
| `refund.applied_cashbacks[].base_currency` | `object` |  |
| `refund.applied_cashbacks[].installment_plan_changes` | `object[]` |  |
| `refund.earned_cashback` | `object` |  |
| `refund.earned_cashback._id` | `string` |  |
| `refund.earned_cashback.amount` | `number` |  |
| `refund.earned_cashback.currency` | `object` |  |
| `refund.earned_cashback.base_currency` | `object` |  |
| `refund.changes` | `object[]` |  |
| `refund.changes[].payment_method` | `object` |  |
| `refund.changes[].amount` | `number` |  |
| `refund.changes[].paid` | `number` |  |
| `refund.changes[].currency` | `object` |  |
| `refund.changes[].base_currency` | `object` |  |
| `refund.changes[].base_currency_value` | `number` |  |
| `refund.total_amount` | `number` |  |
| `refund.total_refunded_amount` | `number` |  |
| `refund.total_to_pay` | `number` |  |
| `refund.total_to_refund` | `number` |  |
| `refund.debt` | `number` |  |
| `refund.total_price` | `number` |  |
| `refund.total_added_tax` | `number` |  |
| `refund.total_included_tax` | `number` |  |
| `refund.discount` | `number` |  |
| `refund.total_discount` | `number` |  |
| `refund.discounts` | `object[]` |  |
| `refund.discounts[].is_custom` | `boolean` | По умолчанию: `false` |
| `refund.discounts[]._id` | `string` |  |
| `refund.discounts[].name` | `string` |  |
| `refund.discounts[].value` | `number` |  |
| `refund.discounts[].apply_type` | `string` | Допустимые значения: `percent`, `cash` |
| `refund.discounts[].currency_id` | `string` |  |
| `refund.discounts[].value_in_percent` | `number` | По умолчанию: `0` |
| `refund.change` | `number` |  |
| `refund.delivery_date` | `string` |  |
| `refund.sold_at` | `string` |  |
| `refund.is_report_saved` | `boolean` |  |
| `refund.products` | `object` |  |
| `refund.installment_plan` | `object` |  |
| `refund.installment_plan.date` | `string` |  |
| `refund.installment_plan.amount` | `number` |  |
| `refund.is_installment_plan` | `boolean` |  |
| `refund.reason` | `object` |  |
| `refund.reason._id` | `string` |  |
| `refund.reason.name` | `string` |  |
| `refund.reason.description` | `string` |  |
| `refund.contract_id` | `string` |  |
| `refund.by_balance` | `object[]` |  |
| `refund.by_balance[]._id` | `string` |  |
| `refund.by_balance[].amount` | `number` |  |
| `refund.by_balance[].paid` | `number` |  |
| `refund.by_balance[].currency` | `object` |  |
| `refund.by_balance[].base_currency` | `object` |  |
| `refund.by_balance[].installment_plan_changes` | `object[]` |  |
| `refund.calc_tax_after_discount` | `boolean` |  |
| `refund.calc_sale_discount_after_product` | `boolean` |  |
| `refund.contract` | `object` |  |
| `refund.contract._id` | `string` |  |
| `refund.contract.created_at` | `string` |  |
| `refund.contract.code` | `string` |  |
| `refund.contract.name` | `string` |  |
| `refund.contract.number` | `string` |  |
| `refund.contract.currency_id` | `string` |  |
| `refund.contract.organization_id` | `string` |  |
| `refund.contract.amount` | `number` |  |
| `refund.contract.date` | `string` |  |
| `refund.contract.expire_date` | `string` |  |
| `refund.contract.person_id` | `string` |  |
| `refund.contract.note` | `string` |  |
| `refund.contract.is_active` | `boolean` |  |
| `refund.contract.contract_number` | `number` |  |
| `refund.customer_before_balance` | `object[]` |  |
| `refund.customer_before_balance[]._id` | `string` |  |
| `refund.customer_before_balance[].currency_id` | `string` |  |
| `refund.customer_before_balance[].amount` | `number` |  |
| `refund.customer_before_balance[].organization_id` | `string` |  |
| `refund.customer_before_balance[].payment_method_id` | `string` |  |
| `refund.cashback_before_balance` | `object[]` |  |
| `refund.cashback_before_balance[]._id` | `string` |  |
| `refund.cashback_before_balance[].customer_id` | `string` |  |
| `refund.cashback_before_balance[].person_id` | `string` |  |
| `refund.cashback_before_balance[].currency_id` | `string` |  |
| `refund.cashback_before_balance[].amount` | `number` |  |
| `refund.customer_after_balance` | `object[]` |  |
| `refund.customer_after_balance[]._id` | `string` |  |
| `refund.customer_after_balance[].currency_id` | `string` |  |
| `refund.customer_after_balance[].amount` | `number` |  |
| `refund.customer_after_balance[].organization_id` | `string` |  |
| `refund.customer_after_balance[].payment_method_id` | `string` |  |
| `refund.cashback_after_balance` | `object[]` |  |
| `refund.cashback_after_balance[]._id` | `string` |  |
| `refund.cashback_after_balance[].customer_id` | `string` |  |
| `refund.cashback_after_balance[].person_id` | `string` |  |
| `refund.cashback_after_balance[].currency_id` | `string` |  |
| `refund.cashback_after_balance[].amount` | `number` |  |
| `refund.delivery_address` | `object` |  |
| `refund.delivery_address.lat` | `number` |  |
| `refund.delivery_address.long` | `number` |  |
| `refund.delivery_address.human_address` | `object` |  |
| `refund.order_id` | `string` |  |
| `refund.order` | `object` |  |
| `refund.order._id` | `string` |  |
| `refund.order.number` | `string` |  |
| `refund.order.code` | `string` |  |
| `refund.delivery_order` | `object` |  |
| `refund.delivery_order._id` | `string` |  |
| `refund.delivery_order.number` | `string` |  |
| `refund.delivery_order.code` | `string` |  |
| `refund.delivery_order.state` | `string` |  |
| `refunds` | `object[]` |  |
| `refunds[].created_at` | `string` |  |
| `refunds[].updated_at` | `string` |  |
| `refunds[].code` | `string` |  |
| `refunds[].uuid` | `string` |  |
| `refunds[].open_ticket_uuid` | `string` |  |
| `refunds[].organization_id` | `string` |  |
| `refunds[].organization` | `object` |  |
| `refunds[].organization._id` | `string` |  |
| `refunds[].organization.name` | `string` |  |
| `refunds[].warehouse_id` | `string` |  |
| `refunds[].warehouse` | `object` |  |
| `refunds[].warehouse._id` | `string` |  |
| `refunds[].warehouse.name` | `string` |  |
| `refunds[].customer_id` | `string` |  |
| `refunds[].customer` | `object` |  |
| `refunds[].customer._id` | `string` |  |
| `refunds[].customer.name` | `string` |  |
| `refunds[].customer.type` | `string` |  |
| `refunds[].customer.phone_number` | `string` |  |
| `refunds[].customer.inn` | `string` |  |
| `refunds[].customer.address` | `string` |  |
| `refunds[].customer.description` | `string` |  |
| `refunds[].customer.delivery_address` | `object` |  |
| `refunds[].customer_assistant` | `object` |  |
| `refunds[].customer_assistant._id` | `string` |  |
| `refunds[].customer_assistant.name` | `string` |  |
| `refunds[].customer_assistant.type` | `string` |  |
| `refunds[].customer_assistant_hierarchy` | `string` |  |
| `refunds[].responsible_id` | `string` |  |
| `refunds[].note` | `string` |  |
| `refunds[].responsible` | `object` |  |
| `refunds[].responsible._id` | `string` |  |
| `refunds[].responsible.full_name` | `string` |  |
| `refunds[].responsible.phone_number` | `string` |  |
| `refunds[].created_by` | `object` |  |
| `refunds[].created_by._id` | `string` |  |
| `refunds[].created_by.full_name` | `string` |  |
| `refunds[].state` | `string` |  |
| `refunds[].dynamic_state` | `string` |  |
| `refunds[].is_refund` | `boolean` |  |
| `refunds[].is_trash` | `boolean` |  |
| `refunds[].refund_id` | `string` |  |
| `refunds[].number` | `string` |  |
| `refunds[].device` | `object` |  |
| `refunds[].device._id` | `string` |  |
| `refunds[].device.name` | `string` |  |
| `refunds[].device.device_id` | `string` |  |
| `refunds[].currency` | `object` |  |
| `refunds[].currency_id` | `string` |  |
| `refunds[].additional_costs` | `object[]` |  |
| `refunds[].additional_costs[].cost_id` | `string` |  |
| `refunds[].additional_costs[].payment_type_id` | `string` |  |
| `refunds[].additional_costs[].payment_type` | `object` |  |
| `refunds[].additional_costs[].amount` | `number` |  |
| `refunds[].additional_costs[].employee` | `object` |  |
| `refunds[].additional_costs[].supplier` | `object` |  |
| `refunds[].additional_costs[].customer` | `object` |  |
| `refunds[].additional_costs[].person` | `object` |  |
| `refunds[].additional_costs[].cost` | `object` |  |
| `refunds[].additional_costs[].price_id` | `string` |  |
| `refunds[].additional_costs[].employee_assistant_id` | `string` |  |
| `refunds[].additional_costs[].employee_assistant_hierarchy` | `object[]` |  |
| `refunds[].additional_costs[].supplier_assistant_id` | `string` |  |
| `refunds[].additional_costs[].supplier_assistant_hierarchy` | `object[]` |  |
| `refunds[].additional_costs[].customer_assistant_id` | `string` |  |
| `refunds[].additional_costs[].customer_assistant_hierarchy` | `object[]` |  |
| `refunds[].additional_costs[].person_assistant_id` | `string` |  |
| `refunds[].additional_costs[].person_assistant_hierarchy` | `object[]` |  |
| `refunds[].additional_costs[].is_method_summary_zero` | `boolean` |  |
| `refunds[].additional_costs[].item_count` | `number` |  |
| `refunds[].total_extra_cost` | `number` |  |
| `refunds[].total_effected_extra_cost` | `number` |  |
| `refunds[].currency_values` | `object` |  |
| `refunds[].currency_values.to_currency_id` | `string` |  |
| `refunds[].currency_values.numerator` | `number` |  |
| `refunds[].currency_values.denominator` | `number` |  |
| `refunds[].price_id` | `number` |  |
| `refunds[].price` | `object` |  |
| `refunds[].price._id` | `string` |  |
| `refunds[].price.name` | `string` |  |
| `refunds[].price.short_name` | `string` |  |
| `refunds[].price.code` | `string` |  |
| `refunds[].invoice` | `object` |  |
| `refunds[].invoice._id` | `string` |  |
| `refunds[].invoice.to_be_paid` | `number` |  |
| `refunds[].invoice.paid` | `number` |  |
| `refunds[].invoice.paid_by_balance` | `number` |  |
| `refunds[].invoice.paid_by_cashback` | `number` |  |
| `refunds[].invoice.to_be_refunded` | `number` |  |
| `refunds[].invoice.refunded` | `number` |  |
| `refunds[].invoice.number` | `string` |  |
| `refunds[].invoice.paid_state` | `string` |  |
| `refunds[].invoice.installment_plan_interval` | `string` |  |
| `refunds[].invoice.period` | `number` |  |
| `refunds[].invoice.trade_id` | `string` |  |
| `refunds[].invoice.items` | `object` |  |
| `refunds[].invoice.currency_id` | `string` |  |
| `refunds[].invoice.payment_type_id` | `string` |  |
| `refunds[].invoice.is_refund` | `boolean` |  |
| `refunds[].invoice.type` | `string` |  |
| `refunds[].invoice.payment_type` | `object` |  |
| `refunds[].payments` | `object` |  |
| `refunds[].payments.payment_method` | `object` |  |
| `refunds[].payments.amount` | `number` |  |
| `refunds[].payments.paid` | `number` |  |
| `refunds[].payments.currency` | `object` |  |
| `refunds[].payments.base_currency` | `object` |  |
| `refunds[].payments.base_currency_value` | `number` |  |
| `refunds[].applied_cashbacks` | `object[]` |  |
| `refunds[].applied_cashbacks[]._id` | `string` |  |
| `refunds[].applied_cashbacks[].amount` | `number` |  |
| `refunds[].applied_cashbacks[].currency` | `object` |  |
| `refunds[].applied_cashbacks[].paid` | `number` |  |
| `refunds[].applied_cashbacks[].base_currency` | `object` |  |
| `refunds[].applied_cashbacks[].installment_plan_changes` | `object[]` |  |
| `refunds[].earned_cashback` | `object` |  |
| `refunds[].earned_cashback._id` | `string` |  |
| `refunds[].earned_cashback.amount` | `number` |  |
| `refunds[].earned_cashback.currency` | `object` |  |
| `refunds[].earned_cashback.base_currency` | `object` |  |
| `refunds[].changes` | `object[]` |  |
| `refunds[].changes[].payment_method` | `object` |  |
| `refunds[].changes[].amount` | `number` |  |
| `refunds[].changes[].paid` | `number` |  |
| `refunds[].changes[].currency` | `object` |  |
| `refunds[].changes[].base_currency` | `object` |  |
| `refunds[].changes[].base_currency_value` | `number` |  |
| `refunds[].total_amount` | `number` |  |
| `refunds[].total_refunded_amount` | `number` |  |
| `refunds[].total_to_pay` | `number` |  |
| `refunds[].total_to_refund` | `number` |  |
| `refunds[].debt` | `number` |  |
| `refunds[].total_price` | `number` |  |
| `refunds[].total_added_tax` | `number` |  |
| `refunds[].total_included_tax` | `number` |  |
| `refunds[].discount` | `number` |  |
| `refunds[].total_discount` | `number` |  |
| `refunds[].discounts` | `object[]` |  |
| `refunds[].discounts[].is_custom` | `boolean` | По умолчанию: `false` |
| `refunds[].discounts[]._id` | `string` |  |
| `refunds[].discounts[].name` | `string` |  |
| `refunds[].discounts[].value` | `number` |  |
| `refunds[].discounts[].apply_type` | `string` | Допустимые значения: `percent`, `cash` |
| `refunds[].discounts[].currency_id` | `string` |  |
| `refunds[].discounts[].value_in_percent` | `number` | По умолчанию: `0` |
| `refunds[].change` | `number` |  |
| `refunds[].delivery_date` | `string` |  |
| `refunds[].sold_at` | `string` |  |
| `refunds[].is_report_saved` | `boolean` |  |
| `refunds[].products` | `object` |  |
| `refunds[].installment_plan` | `object` |  |
| `refunds[].installment_plan.date` | `string` |  |
| `refunds[].installment_plan.amount` | `number` |  |
| `refunds[].is_installment_plan` | `boolean` |  |
| `refunds[].reason` | `object` |  |
| `refunds[].reason._id` | `string` |  |
| `refunds[].reason.name` | `string` |  |
| `refunds[].reason.description` | `string` |  |
| `refunds[].contract_id` | `string` |  |
| `refunds[].by_balance` | `object[]` |  |
| `refunds[].by_balance[]._id` | `string` |  |
| `refunds[].by_balance[].amount` | `number` |  |
| `refunds[].by_balance[].paid` | `number` |  |
| `refunds[].by_balance[].currency` | `object` |  |
| `refunds[].by_balance[].base_currency` | `object` |  |
| `refunds[].by_balance[].installment_plan_changes` | `object[]` |  |
| `refunds[].calc_tax_after_discount` | `boolean` |  |
| `refunds[].calc_sale_discount_after_product` | `boolean` |  |
| `refunds[].contract` | `object` |  |
| `refunds[].contract._id` | `string` |  |
| `refunds[].contract.created_at` | `string` |  |
| `refunds[].contract.code` | `string` |  |
| `refunds[].contract.name` | `string` |  |
| `refunds[].contract.number` | `string` |  |
| `refunds[].contract.currency_id` | `string` |  |
| `refunds[].contract.organization_id` | `string` |  |
| `refunds[].contract.amount` | `number` |  |
| `refunds[].contract.date` | `string` |  |
| `refunds[].contract.expire_date` | `string` |  |
| `refunds[].contract.person_id` | `string` |  |
| `refunds[].contract.note` | `string` |  |
| `refunds[].contract.is_active` | `boolean` |  |
| `refunds[].contract.contract_number` | `number` |  |
| `refunds[].customer_before_balance` | `object[]` |  |
| `refunds[].customer_before_balance[]._id` | `string` |  |
| `refunds[].customer_before_balance[].currency_id` | `string` |  |
| `refunds[].customer_before_balance[].amount` | `number` |  |
| `refunds[].customer_before_balance[].organization_id` | `string` |  |
| `refunds[].customer_before_balance[].payment_method_id` | `string` |  |
| `refunds[].cashback_before_balance` | `object[]` |  |
| `refunds[].cashback_before_balance[]._id` | `string` |  |
| `refunds[].cashback_before_balance[].customer_id` | `string` |  |
| `refunds[].cashback_before_balance[].person_id` | `string` |  |
| `refunds[].cashback_before_balance[].currency_id` | `string` |  |
| `refunds[].cashback_before_balance[].amount` | `number` |  |
| `refunds[].customer_after_balance` | `object[]` |  |
| `refunds[].customer_after_balance[]._id` | `string` |  |
| `refunds[].customer_after_balance[].currency_id` | `string` |  |
| `refunds[].customer_after_balance[].amount` | `number` |  |
| `refunds[].customer_after_balance[].organization_id` | `string` |  |
| `refunds[].customer_after_balance[].payment_method_id` | `string` |  |
| `refunds[].cashback_after_balance` | `object[]` |  |
| `refunds[].cashback_after_balance[]._id` | `string` |  |
| `refunds[].cashback_after_balance[].customer_id` | `string` |  |
| `refunds[].cashback_after_balance[].person_id` | `string` |  |
| `refunds[].cashback_after_balance[].currency_id` | `string` |  |
| `refunds[].cashback_after_balance[].amount` | `number` |  |
| `refunds[].delivery_address` | `object` |  |
| `refunds[].delivery_address.lat` | `number` |  |
| `refunds[].delivery_address.long` | `number` |  |
| `refunds[].delivery_address.human_address` | `object` |  |
| `refunds[].order_id` | `string` |  |
| `refunds[].order` | `object` |  |
| `refunds[].order._id` | `string` |  |
| `refunds[].order.number` | `string` |  |
| `refunds[].order.code` | `string` |  |
| `refunds[].delivery_order` | `object` |  |
| `refunds[].delivery_order._id` | `string` |  |
| `refunds[].delivery_order.number` | `string` |  |
| `refunds[].delivery_order.code` | `string` |  |
| `refunds[].delivery_order.state` | `string` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "created_at": "string",
    "updated_at": "string",
    "code": "string",
    "uuid": "string",
    "open_ticket_uuid": "string",
    "organization_id": "string",
    "organization": {
      "_id": "string",
      "name": "string"
    },
    "warehouse_id": "string",
    "warehouse": {
      "_id": "string",
      "name": "string"
    },
    "customer_id": "string",
    "customer": {
      "_id": "string",
      "name": "string",
      "type": "string",
      "phone_number": "string",
      "inn": "string",
      "address": "string",
      "description": "string",
      "delivery_address": {
        "lat": 0,
        "long": 0,
        "human_address": {
          "address": null,
          "city": null,
          "state": null,
          "zip": null
        }
      }
    },
    "customer_assistant": {
      "_id": "string",
      "name": "string",
      "type": "string"
    },
    "customer_assistant_hierarchy": "string",
    "responsible_id": "string",
    "note": "string",
    "responsible": {
      "_id": "string",
      "full_name": "string",
      "phone_number": "string"
    },
    "created_by": {
      "_id": "string",
      "full_name": "string"
    },
    "state": "string",
    "dynamic_state": "string",
    "is_refund": false,
    "is_trash": false,
    "refund_id": "string",
    "number": "string",
    "device": {
      "_id": "string",
      "name": "string",
      "device_id": "string"
    },
    "currency": {},
    "currency_id": "string",
    "additional_costs": [
      {
        "cost_id": "string",
        "payment_type_id": "string",
        "payment_type": {},
        "amount": 0,
        "employee": {},
        "supplier": {},
        "customer": {},
        "person": {},
        "cost": {},
        "price_id": "string",
        "employee_assistant_id": "string",
        "employee_assistant_hierarchy": [],
        "supplier_assistant_id": "string",
        "supplier_assistant_hierarchy": [],
        "customer_assistant_id": "string",
        "customer_assistant_hierarchy": [],
        "person_assistant_id": "string",
        "person_assistant_hierarchy": [],
        "is_method_summary_zero": false,
        "item_count": 0
      }
    ],
    "total_extra_cost": 0,
    "total_effected_extra_cost": 0,
    "currency_values": {
      "to_currency_id": "string",
      "numerator": 0,
      "denominator": 0
    },
    "price_id": 0,
    "price": {
      "_id": "string",
      "name": "string",
      "short_name": "string",
      "code": "string"
    },
    "invoice": {
      "_id": "string",
      "to_be_paid": 0,
      "paid": 0,
      "paid_by_balance": 0,
      "paid_by_cashback": 0,
      "to_be_refunded": 0,
      "refunded": 0,
      "number": "string",
      "paid_state": "string",
      "installment_plan_interval": "string",
      "period": 0,
      "trade_id": "string",
      "items": {
        "_id": "string",
        "to_be_paid": 0,
        "paid": 0,
        "paid_by_balance": 0,
        "paid_by_cashback": 0,
        "to_be_refunded": 0,
        "refunded": 0,
        "is_initial_payment": false,
        "number": "string",
        "paid_state": "string",
        "date": "string"
      },
      "currency_id": "string",
      "payment_type_id": "string",
      "is_refund": false,
      "type": "string",
      "payment_type": {
        "_id": "string",
        "name": "string"
      }
    },
    "payments": {
      "payment_method": {
        "_id": "string",
        "type": "string",
        "name": "string"
      },
      "amount": 0,
      "paid": 0,
      "currency": {
        "_id": "string",
        "uuid": 0,
        "name": "string",
        "value": 0,
        "symbol": "string",
        "side": "string"
      },
      "base_currency": {
        "numerator": 0,
        "denominator": 0
      },
      "base_currency_value": 0
    },
    "applied_cashbacks": [
      {
        "_id": "string",
        "amount": 0,
        "currency": {
          "_id": null,
          "to_currency_id": null,
          "uuid": null,
          "name": null,
          "value": null,
          "symbol": null,
          "side": null,
          "numerator": null,
          "denominator": null,
          "round_type": null,
          "precision": null
        },
        "paid": 0,
        "base_currency": {
          "numerator": null,
          "denominator": null
        },
        "installment_plan_changes": []
      }
    ],
    "earned_cashback": {
      "_id": "string",
      "amount": 0,
      "currency": {
        "_id": "string",
        "to_currency_id": "string",
        "uuid": 0,
        "name": "string",
        "value": 0,
        "symbol": "string",
        "side": "string",
        "numerator": 0,
        "denominator": 0,
        "round_type": "string",
        "precision": 0
      },
      "base_currency": {
        "numerator": 0,
        "denominator": 0
      }
    },
    "changes": [
      {
        "payment_method": {
          "_id": null,
          "type": null,
          "name": null
        },
        "amount": 0,
        "paid": 0,
        "currency": {
          "_id": null,
          "to_currency_id": null,
          "uuid": null,
          "name": null,
          "value": null,
          "symbol": null,
          "side": null,
          "numerator": null,
          "denominator": null,
          "round_type": null,
          "precision": null
        },
        "base_currency": {
          "numerator": null,
          "denominator": null
        },
        "base_currency_value": 0
      }
    ],
    "total_amount": 0,
    "total_refunded_amount": 0,
    "total_to_pay": 0,
    "total_to_refund": 0,
    "debt": 0,
    "total_price": 0,
    "total_added_tax": 0,
    "total_included_tax": 0,
    "discount": 0,
    "total_discount": 0,
    "discounts": [
      {
        "is_custom": false,
        "_id": "string",
        "name": "string",
        "value": 0,
        "apply_type": "percent",
        "currency_id": "string",
        "value_in_percent": 0
      }
    ],
    "change": 0,
    "delivery_date": "string",
    "sold_at": "string",
    "is_report_saved": false,
    "products": {},
    "installment_plan": {
      "date": "string",
      "amount": 0
    },
    "is_installment_plan": false,
    "reason": {
      "_id": "string",
      "name": "string",
      "description": "string"
    },
    "contract_id": "string",
    "by_balance": [
      {
        "_id": "string",
        "amount": 0,
        "paid": 0,
        "currency": {
          "_id": null,
          "to_currency_id": null,
          "uuid": null,
          "name": null,
          "value": null,
          "symbol": null,
          "side": null,
          "numerator": null,
          "denominator": null,
          "round_type": null,
          "precision": null
        },
        "base_currency": {
          "numerator": null,
          "denominator": null
        },
        "installment_plan_changes": []
      }
    ],
    "calc_tax_after_discount": false,
    "calc_sale_discount_after_product": false,
    "contract": {
      "_id": "string",
      "created_at": "string",
      "code": "string",
      "name": "string",
      "number": "string",
      "currency_id": "string",
      "organization_id": "string",
      "amount": 0,
      "date": "string",
      "expire_date": "string",
      "person_id": "string",
      "note": "string",
      "is_active": false,
      "contract_number": 0
    },
    "customer_before_balance": [
      {
        "_id": "string",
        "currency_id": "string",
        "amount": 0,
        "organization_id": "string",
        "payment_method_id": "string"
      }
    ],
    "cashback_before_balance": [
      {
        "_id": "string",
        "customer_id": "string",
        "person_id": "string",
        "currency_id": "string",
        "amount": 0
      }
    ],
    "customer_after_balance": [
      {
        "_id": "string",
        "currency_id": "string",
        "amount": 0,
        "organization_id": "string",
        "payment_method_id": "string"
      }
    ],
    "cashback_after_balance": [
      {
        "_id": "string",
        "customer_id": "string",
        "person_id": "string",
        "currency_id": "string",
        "amount": 0
      }
    ],
    "delivery_address": {
      "lat": 0,
      "long": 0,
      "human_address": {
        "address": "string",
        "city": "string",
        "state": "string",
        "zip": "string"
      }
    },
    "order_id": "string",
    "order": {
      "_id": "string",
      "number": "string",
      "code": "string"
    },
    "delivery_order": {
      "_id": "string",
      "number": "string",
      "code": "string",
      "state": "string"
    },
    "refund": {
      "created_at": "string",
      "updated_at": "string",
      "code": "string",
      "uuid": "string",
      "open_ticket_uuid": "string",
      "organization_id": "string",
      "organization": {
        "_id": "string",
        "name": "string"
      },
      "warehouse_id": "string",
      "warehouse": {
        "_id": "string",
        "name": "string"
      },
      "customer_id": "string",
      "customer": {
        "_id": "string",
        "name": "string",
        "type": "string",
        "phone_number": "string",
        "inn": "string",
        "address": "string",
        "description": "string",
        "delivery_address": {
          "lat": null,
          "long": null,
          "human_address": null
        }
      },
      "customer_assistant": {
        "_id": "string",
        "name": "string",
        "type": "string"
      },
      "customer_assistant_hierarchy": "string",
      "responsible_id": "string",
      "note": "string",
      "responsible": {
        "_id": "string",
        "full_name": "string",
        "phone_number": "string"
      },
      "created_by": {
        "_id": "string",
        "full_name": "string"
      },
      "state": "string",
      "dynamic_state": "string",
      "is_refund": false,
      "is_trash": false,
      "refund_id": "string",
      "number": "string",
      "device": {
        "_id": "string",
        "name": "string",
        "device_id": "string"
      },
      "currency": {},
      "currency_id": "string",
      "additional_costs": [
        {
          "cost_id": null,
          "payment_type_id": null,
          "payment_type": null,
          "amount": null,
          "employee": null,
          "supplier": null,
          "customer": null,
          "person": null,
          "cost": null,
          "price_id": null,
          "employee_assistant_id": null,
          "employee_assistant_hierarchy": null,
          "supplier_assistant_id": null,
          "supplier_assistant_hierarchy": null,
          "customer_assistant_id": null,
          "customer_assistant_hierarchy": null,
          "person_assistant_id": null,
          "person_assistant_hierarchy": null,
          "is_method_summary_zero": null,
          "item_count": null
        }
      ],
      "total_extra_cost": 0,
      "total_effected_extra_cost": 0,
      "currency_values": {
        "to_currency_id": "string",
        "numerator": 0,
        "denominator": 0
      },
      "price_id": 0,
      "price": {
        "_id": "string",
        "name": "string",
        "short_name": "string",
        "code": "string"
      },
      "invoice": {
        "_id": "string",
        "to_be_paid": 0,
        "paid": 0,
        "paid_by_balance": 0,
        "paid_by_cashback": 0,
        "to_be_refunded": 0,
        "refunded": 0,
        "number": "string",
        "paid_state": "string",
        "installment_plan_interval": "string",
        "period": 0,
        "trade_id": "string",
        "items": {
          "_id": null,
          "to_be_paid": null,
          "paid": null,
          "paid_by_balance": null,
          "paid_by_cashback": null,
          "to_be_refunded": null,
          "refunded": null,
          "is_initial_payment": null,
          "number": null,
          "paid_state": null,
          "date": null
        },
        "currency_id": "string",
        "payment_type_id": "string",
        "is_refund": false,
        "type": "string",
        "payment_type": {
          "_id": null,
          "name": null
        }
      },
      "payments": {
        "payment_method": {
          "_id": null,
          "type": null,
          "name": null
        },
        "amount": 0,
        "paid": 0,
        "currency": {
          "_id": null,
          "uuid": null,
          "name": null,
          "value": null,
          "symbol": null,
          "side": null
        },
        "base_currency": {
          "numerator": null,
          "denominator": null
        },
        "base_currency_value": 0
      },
      "applied_cashbacks": [
        {
          "_id": null,
          "amount": null,
          "currency": null,
          "paid": null,
          "base_currency": null,
          "installment_plan_changes": null
        }
      ],
      "earned_cashback": {
        "_id": "string",
        "amount": 0,
        "currency": {
          "_id": null,
          "to_currency_id": null,
          "uuid": null,
          "name": null,
          "value": null,
          "symbol": null,
          "side": null,
          "numerator": null,
          "denominator": null,
          "round_type": null,
          "precision": null
        },
        "base_currency": {
          "numerator": null,
          "denominator": null
        }
      },
      "changes": [
        {
          "payment_method": null,
          "amount": null,
          "paid": null,
          "currency": null,
          "base_currency": null,
          "base_currency_value": null
        }
      ],
      "total_amount": 0,
      "total_refunded_amount": 0,
      "total_to_pay": 0,
      "total_to_refund": 0,
      "debt": 0,
      "total_price": 0,
      "total_added_tax": 0,
      "total_included_tax": 0,
      "discount": 0,
      "total_discount": 0,
      "discounts": [
        {
          "is_custom": null,
          "_id": null,
          "name": null,
          "value": null,
          "apply_type": null,
          "currency_id": null,
          "value_in_percent": null
        }
      ],
      "change": 0,
      "delivery_date": "string",
      "sold_at": "string",
      "is_report_saved": false,
      "products": {},
      "installment_plan": {
        "date": "string",
        "amount": 0
      },
      "is_installment_plan": false,
      "reason": {
        "_id": "string",
        "name": "string",
        "description": "string"
      },
      "contract_id": "string",
      "by_balance": [
        {
          "_id": null,
          "amount": null,
          "paid": null,
          "currency": null,
          "base_currency": null,
          "installment_plan_changes": null
        }
      ],
      "calc_tax_after_discount": false,
      "calc_sale_discount_after_product": false,
      "contract": {
        "_id": "string",
        "created_at": "string",
        "code": "string",
        "name": "string",
        "number": "string",
        "currency_id": "string",
        "organization_id": "string",
        "amount": 0,
        "date": "string",
        "expire_date": "string",
        "person_id": "string",
        "note": "string",
        "is_active": false,
        "contract_number": 0
      },
      "customer_before_balance": [
        {
          "_id": null,
          "currency_id": null,
          "amount": null,
          "organization_id": null,
          "payment_method_id": null
        }
      ],
      "cashback_before_balance": [
        {
          "_id": null,
          "customer_id": null,
          "person_id": null,
          "currency_id": null,
          "amount": null
        }
      ],
      "customer_after_balance": [
        {
          "_id": null,
          "currency_id": null,
          "amount": null,
          "organization_id": null,
          "payment_method_id": null
        }
      ],
      "cashback_after_balance": [
        {
          "_id": null,
          "customer_id": null,
          "person_id": null,
          "currency_id": null,
          "amount": null
        }
      ],
      "delivery_address": {
        "lat": 0,
        "long": 0,
        "human_address": {
          "address": null,
          "city": null,
          "state": null,
          "zip": null
        }
      },
      "order_id": "string",
      "order": {
        "_id": "string",
        "number": "string",
        "code": "string"
      },
      "delivery_order": {
        "_id": "string",
        "number": "string",
        "code": "string",
        "state": "string"
      }
    },
    "refunds": [
      {
        "created_at": "string",
        "updated_at": "string",
        "code": "string",
        "uuid": "string",
        "open_ticket_uuid": "string",
        "organization_id": "string",
        "organization": {
          "_id": null,
          "name": null
        },
        "warehouse_id": "string",
        "warehouse": {
          "_id": null,
          "name": null
        },
        "customer_id": "string",
        "customer": {
          "_id": null,
          "name": null,
          "type": null,
          "phone_number": null,
          "inn": null,
          "address": null,
          "description": null,
          "delivery_address": null
        },
        "customer_assistant": {
          "_id": null,
          "name": null,
          "type": null
        },
        "customer_assistant_hierarchy": "string",
        "responsible_id": "string",
        "note": "string",
        "responsible": {
          "_id": null,
          "full_name": null,
          "phone_number": null
        },
        "created_by": {
          "_id": null,
          "full_name": null
        },
        "state": "string",
        "dynamic_state": "string",
        "is_refund": false,
        "is_trash": false,
        "refund_id": "string",
        "number": "string",
        "device": {
          "_id": null,
          "name": null,
          "device_id": null
        },
        "currency": {},
        "currency_id": "string",
        "additional_costs": [],
        "total_extra_cost": 0,
        "total_effected_extra_cost": 0,
        "currency_values": {
          "to_currency_id": null,
          "numerator": null,
          "denominator": null
        },
        "price_id": 0,
        "price": {
          "_id": null,
          "name": null,
          "short_name": null,
          "code": null
        },
        "invoice": {
          "_id": null,
          "to_be_paid": null,
          "paid": null,
          "paid_by_balance": null,
          "paid_by_cashback": null,
          "to_be_refunded": null,
          "refunded": null,
          "number": null,
          "paid_state": null,
          "installment_plan_interval": null,
          "period": null,
          "trade_id": null,
          "items": null,
          "currency_id": null,
          "payment_type_id": null,
          "is_refund": null,
          "type": null,
          "payment_type": null
        },
        "payments": {
          "payment_method": null,
          "amount": null,
          "paid": null,
          "currency": null,
          "base_currency": null,
          "base_currency_value": null
        },
        "applied_cashbacks": [],
        "earned_cashback": {
          "_id": null,
          "amount": null,
          "currency": null,
          "base_currency": null
        },
        "changes": [],
        "total_amount": 0,
        "total_refunded_amount": 0,
        "total_to_pay": 0,
        "total_to_refund": 0,
        "debt": 0,
        "total_price": 0,
        "total_added_tax": 0,
        "total_included_tax": 0,
        "discount": 0,
        "total_discount": 0,
        "discounts": [],
        "change": 0,
        "delivery_date": "string",
        "sold_at": "string",
        "is_report_saved": false,
        "products": {},
        "installment_plan": {
          "date": null,
          "amount": null
        },
        "is_installment_plan": false,
        "reason": {
          "_id": null,
          "name": null,
          "description": null
        },
        "contract_id": "string",
        "by_balance": [],
        "calc_tax_after_discount": false,
        "calc_sale_discount_after_product": false,
        "contract": {
          "_id": null,
          "created_at": null,
          "code": null,
          "name": null,
          "number": null,
          "currency_id": null,
          "organization_id": null,
          "amount": null,
          "date": null,
          "expire_date": null,
          "person_id": null,
          "note": null,
          "is_active": null,
          "contract_number": null
        },
        "customer_before_balance": [],
        "cashback_before_balance": [],
        "customer_after_balance": [],
        "cashback_after_balance": [],
        "delivery_address": {
          "lat": null,
          "long": null,
          "human_address": null
        },
        "order_id": "string",
        "order": {
          "_id": null,
          "number": null,
          "code": null
        },
        "delivery_order": {
          "_id": null,
          "number": null,
          "code": null,
          "state": null
        }
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /trade/get-by-id/{id}

Get trade using its _id

**Нужное разрешение:** `sale` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да |  |

**Тело запроса**

Тело запроса не требуется.

**Ответ**

Структура ответа совпадает с [POST /trade/create](#post-trade-create).

## POST /trade/get-paging

Get trades by paging

**Нужное разрешение:** `sale` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

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

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/get-paging', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 1,
    "limit": 20
  }),
})
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/trade/get-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 1,
        "limit": 20,
    },
)
print(res.json())
```

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

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/get-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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `page` | `number` | Да | По умолчанию: `1` |
| `limit` | `number` | Да | По умолчанию: `20` |
| `product_id` | `string` | Нет |  |
| `total_from` | `number` | Нет |  |
| `total_to` | `number` | Нет |  |
| `customer_id` | `string` | Нет |  |
| `currency_id` | `string` | Нет |  |
| `is_fully_refunded` | `boolean` | Нет |  |
| `responsible_id` | `string` | Нет |  |
| `states` | `string[]` | Нет |  |
| `state_id` | `string` | Нет |  |
| `is_refund` | `boolean` | Нет |  |
| `organization_id` | `string` | Нет |  |
| `search` | `string` | Нет |  |
| `type` | `string` | Нет | Допустимые значения: `b2b`, `b2c` |
| `contract_id` | `string` | Нет |  |
| `date_from` | `string (date-time)` | Нет | Sales sold at or after this time (filters sold_at). |
| `date_to` | `string (date-time)` | Нет | Sales sold at or before this time (filters sold_at). |
| `updated_at` | `string (date-time)` | Нет |  |
| `created_by` | `string` | Нет |  |

```json
{
  "page": 1,
  "limit": 20,
  "product_id": "64e24f4199a9a3c944444453",
  "total_from": 100,
  "total_to": 200,
  "customer_id": "64e24f4199a9a3c944444458",
  "currency_id": "64e24f4199a9a3c944444453",
  "is_fully_refunded": false,
  "responsible_id": "64e24f4199a9a3c944444451",
  "states": [
    "new"
  ],
  "state_id": "64e24f4199a9a3c944444450",
  "is_refund": false,
  "organization_id": "64e24f4199a9a3c944444445",
  "search": "search string",
  "type": "trade",
  "contract_id": "64e24f4199a9a3c944444461",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "updated_at": "2023-10-01T12:00:00Z",
  "created_by": "64e24f4199a9a3c944444451"
}
```

**Ответ**

`data.total` — общее количество записей, `data.data[]` — записи текущей страницы. Таблица ниже описывает одну запись.

| Поле | Тип | Описание |
|---|---|---|
| `created_at` | `string` |  |
| `updated_at` | `string` |  |
| `code` | `string` |  |
| `uuid` | `string` |  |
| `organization` | `object` |  |
| `organization._id` | `string` |  |
| `organization.name` | `string` |  |
| `customer` | `object` |  |
| `customer._id` | `string` |  |
| `customer.name` | `string` |  |
| `note` | `string` |  |
| `responsible` | `object` |  |
| `responsible._id` | `string` |  |
| `responsible.full_name` | `string` |  |
| `created_by` | `object` |  |
| `created_by._id` | `string` |  |
| `created_by.full_name` | `string` |  |
| `state` | `string` |  |
| `state_id` | `string` |  |
| `number` | `string` |  |
| `currency_id` | `string` |  |
| `earned_cashback` | `object` |  |
| `earned_cashback._id` | `string` |  |
| `earned_cashback.amount` | `number` |  |
| `earned_cashback.currency` | `object` |  |
| `earned_cashback.currency._id` | `string` |  |
| `earned_cashback.currency.to_currency_id` | `string` |  |
| `earned_cashback.currency.uuid` | `number` |  |
| `earned_cashback.currency.name` | `string` |  |
| `earned_cashback.currency.value` | `number` |  |
| `earned_cashback.currency.symbol` | `string` |  |
| `earned_cashback.currency.side` | `string` |  |
| `earned_cashback.currency.numerator` | `number` |  |
| `earned_cashback.currency.denominator` | `number` |  |
| `earned_cashback.currency.round_type` | `string` |  |
| `earned_cashback.currency.precision` | `number` |  |
| `earned_cashback.base_currency` | `object` |  |
| `earned_cashback.base_currency.numerator` | `number` |  |
| `earned_cashback.base_currency.denominator` | `number` |  |
| `total_amount` | `number` |  |
| `total_refunded_amount` | `number` |  |
| `total_to_pay` | `number` |  |
| `total_discount` | `number` |  |
| `debt` | `number` |  |
| `total_price` | `number` |  |
| `total_added_tax` | `number` |  |
| `contract` | `object` |  |
| `contract._id` | `string` |  |
| `contract.code` | `string` |  |
| `contract.name` | `string` |  |
| `contract.number` | `string` |  |
| `contract.currency_id` | `string` |  |
| `contract.organization_id` | `string` |  |
| `contract.amount` | `number` |  |
| `contract.date` | `string` |  |
| `contract.expire_date` | `string` |  |
| `contract.person_id` | `string` |  |
| `contract.note` | `string` |  |
| `contract.is_active` | `boolean` |  |
| `contract.contract_number` | `number` |  |
| `position` | `number` |  |
| `order_id` | `string` |  |
| `date` | `string` |  |
| `sold_at` | `string` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "created_at": "string",
        "updated_at": "string",
        "code": "string",
        "uuid": "string",
        "organization": {
          "_id": "string",
          "name": "string"
        },
        "customer": {
          "_id": "string",
          "name": "string"
        },
        "note": "string",
        "responsible": {
          "_id": "string",
          "full_name": "string"
        },
        "created_by": {
          "_id": "string",
          "full_name": "string"
        },
        "state": "string",
        "state_id": "string",
        "number": "string",
        "currency_id": "string",
        "earned_cashback": {
          "_id": "string",
          "amount": 0,
          "currency": {
            "_id": "string",
            "to_currency_id": "string",
            "uuid": 0,
            "name": "string",
            "value": 0,
            "symbol": "string",
            "side": "string",
            "numerator": 0,
            "denominator": 0,
            "round_type": "string",
            "precision": 0
          },
          "base_currency": {
            "numerator": 0,
            "denominator": 0
          }
        },
        "total_amount": 0,
        "total_refunded_amount": 0,
        "total_to_pay": 0,
        "total_discount": 0,
        "debt": 0,
        "total_price": 0,
        "total_added_tax": 0,
        "contract": {
          "_id": "string",
          "code": "string",
          "name": "string",
          "number": "string",
          "currency_id": "string",
          "organization_id": "string",
          "amount": 0,
          "date": "string",
          "expire_date": "string",
          "person_id": "string",
          "note": "string",
          "is_active": false,
          "contract_number": 0
        },
        "position": 0,
        "order_id": "string",
        "date": "string",
        "sold_at": "string"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /trade/set-state

setState trade

**Нужное разрешение:** `sale_update` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

Приложению, которое отменяет документ, стоит запросить и `sale_cancel`, `sale_refund_cancel`.

**Пример запроса**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/trade/set-state' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "state": "new",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/set-state', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "state": "new",
    "_id": "64b7f4d9e2b3b6a0b7c5d80a"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/trade/set-state",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "state": "new",
        "_id": "64b7f4d9e2b3b6a0b7c5d80a",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "state": "new",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/set-state');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `_id` | `string` | Да |  |
| `state` | `string` | Да | Допустимые значения: `canceled`, `new`, `done`, `in_progress`, `draft` |
| `canceled_reason_id` | `string` | Нет |  |
| `with_transactions` | `boolean` | Нет | По умолчанию: `false` |
| `with_cashbacks` | `boolean` | Нет | По умолчанию: `false` |

```json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state": "new",
  "canceled_reason_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "with_transactions": false,
  "with_cashbacks": false
}
```

**Ответ**

Структура ответа совпадает с [POST /trade/create](#post-trade-create).

## PUT /trade/set-state-id

setState trade by id

**Нужное разрешение:** `sale_update` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

Приложению, которое отменяет документ, стоит запросить и `sale_cancel`, `sale_refund_cancel`.

**Пример запроса**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/trade/set-state-id' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "state_id": "string",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/set-state-id', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "state_id": "string",
    "_id": "64b7f4d9e2b3b6a0b7c5d80a"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/trade/set-state-id",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "state_id": "string",
        "_id": "64b7f4d9e2b3b6a0b7c5d80a",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "state_id": "string",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/set-state-id');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `_id` | `string` | Да |  |
| `state_id` | `string` | Да |  |
| `with_transactions` | `boolean` | Нет | По умолчанию: `false` |
| `with_cashbacks` | `boolean` | Нет | По умолчанию: `false` |

```json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state_id": "string",
  "with_transactions": false,
  "with_cashbacks": false
}
```

**Ответ**

Структура ответа совпадает с [POST /trade/create](#post-trade-create).

## POST /trade/refund

Refund a trade (full or partial). Takes a full trade body, not a trade id: it is validated like `trade/create`, plus `reason_id`. `currency`, `payments[].payment_method` and `payments[].currency` must be sent as full objects.

**Нужное разрешение:** `sale_update` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/trade/refund' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "64e24f4199a9a3c944444445",
  "responsible_id": "64e24f4199a9a3c944444451",
  "currency": {
    "_id": "64e24f4199a9a3c944444453",
    "name": "USD",
    "value": 1,
    "side": "start",
    "symbol": "$"
  },
  "payments": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "products": [
    {
      "product_id": "64e24f4199a9a3c944444453",
      "order_item_id": "64e24f4199a9a3c944444454",
      "amount": 2,
      "box_count": 1,
      "box_item": 1,
      "price": 50,
      "total_to_pay": 100,
      "discounts": [],
      "marks": [],
      "cost": 40,
      "tax_ids": [],
      "note": "This is a product note.",
      "extra_costs": [],
      "warehouse_id": "64e24f4199a9a3c944444458",
      "price_id": "64e24f4199a9a3c944444459",
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ],
  "reason_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/refund', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "64e24f4199a9a3c944444445",
    "responsible_id": "64e24f4199a9a3c944444451",
    "currency": {
      "_id": "64e24f4199a9a3c944444453",
      "name": "USD",
      "value": 1,
      "side": "start",
      "symbol": "$"
    },
    "payments": [
      {
        "external_transaction_id": "64e24f4199a9a3c944444453",
        "amount": 100,
        "payment_method": {
          "_id": null,
          "name": null,
          "type": null
        },
        "currency": {
          "_id": null,
          "name": null,
          "value": null,
          "side": null,
          "symbol": null
        },
        "paid": 50
      }
    ],
    "products": [
      {
        "product_id": "64e24f4199a9a3c944444453",
        "order_item_id": "64e24f4199a9a3c944444454",
        "amount": 2,
        "box_count": 1,
        "box_item": 1,
        "price": 50,
        "total_to_pay": 100,
        "discounts": [],
        "marks": [],
        "cost": 40,
        "tax_ids": [],
        "note": "This is a product note.",
        "extra_costs": [],
        "warehouse_id": "64e24f4199a9a3c944444458",
        "price_id": "64e24f4199a9a3c944444459",
        "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "expiration_date": "2025-05-01T12:00:00Z",
        "used_measure": {
          "_id": null,
          "ratio": null,
          "amount": null
        }
      }
    ],
    "reason_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/trade/refund",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "64e24f4199a9a3c944444445",
        "responsible_id": "64e24f4199a9a3c944444451",
        "currency": {
            "_id": "64e24f4199a9a3c944444453",
            "name": "USD",
            "value": 1,
            "side": "start",
            "symbol": "$",
        },
        "payments": [
            {
                "external_transaction_id": "64e24f4199a9a3c944444453",
                "amount": 100,
                "payment_method": {
                    "_id": None,
                    "name": None,
                    "type": None,
                },
                "currency": {
                    "_id": None,
                    "name": None,
                    "value": None,
                    "side": None,
                    "symbol": None,
                },
                "paid": 50,
            },
        ],
        "products": [
            {
                "product_id": "64e24f4199a9a3c944444453",
                "order_item_id": "64e24f4199a9a3c944444454",
                "amount": 2,
                "box_count": 1,
                "box_item": 1,
                "price": 50,
                "total_to_pay": 100,
                "discounts": [],
                "marks": [],
                "cost": 40,
                "tax_ids": [],
                "note": "This is a product note.",
                "extra_costs": [],
                "warehouse_id": "64e24f4199a9a3c944444458",
                "price_id": "64e24f4199a9a3c944444459",
                "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
                "expiration_date": "2025-05-01T12:00:00Z",
                "used_measure": {
                    "_id": None,
                    "ratio": None,
                    "amount": None,
                },
            },
        ],
        "reason_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "organization_id": "64e24f4199a9a3c944444445",
  "responsible_id": "64e24f4199a9a3c944444451",
  "currency": {
    "_id": "64e24f4199a9a3c944444453",
    "name": "USD",
    "value": 1,
    "side": "start",
    "symbol": "$"
  },
  "payments": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "products": [
    {
      "product_id": "64e24f4199a9a3c944444453",
      "order_item_id": "64e24f4199a9a3c944444454",
      "amount": 2,
      "box_count": 1,
      "box_item": 1,
      "price": 50,
      "total_to_pay": 100,
      "discounts": [],
      "marks": [],
      "cost": 40,
      "tax_ids": [],
      "note": "This is a product note.",
      "extra_costs": [],
      "warehouse_id": "64e24f4199a9a3c944444458",
      "price_id": "64e24f4199a9a3c944444459",
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ],
  "reason_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/refund');
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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `code` | `string` | Нет |  |
| `organization_id` | `string` | Да |  |
| `order_id` | `string` | Нет |  |
| `open_ticket_id` | `string` | Нет |  |
| `open_ticket_uuid` | `string` | Нет |  |
| `state` | `string` | Нет | Допустимые значения: `new`, `in_progress`, `done` |
| `customer_id` | `string` | Нет |  |
| `customer_assistant_id` | `string` | Нет |  |
| `state_id` | `string` | Нет |  |
| `responsible_id` | `string` | Да |  |
| `courier_id` | `string` | Нет |  |
| `currency` | `object` | Да |  |
| `currency._id` | `string` | Да |  |
| `currency.name` | `string` | Да |  |
| `currency.value` | `number` | Да |  |
| `currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `currency.symbol` | `string` | Нет |  |
| `price_id` | `string` | Нет |  |
| `by_balance` | `object[]` | Нет |  |
| `by_balance[].amount` | `number` | Да |  |
| `by_balance[].currency` | `object` | Да |  |
| `by_balance[].currency._id` | `string` | Да |  |
| `by_balance[].currency.name` | `string` | Да |  |
| `by_balance[].currency.value` | `number` | Да |  |
| `by_balance[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `by_balance[].currency.symbol` | `string` | Нет |  |
| `by_balance[].paid` | `number` | Нет |  |
| `payments` | `object[]` | Да |  |
| `payments[].external_transaction_id` | `string` | Нет |  |
| `payments[].amount` | `number` | Да |  |
| `payments[].payment_method` | `object` | Да |  |
| `payments[].payment_method._id` | `string` | Да |  |
| `payments[].payment_method.name` | `string` | Да |  |
| `payments[].payment_method.type` | `string` | Нет | Copy of the payment method's `type` at the time of sale; send the value `payment-method/get-by-id` returns (`cash` or `cashless`). The older values are still accepted so previously built payloads keep working. `gift` is no longer accepted.. Допустимые значения: `cash`, `cashless`, `system`, `card`, `debt`, `transfer`, `terminal`, `by_balance`, `by_cashback`, `trade_in`, `integration` |
| `payments[].currency` | `object` | Да |  |
| `payments[].currency._id` | `string` | Да |  |
| `payments[].currency.name` | `string` | Да |  |
| `payments[].currency.value` | `number` | Да |  |
| `payments[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `payments[].currency.symbol` | `string` | Нет |  |
| `payments[].paid` | `number` | Нет |  |
| `applied_cashbacks` | `object[]` | Нет |  |
| `applied_cashbacks[].amount` | `number` | Да |  |
| `applied_cashbacks[].currency` | `object` | Да |  |
| `applied_cashbacks[].currency._id` | `string` | Да |  |
| `applied_cashbacks[].currency.name` | `string` | Да |  |
| `applied_cashbacks[].currency.value` | `number` | Да |  |
| `applied_cashbacks[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `applied_cashbacks[].currency.symbol` | `string` | Нет |  |
| `applied_cashbacks[].paid` | `number` | Нет |  |
| `changes` | `object[]` | Нет |  |
| `changes[].external_transaction_id` | `string` | Нет |  |
| `changes[].amount` | `number` | Да |  |
| `changes[].payment_method` | `object` | Да |  |
| `changes[].payment_method._id` | `string` | Да |  |
| `changes[].payment_method.name` | `string` | Да |  |
| `changes[].payment_method.type` | `string` | Нет | Copy of the payment method's `type` at the time of sale; send the value `payment-method/get-by-id` returns (`cash` or `cashless`). The older values are still accepted so previously built payloads keep working. `gift` is no longer accepted.. Допустимые значения: `cash`, `cashless`, `system`, `card`, `debt`, `transfer`, `terminal`, `by_balance`, `by_cashback`, `trade_in`, `integration` |
| `changes[].currency` | `object` | Да |  |
| `changes[].currency._id` | `string` | Да |  |
| `changes[].currency.name` | `string` | Да |  |
| `changes[].currency.value` | `number` | Да |  |
| `changes[].currency.side` | `string` | Нет | Допустимые значения: `start`, `end` |
| `changes[].currency.symbol` | `string` | Нет |  |
| `changes[].paid` | `number` | Нет |  |
| `note` | `string` | Нет |  |
| `products` | `object[]` | Да |  |
| `products[].product_id` | `string` | Да |  |
| `products[].order_item_id` | `string` | Нет |  |
| `products[].amount` | `number` | Да |  |
| `products[].box_count` | `number` | Нет |  |
| `products[].box_item` | `number` | Нет |  |
| `products[].price` | `number` | Нет |  |
| `products[].total_to_pay` | `number` | Нет |  |
| `products[].discounts` | `object[]` | Нет |  |
| `products[].discounts[]._id` | `string` | Нет | Required unless `is_custom` is true. |
| `products[].discounts[].is_custom` | `boolean` | Да |  |
| `products[].discounts[].value` | `number` | Да |  |
| `products[].discounts[].name` | `string` | Нет | Required unless `is_custom` is true. |
| `products[].discounts[].apply_type` | `string` | Да | Допустимые значения: `percent`, `cash` |
| `products[].marks` | `string[]` | Нет |  |
| `products[].cost` | `number` | Нет |  |
| `products[].tax_ids` | `string[]` | Нет |  |
| `products[].note` | `string` | Нет |  |
| `products[].extra_costs` | `object[]` | Нет |  |
| `products[].extra_costs[].cost_id` | `string` | Да |  |
| `products[].extra_costs[].amount` | `number` | Да |  |
| `products[].extra_costs[].index` | `number` | Нет |  |
| `products[].warehouse_id` | `string` | Нет |  |
| `products[].price_id` | `string` | Нет |  |
| `products[]._id` | `string` | Нет |  |
| `products[].expiration_date` | `string (date-time)` | Нет |  |
| `products[].used_measure` | `object` | Нет |  |
| `products[].used_measure._id` | `string` | Да |  |
| `products[].used_measure.ratio` | `number` | Да |  |
| `products[].used_measure.amount` | `number` | Да |  |
| `date` | `string (date-time)` | Нет |  |
| `paying_date` | `string (date-time)` | Нет |  |
| `delivery_date` | `string (date-time)` | Нет |  |
| `delivery_address` | `object` | Нет |  |
| `delivery_address.human_address` | `object` | Нет |  |
| `delivery_address.human_address.address` | `string` | Нет |  |
| `delivery_address.human_address.city` | `string` | Нет |  |
| `delivery_address.human_address.state` | `string` | Нет |  |
| `delivery_address.human_address.zip` | `string` | Нет |  |
| `delivery_address.lat` | `number` | Нет |  |
| `delivery_address.long` | `number` | Нет |  |
| `delivery_address.bearing` | `number` | Нет |  |
| `warehouse_id` | `string` | Нет |  |
| `discounts` | `object[]` | Нет |  |
| `discounts[]._id` | `string` | Нет | Required unless `is_custom` is true. |
| `discounts[].is_custom` | `boolean` | Да |  |
| `discounts[].value` | `number` | Да |  |
| `discounts[].name` | `string` | Нет | Required unless `is_custom` is true. |
| `discounts[].apply_type` | `string` | Да | Допустимые значения: `percent`, `cash` |
| `cover_by_balance` | `boolean` | Нет |  |
| `calc_tax_after_discount` | `boolean` | Нет |  |
| `installment_plan_interval` | `string` | Нет | Required when `installment_plan` is not empty.. Допустимые значения: `year`, `month` |
| `installment_plan` | `object[]` | Нет |  |
| `installment_plan[].date` | `string (date-time)` | Да |  |
| `installment_plan[].amount` | `number` | Да |  |
| `additional_costs` | `object[]` | Нет |  |
| `additional_costs[].cost_id` | `string` | Да |  |
| `additional_costs[].amount` | `number` | Да |  |
| `additional_costs[].customer_id` | `string` | Нет |  |
| `additional_costs[].employee_id` | `string` | Нет |  |
| `additional_costs[].supplier_id` | `string` | Нет |  |
| `additional_costs[].person_id` | `string` | Нет |  |
| `currency_values` | `object[]` | Нет |  |
| `currency_values[].to_currency_id` | `string` | Да |  |
| `currency_values[].denominator` | `string` | Да |  |
| `currency_values[].numerator` | `number` | Да |  |
| `to_send_customer` | `boolean` | Нет |  |
| `contract_id` | `string` | Нет |  |
| `refund_id` | `string` | Нет |  |
| `reason_id` | `string` | Да |  |

```json
{
  "code": "TRADE-123",
  "organization_id": "64e24f4199a9a3c944444445",
  "order_id": "64e24f4199a9a3c944444446",
  "open_ticket_id": "64e24f4199a9a3c944444447",
  "open_ticket_uuid": "UUID-123",
  "state": "new",
  "customer_id": "64e24f4199a9a3c944444448",
  "customer_assistant_id": "64e24f4199a9a3c944444449",
  "state_id": "64e24f4199a9a3c944444450",
  "responsible_id": "64e24f4199a9a3c944444451",
  "courier_id": "64e24f4199a9a3c944444452",
  "currency": {
    "_id": "64e24f4199a9a3c944444453",
    "name": "USD",
    "value": 1,
    "side": "start",
    "symbol": "$"
  },
  "price_id": "64e24f4199a9a3c944444453",
  "by_balance": [
    {
      "amount": 100,
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "payments": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "applied_cashbacks": [
    {
      "amount": 100,
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "changes": [
    {
      "external_transaction_id": "64e24f4199a9a3c944444453",
      "amount": 100,
      "payment_method": {
        "_id": null,
        "name": null,
        "type": null
      },
      "currency": {
        "_id": null,
        "name": null,
        "value": null,
        "side": null,
        "symbol": null
      },
      "paid": 50
    }
  ],
  "note": "This is a note.",
  "products": [
    {
      "product_id": "64e24f4199a9a3c944444453",
      "order_item_id": "64e24f4199a9a3c944444454",
      "amount": 2,
      "box_count": 1,
      "box_item": 1,
      "price": 50,
      "total_to_pay": 100,
      "discounts": [],
      "marks": [],
      "cost": 40,
      "tax_ids": [],
      "note": "This is a product note.",
      "extra_costs": [],
      "warehouse_id": "64e24f4199a9a3c944444458",
      "price_id": "64e24f4199a9a3c944444459",
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ],
  "date": "2023-10-01T12:00:00Z",
  "paying_date": "2023-10-01T12:00:00Z",
  "delivery_date": "2023-10-01T12:00:00Z",
  "delivery_address": {
    "human_address": {
      "address": "123 Main St, New York, NY 10001",
      "city": "New York",
      "state": "NY",
      "zip": "10001"
    },
    "lat": 40.7128,
    "long": -74.006,
    "bearing": 0
  },
  "warehouse_id": "64e24f4199a9a3c944444460",
  "discounts": [
    {
      "_id": "64e24f4199a9a3c944444455",
      "is_custom": false,
      "value": 10,
      "name": "Discount 1",
      "apply_type": "percent"
    }
  ],
  "cover_by_balance": false,
  "calc_tax_after_discount": true,
  "installment_plan_interval": "month",
  "installment_plan": [
    {
      "date": "2023-10-01T12:00:00Z",
      "amount": 100
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64e24f4199a9a3c944444457",
      "amount": 5,
      "customer_id": "64e24f4199a9a3c944444457",
      "employee_id": "64e24f4199a9a3c944444457",
      "supplier_id": "64e24f4199a9a3c944444457",
      "person_id": "64e24f4199a9a3c944444457"
    }
  ],
  "currency_values": [
    {
      "to_currency_id": "64e24f4199a9a3c944444453",
      "denominator": "USD",
      "numerator": 1
    }
  ],
  "to_send_customer": false,
  "contract_id": "64e24f4199a9a3c944444461",
  "refund_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "reason_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}
```

**Ответ**

Структура ответа совпадает с [POST /trade/create](#post-trade-create).

## GET /trade/get-by-id/for-bot/{id}

Get a trade by _id, formatted for bot/external consumption.

**Нужное разрешение:** `sale` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/for-bot/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/for-bot/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/for-bot/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id/for-bot/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да |  |

**Тело запроса**

Тело запроса не требуется.

**Ответ**

Структура ответа совпадает с [POST /trade/create](#post-trade-create).

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

Get the line items of a trade.

**Нужное разрешение:** `sale` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/trade/get-items/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/get-items/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/trade/get-items/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/get-items/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да |  |

**Тело запроса**

Тело запроса не требуется.

**Ответ**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    {
      "_id": "string",
      "product_id": "string",
      "amount": 0,
      "cost": 0,
      "price": 0
    }
  ],
  "time": "2025-05-01T12:00:00Z"
}
```

## POST /trade/export-by-xls-template

Fill the account's trade Excel template with one trade and return the path of the generated file.

**Нужное разрешение:** `sale` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/trade/export-by-xls-template' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/export-by-xls-template', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "_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/trade/export-by-xls-template",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    },
)
print(res.json())
```

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

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/export-by-xls-template');
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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `_id` | `string` | Да | Trade ObjectId. |

```json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}
```

**Ответ**

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

## POST /trade/custom-fields/set

Set custom-field values on a trade. The list replaces the trade's current custom-field values.

**Нужное разрешение:** `sale_update` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/trade/custom-fields/set' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "trade_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "custom_fields": [
    {
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "value": null
    }
  ]
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/custom-fields/set', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "trade_id": "64b7f4d9e2b3b6a0b7c5d7ff",
    "custom_fields": [
      {
        "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "value": null
      }
    ]
  }),
})
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/trade/custom-fields/set",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "trade_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "custom_fields": [
            {
                "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
                "value": None,
            },
        ],
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "trade_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "custom_fields": [
    {
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "value": null
    }
  ]
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/custom-fields/set');
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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `trade_id` | `string` | Да | Trade ObjectId. |
| `custom_fields` | `object[]` | Да | Custom-field values to set on the trade. |
| `custom_fields[]._id` | `string` | Да |  |
| `custom_fields[].value` | `any` | Нет | Field value; its type depends on the custom field. |

```json
{
  "trade_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "custom_fields": [
    {
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "value": null
    }
  ]
}
```

**Ответ**

Структура ответа совпадает с [POST /trade/create](#post-trade-create).

## POST /trade/get-by-id

Fetch a single trade by ObjectId, passing the id in the request body instead of the path. Returns the same compact payload as GET /trade/get-by-id/for-bot/{id}, NOT the fuller shape of GET /trade/get-by-id/{id} — use the GET form when you need the full trade.

**Нужное разрешение:** `sale` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "_id": "64b7f4d9e2b3b6a0b7c5d80a"
  }),
})
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/trade/get-by-id",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "_id": "64b7f4d9e2b3b6a0b7c5d80a",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/trade/get-by-id');
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);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `_id` | `string` | Да | Trade ObjectId (required). |

```json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
```

**Ответ**

Структура ответа совпадает с [POST /trade/create](#post-trade-create).

---

*Эта страница сгенерирована из спецификации OpenAPI.*
