# Sale Order Bulk

Bulk sale order operations

::: 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/delete-many

Soft-delete multiple sale orders in a single call (sets is_deleted=true on each). Pass a non-empty array of ObjectIds in ids. Returns the async process record produced by the bulk operation.

**Required permission:** `sale_order_delete` · [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/delete-many' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "ids": [
    "string"
  ]
}'
```

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

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

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/sale-order/delete-many');
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 |
|---|---|---|---|
| `ids` | `string[]` | Yes | Non-empty list of sale order ObjectIds to soft-delete |

```json
{
  "ids": [
    "string"
  ]
}
```

**Response**

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

## POST /sale-order/update-status-many

Update the kanban state of multiple sale orders in a single call. Pass a non-empty array of ObjectIds in ids and the target state_id (ObjectId of the States document). Returns the async process record produced by the bulk operation.

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

An app that cancels documents should request `sale_order_cancel` as well.

**Example request**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/sale-order/update-status-many' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "ids": [
    "string"
  ],
  "state_id": "string"
}'
```

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

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

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/sale-order/update-status-many');
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 |
|---|---|---|---|
| `ids` | `string[]` | Yes | Non-empty list of sale order ObjectIds whose status will be updated |
| `state_id` | `string` | Yes | ObjectId of the target States document (kanban column) to move the sale orders into |

```json
{
  "ids": [
    "string"
  ],
  "state_id": "string"
}
```

**Response**

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

---

*This page is generated from the OpenAPI spec.*
