# States

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

## POST /states/get-all

Get all states

**Нужное разрешение:** нет — закрыто для приложения, объявившего разрешения · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

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

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/states/get-all' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "64e944999f719902a7ff641b",
  "type": "trades",
  "is_default": false,
  "types": [
    "trades"
  ],
  "with_item_count": false
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/states/get-all', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "64e944999f719902a7ff641b",
    "type": "trades",
    "is_default": false,
    "types": [
      "trades"
    ],
    "with_item_count": false
  }),
})
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/states/get-all",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "64e944999f719902a7ff641b",
        "type": "trades",
        "is_default": False,
        "types": [
            "trades",
        ],
        "with_item_count": False,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "organization_id": "64e944999f719902a7ff641b",
  "type": "trades",
  "is_default": false,
  "types": [
    "trades"
  ],
  "with_item_count": false
}
JSON;

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

:::

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

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `organization_id` | `string` | Нет |  |
| `type` | `string` | Нет | Допустимые значения: `trades`, `saleOrders`, `deliveryOrders`. По умолчанию: `"trades"` |
| `is_default` | `boolean` | Нет | По умолчанию: `false` |
| `types` | `string[]` | Нет |  |
| `with_item_count` | `boolean` | Нет |  |

```json
{
  "organization_id": "64e944999f719902a7ff641b",
  "type": "trades",
  "is_default": false,
  "types": [
    "trades"
  ],
  "with_item_count": false
}
```

**Ответ**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    {
      "_id": "string",
      "name": "string",
      "type": "string",
      "is_default": false,
      "default_key": "string",
      "organization_id": "string"
    }
  ],
  "time": "2025-05-01T12:00:00Z"
}
```

---

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