# Sale order

::: info
Every response arrives in the shared envelope — `code`, `message`, `messages`, `status_code`, `time` — with the payload in `data`. The tables below describe what is inside `data`.
:::

## POST /sale-order/create

Create a sale order. The server assigns `uuid` (`A<number>`); a `uuid` sent in the body is ignored. A repeated request creates a second order.

**Required permission:** `sale_order_create` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "67b486d242ed76693cd2cc59",
  "customer_id": "67b486d242ed76693cd2cc59"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sale-order/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "67b486d242ed76693cd2cc59",
    "customer_id": "67b486d242ed76693cd2cc59"
  }),
})
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/sale-order/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "67b486d242ed76693cd2cc59",
        "customer_id": "67b486d242ed76693cd2cc59",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "organization_id": "67b486d242ed76693cd2cc59",
  "customer_id": "67b486d242ed76693cd2cc59"
}
JSON;

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

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `code` | `string` | No |  |
| `name` | `string` | No |  |
| `organization_id` | `string` | Yes |  |
| `visit_id` | `string` | No |  |
| `customer_id` | `string` | Yes |  |
| `customer_assistant_id` | `string` | No |  |
| `responsible_id` | `string` | No |  |
| `currency_id` | `string` | No |  |
| `currency` | `object` | No |  |
| `currency._id` | `string (objectId)` | Yes |  |
| `currency.numerator` | `number` | Yes |  |
| `currency.denominator` | `number` | Yes |  |
| `currency.value` | `number` | Yes |  |
| `currency.precision` | `number` | No |  |
| `currency.round_type` | `string` | No | One of: `floor`, `ceil`, `round` |
| `state` | `string` | No | One of: `new`, `draft`, `in_progress`, `canceled`, `done`, `accepted` |
| `state_id` | `string` | No |  |
| `date` | `string` | No |  |
| `delivery_date` | `string` | No |  |
| `note` | `string` | No | Complete order note. Integration creates preserve long courier, pickup, and customer instructions; the API request-body limit still applies. |
| `discounts` | `object[]` | No |  |
| `discounts[]._id` | `string (objectId)` | Yes |  |
| `discounts[].value` | `number` | Yes |  |
| `discounts[].name` | `string` | Yes |  |
| `discounts[].apply_type` | `string` | Yes | One of: `percent`, `cash` |
| `discounts[].is_custom` | `boolean` | Yes |  |
| `products` | `object[]` | No |  |
| `products[].product_id` | `string (objectId)` | Yes |  |
| `products[].amount` | `number` | Yes |  |
| `products[].price` | `number` | Yes |  |
| `products[].real_price` | `number` | No |  |
| `products[].discounts` | `object[]` | No |  |
| `products[].discounts[]._id` | `string (objectId)` | Yes |  |
| `products[].discounts[].value` | `number` | Yes |  |
| `products[].discounts[].name` | `string` | Yes |  |
| `products[].discounts[].apply_type` | `string` | Yes | One of: `percent`, `cash` |
| `products[].discounts[].is_custom` | `boolean` | Yes |  |
| `products[].price_id` | `string (objectId)` | No |  |
| `products[].warehouse_id` | `string (objectId)` | No |  |
| `products[].box_count` | `number` | No |  |
| `products[].box_item` | `number` | No |  |
| `products[].tax_ids` | `string[]` | No |  |
| `products[].taxes` | `object[]` | No |  |
| `products[].taxes[]._id` | `string` | Yes |  |
| `products[].taxes[].name` | `string` | Yes |  |
| `products[].taxes[].rate` | `number` | Yes |  |
| `products[].taxes[].type` | `string` | Yes | One of: `included`, `added` |
| `products[].taxes[].to_price` | `boolean` | Yes |  |
| `products[].taxes[].is_manual` | `boolean` | Yes |  |
| `products[].total_to_pay` | `number` | No |  |
| `products[].note` | `string` | No |  |
| `products[].extra_costs` | `object[]` | No |  |
| `products[].extra_costs[].cost_id` | `string` | Yes |  |
| `products[].extra_costs[].amount` | `number` | Yes |  |
| `products[].extra_costs[].index` | `number` | No |  |
| `products[].used_measure` | `object` | No |  |
| `products[].used_measure._id` | `string` | Yes |  |
| `products[].used_measure.ratio` | `number` | Yes |  |
| `products[].used_measure.amount` | `number` | Yes |  |
| `delivery_address` | `object` | No |  |
| `delivery_address.long` | `number` | No |  |
| `delivery_address.lat` | `number` | No |  |
| `delivery_address.human_address` | `object` | No |  |
| `delivery_address.human_address.city` | `string` | No |  |
| `delivery_address.human_address.state` | `string` | No |  |
| `delivery_address.human_address.zip` | `string` | No |  |
| `delivery_address.human_address.address` | `string` | No |  |
| `delivery_address.bearing` | `number` | No |  |
| `price_id` | `string` | No |  |
| `custom_fields` | `object` | No |  |
| `custom_fields._id` | `string` | Yes |  |
| `custom_fields.value` | `object` | No |  |
| `calc_tax_after_discount` | `boolean` | No |  |
| `additional_costs` | `object[]` | No |  |
| `additional_costs[].cost_id` | `string` | Yes |  |
| `additional_costs[].amount` | `number` | Yes |  |
| `additional_costs[].customer_id` | `string` | No |  |
| `additional_costs[].employee_id` | `string` | No |  |
| `additional_costs[].supplier_id` | `string` | No |  |
| `additional_costs[].person_id` | `string` | No |  |

