# States

::: 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 /states/get-all

Get all states

**Required permission:** none — closed to an app that declares permissions · [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/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);
```

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `organization_id` | `string` | No |  |
| `type` | `string` | No | One of: `trades`, `saleOrders`, `deliveryOrders`. Default: `"trades"` |
| `is_default` | `boolean` | No | Default: `false` |
| `types` | `string[]` | No |  |
| `with_item_count` | `boolean` | No |  |

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

**Response**

```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"
}
```

---

*This page is generated from the OpenAPI spec.*
