# States

::: info
Har bir javob umumiy konvertda qaytadi — `code`, `message`, `messages`, `status_code`, `time` — foydali yuk esa `data` ichida. Quyidagi jadvallar faqat `data` ichini tavsiflaydi.
:::

## POST /states/get-all

Get all states

**Kerakli ruxsat:** yo‘q — ruxsat e’lon qilgan ilova uchun yopiq · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: 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);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `organization_id` | `string` | Yo‘q |  |
| `type` | `string` | Yo‘q | Mumkin qiymatlar: `trades`, `saleOrders`, `deliveryOrders`. Standart: `"trades"` |
| `is_default` | `boolean` | Yo‘q | Standart: `false` |
| `types` | `string[]` | Yo‘q |  |
| `with_item_count` | `boolean` | Yo‘q |  |

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

**Javob**

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

---

*Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.*