```json
{
  "code": "string",
  "name": "string",
  "organization_id": "67b486d242ed76693cd2cc59",
  "visit_id": "67b486d242ed76693cd2cc59",
  "customer_id": "67b486d242ed76693cd2cc59",
  "customer_assistant_id": "67b486d242ed76693cd2cc59",
  "responsible_id": "67b486d242ed76693cd2cc59",
  "currency_id": "67b486d242ed76693cd2cc59",
  "currency": {
    "_id": "66126f4b1e2f4a9cb4244c8f",
    "numerator": 1,
    "denominator": 1000,
    "value": 11000,
    "precision": 3,
    "round_type": "floor"
  },
  "state": "new",
  "state_id": "67b486d242ed76693cd2cc59",
  "date": "2023-10-01T12:00:00Z",
  "delivery_date": "2023-10-01T12:00:00Z",
  "note": "string",
  "discounts": [
    {
      "_id": "66126f4b1e2f4a9cb4244c90",
      "value": 10,
      "name": "10%",
      "apply_type": "percent",
      "is_custom": true
    }
  ],
  "products": [
    {
      "product_id": "66126f4b1e2f4a9cb4244a01",
      "amount": 2,
      "price": 15000,
      "real_price": 14500,
      "discounts": [],
      "price_id": "66126f4b1e2f4a9cb4244a02",
      "warehouse_id": "66126f4b1e2f4a9cb4244a03",
      "box_count": 2,
      "box_item": 24,
      "tax_ids": [],
      "taxes": [],
      "total_to_pay": 0,
      "note": "string",
      "extra_costs": [],
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ],
  "delivery_address": {
    "long": 0,
    "lat": 0,
    "human_address": {
      "city": "string",
      "state": "string",
      "zip": "string",
      "address": "string"
    },
    "bearing": 0
  },
  "price_id": "2023-10-01T12:00:00Z",
  "custom_fields": {
    "_id": "67b486d242ed76693cd2cc59",
    "value": {}
  },
  "calc_tax_after_discount": false,
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "amount": 0,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "person_id": "64b7f4d9e2b3b6a0b7c5d7ff"
    }
  ]
}
```

**Response**

| Field | Type | Description |
|---|---|---|
| `_id` | `string` |  |
| `created_at` | `string` |  |
| `updated_at` | `string` |  |
| `name` | `string` |  |
| `uuid` | `string` |  |
| `visit_id` | `string` |  |
| `code` | `string` |  |
| `organization_id` | `string` |  |
| `organization` | `object` |  |
| `organization._id` | `string` |  |
| `organization.name` | `string` |  |
| `customer_id` | `string` |  |
| `customer` | `object` |  |
| `customer._id` | `string` |  |
| `customer.type` | `string` | One of: `legal`, `natural` |
| `customer.phone_number` | `string` |  |
| `customer.phone_numbers` | `string[]` |  |
| `customer.name` | `string` |  |
| `customer.image` | `string` |  |
| `customer.custom_fields` | `object[]` |  |
| `customer.custom_fields[]._id` | `string` |  |
| `customer.custom_fields[].value` | `object` |  |
| `customer_assistant` | `object` |  |
| `customer_assistant._id` | `string` |  |
| `customer_assistant.name` | `string` |  |
| `customer_assistant.type` | `string` | One of: `legal`, `natural` |
| `customer_assistant_hierarchy` | `object[]` |  |
| `customer_assistant_hierarchy[]._id` | `string` |  |
| `customer_assistant_hierarchy[].name` | `string` |  |
| `customer_assistant_hierarchy[].type` | `string` | One of: `legal`, `natural` |
| `customer_assistant_hierarchy[].first_name` | `string` |  |
| `customer_assistant_hierarchy[].last_name` | `string` |  |
| `customer_assistant_hierarchy[].middle_name` | `string` |  |
| `responsible_id` | `string` |  |
| `customer_image_url` | `string` |  |
| `responsible` | `object` |  |
| `responsible._id` | `string` |  |
| `responsible.full_name` | `string` |  |
| `price_id` | `string` |  |
| `price` | `object` |  |
| `price._id` | `string` |  |
| `price.name` | `string` |  |
| `price.short_name` | `string` |  |
| `price.code` | `string` |  |
| `state_id` | `string` |  |
| `state` | `string` | One of: `new`, `draw`, `in_progress`, `canceled`, `done`, `accepted` |
| `note` | `string` |  |
| `date` | `string` |  |
| `delivery_date` | `string` |  |
| `number` | `string` |  |
| `device` | `object` |  |
| `device._id` | `string` |  |
| `device.name` | `string` |  |
| `device.device_id` | `string` |  |
| `currency` | `object` |  |
| `currency._id` | `string (objectId)` |  |
| `currency.to_currency_id` | `string (objectId)` |  |
| `currency.uuid` | `number` |  |
| `currency.name` | `string` |  |
| `currency.value` | `number` |  |
| `currency.symbol` | `string` |  |
| `currency.side` | `string` | One of: `start`, `end` |
| `currency.numerator` | `number` |  |
| `currency.denominator` | `number` |  |
| `currency.round_type` | `string` | One of: `floor`, `ceil`, `round` |
| `currency.precision` | `number` |  |
| `currency_id` | `string` |  |
| `total_to_pay` | `number` |  |
| `total_price` | `number` |  |
| `discount` | `number` |  |
| `total_discount` | `number` |  |
| `discounts` | `object[]` |  |
| `discounts[]._id` | `string` |  |
| `discounts[].name` | `string` |  |
| `discounts[].value` | `number` |  |
| `discounts[].apply_type` | `string` | One of: `percent`, `cash` |
| `discounts[].currency_id` | `string` |  |
| `products` | `object[]` |  |
| `delivery_address` | `object` |  |
| `delivery_address.long` | `number` |  |
| `delivery_address.lat` | `number` |  |
| `delivery_address.human_address` | `object` |  |
| `delivery_address.human_address.addres` | `string` |  |
| `delivery_address.human_address.city` | `string` |  |
| `delivery_address.human_address.state` | `string` |  |
| `delivery_address.human_address.zip` | `string` |  |
| `total_sale` | `number` |  |
| `total_amount` | `number` |  |
| `trade_status` | `string` | One of: `zero`, `partial`, `fully` |
| `trades` | `object[]` |  |
| `trades[]._id` | `string` |  |
| `trades[].type` | `string` | One of: `b2b`, `b2c` |
| `trades[].organization_id` | `string` |  |
| `trades[].state` | `string` | One of: `new`, `in_progress`, `draft`, `canceled`, `done` |
| `trades[].state_id` | `string` |  |
| `trades[].number` | `string` |  |
| `trades[].uuid` | `number` |  |
| `trades[].currency` | `object` |  |
| `trades[].currency._id` | `string` |  |
| `trades[].currency.to_currency_id` | `string` |  |
| `trades[].currency.name` | `string` |  |
| `trades[].currency.value` | `number` |  |
| `trades[].currency.numerator` | `number` |  |
| `trades[].currency.denominator` | `number` |  |
| `trades[].currency.round_type` | `string` | One of: `floor`, `ceil`, `round` |
| `trades[].currency.precision` | `number` |  |
| `trades[].cashbox_id` | `string` |  |
| `trades[].calc_tax_after_discount` | `boolean` |  |
| `trades[].sale_settings` | `object` |  |
| `trades[].sale_settings.discount` | `number` |  |
| `trades[].total_extra_cost` | `number` |  |
| `trades[].total_effected_extra_cost` | `number` |  |
| `custom_fields` | `object[]` |  |
| `custom_fields[]._id` | `string` |  |
| `custom_fields[].value` | `string` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "created_at": "string",
    "updated_at": "string",
    "name": "string",
    "uuid": "A1024",
    "visit_id": "67b486d242ed76693cd2cc59",
    "code": "67b486d242ed76693cd2cc59",
    "organization_id": "67b486d242ed76693cd2cc59",
    "organization": {
      "_id": "string",
      "name": "string"
    },
    "customer_id": "67b486d242ed76693cd2cc59",
    "customer": {
      "_id": "string",
      "type": "legal",
      "phone_number": "string",
      "phone_numbers": [
        "string"
      ],
      "name": "string",
      "image": "string",
      "custom_fields": [
        {
          "_id": null,
          "value": null
        }
      ]
    },
    "customer_assistant": {
      "_id": "string",
      "name": "string",
      "type": "legal"
    },
    "customer_assistant_hierarchy": [
      {
        "_id": "string",
        "name": "string",
        "type": "legal",
        "first_name": "string",
        "last_name": "string",
        "middle_name": "string"
      }
    ],
    "responsible_id": "string",
    "customer_image_url": "string",
    "responsible": {
      "_id": "string",
      "full_name": "string"
    },
    "price_id": "string",
    "price": {
      "_id": "string",
      "name": "string",
      "short_name": "string",
      "code": "string"
    },
    "state_id": "string",
    "state": "new",
    "note": "string",
    "date": "string",
    "delivery_date": "string",
    "number": "string",
    "device": {
      "_id": "string",
      "name": "string",
      "device_id": "string"
    },
    "currency": {
      "_id": "66126f4b1e2f4a9cb4244c8b",
      "to_currency_id": "66126f4b1e2f4a9cb4244c8c",
      "uuid": "66126f4b1e2f4a9cb4244c8d",
      "name": "string",
      "value": 1,
      "symbol": "string",
      "side": "start",
      "numerator": 1,
      "denominator": 1,
      "round_type": "floor",
      "precision": 3
    },
    "currency_id": "string",
    "total_to_pay": 0,
    "total_price": 0,
    "discount": 0,
    "total_discount": 0,
    "discounts": [
      {
        "_id": "string",
        "name": "string",
        "value": 0,
        "apply_type": "percent",
        "currency_id": "string"
      }
    ],
    "products": [
      {}
    ],
    "delivery_address": {
      "long": 0,
      "lat": 0,
      "human_address": {
        "addres": "string",
        "city": "string",
        "state": "string",
        "zip": "string"
      }
    },
    "total_sale": 0,
    "total_amount": 0,
    "trade_status": "zero",
    "trades": [
      {
        "_id": "string",
        "type": "b2b",
        "organization_id": "string",
        "state": "new",
        "state_id": "string",
        "number": "string",
        "uuid": 0,
        "currency": {
          "_id": null,
          "to_currency_id": null,
          "name": null,
          "value": null,
          "numerator": null,
          "denominator": null,
          "round_type": null,
          "precision": null
        },
        "cashbox_id": "string",
        "calc_tax_after_discount": false,
        "sale_settings": {
          "discount": null
        },
        "total_extra_cost": 0,
        "total_effected_extra_cost": 0
      }
    ],
    "custom_fields": [
      {
        "_id": "string",
        "value": "string"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /sale-order/update

This method allows updating saler-order in the account.

**Required permission:** `sale_order_update` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/update' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "_id": "67b486d242ed76693cd2cc59",
  "responsible_id": "67b486d242ed76693cd2cc59"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sale-order/update', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "_id": "67b486d242ed76693cd2cc59",
    "responsible_id": "67b486d242ed76693cd2cc59"
  }),
})
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/sale-order/update",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "_id": "67b486d242ed76693cd2cc59",
        "responsible_id": "67b486d242ed76693cd2cc59",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "_id": "67b486d242ed76693cd2cc59",
  "responsible_id": "67b486d242ed76693cd2cc59"
}
JSON;

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

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `_id` | `string` | Yes |  |
| `code` | `string` | No |  |
| `name` | `string` | No |  |
| `organization_id` | `string` | No |  |
| `visit_id` | `string` | No |  |
| `customer_id` | `string` | No |  |
| `customer_assistant_id` | `string` | No |  |
| `responsible_id` | `string` | Yes |  |
| `currency_id` | `string` | No |  |
| `currency` | `object` | No |  |
| `currency._id` | `string (objectId)` | Yes |  |
| `currency.numerator` | `number` | Yes |  |
| `currency.denominator` | `number` | Yes |  |
| `currency.value` | `number` | Yes |  |
| `date` | `string` | No |  |
| `delivery_date` | `string` | No |  |
| `note` | `string` | No |  |
| `discounts` | `object[]` | No |  |
| `discounts[]._id` | `string (objectId)` | Yes |  |
| `discounts[].value` | `number` | Yes |  |
| `discounts[].name` | `string` | Yes |  |
| `discounts[].is_custom` | `boolean` | Yes |  |
| `discounts[].apply_type` | `string` | Yes | One of: `percent`, `cash` |
| `products` | `object[]` | No |  |
| `products[].product_id` | `string (objectId)` | Yes |  |
| `products[].amount` | `number` | Yes |  |
| `products[].price` | `number` | Yes |  |
| `products[].real_price` | `number` | No |  |
| `products[].discounts` | `object[]` | No |  |
| `products[].discounts[]._id` | `string (objectId)` | Yes |  |
| `products[].discounts[].value` | `number` | Yes |  |
| `products[].discounts[].name` | `string` | Yes |  |
| `products[].discounts[].is_custom` | `boolean` | Yes |  |
| `products[].discounts[].apply_type` | `string` | Yes | One of: `percent`, `cash` |
| `products[].price_id` | `string (objectId)` | No |  |
| `products[].warehouse_id` | `string (objectId)` | No |  |
| `products[].box_count` | `number` | No |  |
| `products[].box_item` | `number` | No |  |
| `products[].tax_ids` | `string[]` | No |  |
| `products[].taxes` | `object[]` | No |  |
| `products[].taxes[]._id` | `string` | Yes |  |
| `products[].taxes[].name` | `string` | Yes |  |
| `products[].taxes[].rate` | `number` | Yes |  |
| `products[].taxes[].type` | `string` | Yes | One of: `included`, `added` |
| `products[].taxes[].to_price` | `boolean` | Yes |  |
| `products[].taxes[].is_manual` | `boolean` | Yes |  |
| `products[].total_to_pay` | `number` | No |  |
| `products[].note` | `string` | No |  |
| `products[].extra_costs` | `object[]` | No |  |
| `products[].extra_costs[].cost_id` | `string` | Yes |  |
| `products[].extra_costs[].amount` | `number` | Yes |  |
| `products[].extra_costs[].index` | `number` | No |  |
| `products[].used_measure` | `object` | No |  |
| `products[].used_measure._id` | `string` | Yes |  |
| `products[].used_measure.ratio` | `number` | Yes |  |
| `products[].used_measure.amount` | `number` | Yes |  |
| `delivery_address` | `object` | No |  |
| `delivery_address.long` | `number` | No |  |
| `delivery_address.lat` | `number` | No |  |
| `delivery_address.human_address` | `object` | No |  |
| `delivery_address.human_address.city` | `string` | No |  |
| `delivery_address.human_address.state` | `string` | No |  |
| `delivery_address.human_address.zip` | `string` | No |  |
| `delivery_address.human_address.address` | `string` | No |  |
| `delivery_address.bearing` | `number` | No |  |
| `price_id` | `string` | No |  |
| `custom_fields` | `object` | No |  |
| `custom_fields._id` | `string` | Yes |  |
| `custom_fields.value` | `string` | No | must be any data types |
| `customer` | `object` | No |  |
| `customer.name` | `string` | No |  |
| `customer.phone_number` | `string` | No |  |
| `customer.phone_numbers` | `string[]` | No |  |
| `customer.custom_fields` | `object[]` | No | Custom-field values. |
| `customer.custom_fields[]._id` | `string` | Yes |  |
| `customer.custom_fields[].value` | `any` | No | Field value; its type depends on the custom field. |
| `customer._id` | `string` | Yes |  |
| `calc_tax_after_discount` | `boolean` | No |  |
| `additional_costs` | `object[]` | No |  |
| `additional_costs[].cost_id` | `string` | Yes |  |
| `additional_costs[].amount` | `number` | Yes |  |
| `additional_costs[].customer_id` | `string` | No |  |
| `additional_costs[].employee_id` | `string` | No |  |
| `additional_costs[].supplier_id` | `string` | No |  |
| `additional_costs[].person_id` | `string` | No |  |

```json
{
  "_id": "67b486d242ed76693cd2cc59",
  "code": "",
  "name": "",
  "organization_id": "67b486d242ed76693cd2cc59",
  "visit_id": "67b486d242ed76693cd2cc59",
  "customer_id": "67b486d242ed76693cd2cc59",
  "customer_assistant_id": "67b486d242ed76693cd2cc59",
  "responsible_id": "67b486d242ed76693cd2cc59",
  "currency_id": "67b486d242ed76693cd2cc59",
  "currency": {
    "_id": "66126f4b1e2f4a9cb4244c8f",
    "numerator": 1,
    "denominator": 1000,
    "value": 11000
  },
  "date": "2023-10-01T12:00:00Z",
  "delivery_date": "2023-10-01T12:00:00Z",
  "note": "string",
  "discounts": [
    {
      "_id": "66126f4b1e2f4a9cb4244c90",
      "value": 10,
      "name": "10%",
      "is_custom": false,
      "apply_type": "percent"
    }
  ],
  "products": [
    {
      "product_id": "66126f4b1e2f4a9cb4244a01",
      "amount": 2,
      "price": 15000,
      "real_price": 14500,
      "discounts": [],
      "price_id": "66126f4b1e2f4a9cb4244a02",
      "warehouse_id": "66126f4b1e2f4a9cb4244a03",
      "box_count": 2,
      "box_item": 24,
      "tax_ids": [],
      "taxes": [],
      "total_to_pay": 0,
      "note": "string",
      "extra_costs": [],
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      }
    }
  ],
  "delivery_address": {
    "long": 0,
    "lat": 0,
    "human_address": {
      "city": "string",
      "state": "string",
      "zip": "string",
      "address": "string"
    },
    "bearing": 0
  },
  "price_id": "2023-10-01T12:00:00Z",
  "custom_fields": {
    "_id": "67b486d242ed76693cd2cc59",
    "value": "any"
  },
  "customer": {
    "name": "string",
    "phone_number": "string",
    "phone_numbers": [
      "string"
    ],
    "custom_fields": [
      {
        "_id": null,
        "value": null
      }
    ],
    "_id": "64b7f4d9e2b3b6a0b7c5d7ff"
  },
  "calc_tax_after_discount": false,
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "amount": 0,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "person_id": "64b7f4d9e2b3b6a0b7c5d7ff"
    }
  ]
}
```

**Response**

Same response shape as [POST /sale-order/create](#post-sale-order-create).

## DELETE /sale-order/delete/{id}

Delete a sale-order

**Required permission:** `sale_order_delete` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X DELETE 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/delete/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

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

```python [Python]
import os
import requests

res = requests.request(
    "DELETE",
    "https://api.bito.uz/integration-api/integration/api/v2/sale-order/delete/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/sale-order/delete/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Path parameters**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | Yes |  |

**Request body**

No request body.

**Response**

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

## GET /sale-order/get-by-id/{id}

Get sale-order using its _id

**Required permission:** `sale_order` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/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/sale-order/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/sale-order/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/sale-order/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);
```

:::

**Path parameters**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | Yes |  |

**Request body**

No request body.

**Response**

Same response shape as [POST /sale-order/create](#post-sale-order-create).

## POST /sale-order/get-paging

Get sale-orders by paging

**Required permission:** `sale_order` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/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/sale-order/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/sale-order/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/sale-order/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);
```

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `page` | `number` | Yes | Default: `1` |
| `limit` | `number` | Yes | Default: `20` |
| `organization_id` | `string` | No |  |
| `customer_id` | `string` | No |  |
| `currency_id` | `string` | No |  |
| `states` | `string[]` | No |  |
| `search` | `string` | No |  |
| `date_from` | `string` | No |  |
| `date_to` | `string` | No |  |
| `delivery_date_from` | `string` | No |  |
| `delivery_date_to` | `string` | No |  |
| `created_from_bot` | `boolean` | No |  |
| `trade_statuses` | `string[]` | No |  |
| `visit_id` | `string` | No |  |
| `state_id` | `string` | No |  |
| `name` | `string` | No |  |

```json
{
  "page": 1,
  "limit": 20,
  "organization_id": "67b486d242ed76693cd2cc59",
  "customer_id": "67b486d242ed76693cd2cc59",
  "currency_id": "67b486d242ed76693cd2cc59",
  "states": [
    "string"
  ],
  "search": "string",
  "date_from": "2023-10-01T12:00:00Z",
  "date_to": "2023-10-01T12:00:00Z",
  "delivery_date_from": "2023-10-01T12:00:00Z",
  "delivery_date_to": "2023-10-01T12:00:00Z",
  "created_from_bot": false,
  "trade_statuses": [
    "string"
  ],
  "visit_id": "67b486d242ed76693cd2cc59",
  "state_id": "67b486d242ed76693cd2cc59",
  "name": "string"
}
```

**Response**

`data.total` is the total number of records and `data.data[]` holds the current page. The table below describes one record.

| Field | Type | Description |
|---|---|---|
| `created_at` | `string` |  |
| `updated_at` | `string` |  |
| `name` | `string` |  |
| `uuid` | `string` |  |
| `code` | `string` |  |
| `organization` | `object` |  |
| `organization._id` | `string` |  |
| `organization.name` | `string` |  |
| `customer` | `object` |  |
| `customer._id` | `string` |  |
| `customer.type` | `string` | One of: `legal`, `natural` |
| `customer.phone_number` | `string` |  |
| `customer.phone_numbers` | `string[]` |  |
| `customer.name` | `string` |  |
| `customer.image` | `string` |  |
| `customer.custom_fields` | `object[]` |  |
| `customer.custom_fields[]._id` | `string` |  |
| `customer.custom_fields[].value` | `object` |  |
| `customer_image_url` | `string` |  |
| `responsible` | `object` |  |
| `responsible._id` | `string` |  |
| `responsible.full_name` | `string` |  |
| `state_id` | `string` |  |
| `state` | `string` | One of: `new`, `draw`, `in_progress`, `canceled`, `done`, `accepted` |
| `note` | `string` |  |
| `date` | `string` |  |
| `number` | `string` |  |
| `currency_id` | `string` |  |
| `total_to_pay` | `number` |  |
| `total_price` | `number` |  |
| `total_discount` | `number` |  |
| `total_sale` | `number` |  |
| `total_amount` | `number` |  |
| `trade_status` | `string` | One of: `zero`, `partial`, `fully` |
| `created_from_bot` | `boolean` |  |
| `position` | `number` |  |
| `task` | `object` |  |
| `task.type_id` | `string` |  |
| `task.date` | `string` |  |
| `task.created_by` | `string` |  |
| `task.responsible_id` | `string` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "created_at": "string",
        "updated_at": "string",
        "name": "string",
        "uuid": "A1024",
        "code": "string",
        "organization": {
          "_id": "string",
          "name": "string"
        },
        "customer": {
          "_id": "string",
          "type": "legal",
          "phone_number": "string",
          "phone_numbers": [
            "string"
          ],
          "name": "string",
          "image": "string",
          "custom_fields": [
            {
              "_id": null,
              "value": null
            }
          ]
        },
        "customer_image_url": "string",
        "responsible": {
          "_id": "string",
          "full_name": "string"
        },
        "state_id": "67b486d242ed76693cd2cc59",
        "state": "new",
        "note": "string",
        "date": "string",
        "number": "string",
        "currency_id": "string",
        "total_to_pay": 0,
        "total_price": 0,
        "total_discount": 0,
        "total_sale": 0,
        "total_amount": 0,
        "trade_status": "zero",
        "created_from_bot": false,
        "position": 0,
        "task": {
          "type_id": "67b486d242ed76693cd2cc59",
          "date": "2023-10-01T12:00:00Z",
          "created_by": "67b486d242ed76693cd2cc59",
          "responsible_id": "67b486d242ed76693cd2cc59"
        }
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /sale-order/get-deleted

Get deleted sale-order ids

**Required permission:** `sale_order` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/get-deleted?deleted_at=DELETED_AT' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sale-order/get-deleted?deleted_at=DELETED_AT', {
  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/sale-order/get-deleted?deleted_at=DELETED_AT",
    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/sale-order/get-deleted?deleted_at=DELETED_AT');
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);
```

:::

**Query parameters**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `deleted_at` | `string` | Yes |  |

**Request body**

No request body.

**Response**

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

## PUT /sale-order/accept/{id}

Accept a sale order: move it into the first work column.

**Required permission:** `sale_order_update` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/accept/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/sale-order/accept/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
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/sale-order/accept/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/sale-order/accept/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Path parameters**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | Yes |  |

**Request body**

No request body.

**Response**

Same response shape as [POST /sale-order/create](#post-sale-order-create).

## POST /sale-order/get-by-customer/for-bot

List sale orders for a given customer, formatted for bot/external consumption.

**Required permission:** `sale_order` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/get-by-customer/for-bot' \
  -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/sale-order/get-by-customer/for-bot', {
  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/sale-order/get-by-customer/for-bot",
    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/sale-order/get-by-customer/for-bot');
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);
```

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `page` | `number` | Yes | Default: `1` |
| `limit` | `number` | Yes | Default: `20` |
| `customer_id` | `string` | No |  |
| `states` | `string[]` | No |  |
| `organization_id` | `string` | No | Organization ObjectId. |
| `name` | `any` | No |  |
| `visit_id` | `string` | No |  |
| `currency_id` | `string` | No |  |
| `created_from_bot` | `boolean` | No |  |
| `date_from` | `string (date-time)` | No | Start of the date range. |
| `date_to` | `string (date-time)` | No | End of the date range. |
| `delivery_date_from` | `string (date-time)` | No |  |
| `delivery_date_to` | `string (date-time)` | No |  |
| `trade_statuses` | `string[]` | No |  |
| `state_id` | `string` | No |  |

```json
{
  "page": 1,
  "limit": 20,
  "customer_id": "string",
  "states": [
    "new"
  ],
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "name": null,
  "visit_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "currency_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "created_from_bot": false,
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "delivery_date_from": "2025-05-01T12:00:00Z",
  "delivery_date_to": "2025-05-01T12:00:00Z",
  "trade_statuses": [
    "zero"
  ],
  "state_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}
```

**Response**

| Field | Type | Description |
|---|---|---|
| `list` | `object[]` |  |
| `list[]._id` | `string` |  |
| `list[].created_at` | `string` |  |
| `list[].updated_at` | `string` |  |
| `list[].name` | `string` |  |
| `list[].uuid` | `string` |  |
| `list[].visit_id` | `string` |  |
| `list[].code` | `string` |  |
| `list[].organization_id` | `string` |  |
| `list[].organization` | `object` |  |
| `list[].organization._id` | `string` |  |
| `list[].organization.name` | `string` |  |
| `list[].customer_id` | `string` |  |
| `list[].customer` | `object` |  |
| `list[].customer._id` | `string` |  |
| `list[].customer.type` | `string` | One of: `legal`, `natural` |
| `list[].customer.phone_number` | `string` |  |
| `list[].customer.phone_numbers` | `string[]` |  |
| `list[].customer.name` | `string` |  |
| `list[].customer.image` | `string` |  |
| `list[].customer.custom_fields` | `object[]` |  |
| `list[].customer_assistant` | `object` |  |
| `list[].customer_assistant._id` | `string` |  |
| `list[].customer_assistant.name` | `string` |  |
| `list[].customer_assistant.type` | `string` | One of: `legal`, `natural` |
| `list[].customer_assistant_hierarchy` | `object[]` |  |
| `list[].customer_assistant_hierarchy[]._id` | `string` |  |
| `list[].customer_assistant_hierarchy[].name` | `string` |  |
| `list[].customer_assistant_hierarchy[].type` | `string` | One of: `legal`, `natural` |
| `list[].customer_assistant_hierarchy[].first_name` | `string` |  |
| `list[].customer_assistant_hierarchy[].last_name` | `string` |  |
| `list[].customer_assistant_hierarchy[].middle_name` | `string` |  |
| `list[].responsible_id` | `string` |  |
| `list[].customer_image_url` | `string` |  |
| `list[].responsible` | `object` |  |
| `list[].responsible._id` | `string` |  |
| `list[].responsible.full_name` | `string` |  |
| `list[].price_id` | `string` |  |
| `list[].price` | `object` |  |
| `list[].price._id` | `string` |  |
| `list[].price.name` | `string` |  |
| `list[].price.short_name` | `string` |  |
| `list[].price.code` | `string` |  |
| `list[].state_id` | `string` |  |
| `list[].state` | `string` | One of: `new`, `draw`, `in_progress`, `canceled`, `done`, `accepted` |
| `list[].note` | `string` |  |
| `list[].date` | `string` |  |
| `list[].delivery_date` | `string` |  |
| `list[].number` | `string` |  |
| `list[].device` | `object` |  |
| `list[].device._id` | `string` |  |
| `list[].device.name` | `string` |  |
| `list[].device.device_id` | `string` |  |
| `list[].currency` | `object` |  |
| `list[].currency._id` | `string (objectId)` |  |
| `list[].currency.to_currency_id` | `string (objectId)` |  |
| `list[].currency.uuid` | `number` |  |
| `list[].currency.name` | `string` |  |
| `list[].currency.value` | `number` |  |
| `list[].currency.symbol` | `string` |  |
| `list[].currency.side` | `string` | One of: `start`, `end` |
| `list[].currency.numerator` | `number` |  |
| `list[].currency.denominator` | `number` |  |
| `list[].currency.round_type` | `string` | One of: `floor`, `ceil`, `round` |
| `list[].currency.precision` | `number` |  |
| `list[].currency_id` | `string` |  |
| `list[].total_to_pay` | `number` |  |
| `list[].total_price` | `number` |  |
| `list[].discount` | `number` |  |
| `list[].total_discount` | `number` |  |
| `list[].discounts` | `object[]` |  |
| `list[].discounts[]._id` | `string` |  |
| `list[].discounts[].name` | `string` |  |
| `list[].discounts[].value` | `number` |  |
| `list[].discounts[].apply_type` | `string` | One of: `percent`, `cash` |
| `list[].discounts[].currency_id` | `string` |  |
| `list[].products` | `object[]` |  |
| `list[].delivery_address` | `object` |  |
| `list[].delivery_address.long` | `number` |  |
| `list[].delivery_address.lat` | `number` |  |
| `list[].delivery_address.human_address` | `object` |  |
| `list[].total_sale` | `number` |  |
| `list[].total_amount` | `number` |  |
| `list[].trade_status` | `string` | One of: `zero`, `partial`, `fully` |
| `list[].trades` | `object[]` |  |
| `list[].trades[]._id` | `string` |  |
| `list[].trades[].type` | `string` | One of: `b2b`, `b2c` |
| `list[].trades[].organization_id` | `string` |  |
| `list[].trades[].state` | `string` | One of: `new`, `in_progress`, `draft`, `canceled`, `done` |
| `list[].trades[].state_id` | `string` |  |
| `list[].trades[].number` | `string` |  |
| `list[].trades[].uuid` | `number` |  |
| `list[].trades[].currency` | `object` |  |
| `list[].trades[].cashbox_id` | `string` |  |
| `list[].trades[].calc_tax_after_discount` | `boolean` |  |
| `list[].trades[].sale_settings` | `object` |  |
| `list[].trades[].total_extra_cost` | `number` |  |
| `list[].trades[].total_effected_extra_cost` | `number` |  |
| `list[].custom_fields` | `object[]` |  |
| `list[].custom_fields[]._id` | `string` |  |
| `list[].custom_fields[].value` | `string` |  |
| `total` | `number` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "list": [
      {
        "_id": "string",
        "created_at": "string",
        "updated_at": "string",
        "name": "string",
        "uuid": "A1024",
        "visit_id": "67b486d242ed76693cd2cc59",
        "code": "67b486d242ed76693cd2cc59",
        "organization_id": "67b486d242ed76693cd2cc59",
        "organization": {
          "_id": null,
          "name": null
        },
        "customer_id": "67b486d242ed76693cd2cc59",
        "customer": {
          "_id": null,
          "type": null,
          "phone_number": null,
          "phone_numbers": null,
          "name": null,
          "image": null,
          "custom_fields": null
        },
        "customer_assistant": {
          "_id": null,
          "name": null,
          "type": null
        },
        "customer_assistant_hierarchy": [],
        "responsible_id": "string",
        "customer_image_url": "string",
        "responsible": {
          "_id": null,
          "full_name": null
        },
        "price_id": "string",
        "price": {
          "_id": null,
          "name": null,
          "short_name": null,
          "code": null
        },
        "state_id": "string",
        "state": "new",
        "note": "string",
        "date": "string",
        "delivery_date": "string",
        "number": "string",
        "device": {
          "_id": null,
          "name": null,
          "device_id": null
        },
        "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
        },
        "currency_id": "string",
        "total_to_pay": 0,
        "total_price": 0,
        "discount": 0,
        "total_discount": 0,
        "discounts": [],
        "products": [],
        "delivery_address": {
          "long": null,
          "lat": null,
          "human_address": null
        },
        "total_sale": 0,
        "total_amount": 0,
        "trade_status": "zero",
        "trades": [],
        "custom_fields": []
      }
    ],
    "total": 0
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /sale-order/get-by-id/for-bot/{id}

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

**Required permission:** `sale_order` · [how permissions work](https://docs.bito.uz/en/api/permissions.md)

**Example request**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/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/sale-order/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/sale-order/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/sale-order/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);
```

:::

**Path parameters**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | Yes |  |

**Request body**

No request body.

**Response**

Same response shape as [POST /sale-order/create](#post-sale-order-create).

---

*This page is generated from the OpenAPI spec.*
