# Internal transfer

Stock transfers between warehouses of one organization

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

## POST /internal-transfer/create

Create a new internal transfer between warehouses or production steps.

**Нужное разрешение:** `internal_transfer_create` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

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

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "source_organization_id": "string",
  "type": "w2w",
  "date": "2025-05-01T12:00:00Z",
  "shipping_date": "2025-05-01T12:00:00Z",
  "sender_employee_id": "string",
  "reason_id": "string",
  "products": [
    {
      "product_id": "string",
      "amount": 0,
      "box_count": 0,
      "box_item": 0,
      "marks": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "extra_costs": [],
      "used_measure": {
        "ratio": null,
        "_id": null,
        "amount": null
      }
    }
  ],
  "state": "new"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_organization_id": "string",
    "type": "w2w",
    "date": "2025-05-01T12:00:00Z",
    "shipping_date": "2025-05-01T12:00:00Z",
    "sender_employee_id": "string",
    "reason_id": "string",
    "products": [
      {
        "product_id": "string",
        "amount": 0,
        "box_count": 0,
        "box_item": 0,
        "marks": [],
        "expiration_date": "2025-05-01T12:00:00Z",
        "extra_costs": [],
        "used_measure": {
          "ratio": null,
          "_id": null,
          "amount": null
        }
      }
    ],
    "state": "new"
  }),
})
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/internal-transfer/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "source_organization_id": "string",
        "type": "w2w",
        "date": "2025-05-01T12:00:00Z",
        "shipping_date": "2025-05-01T12:00:00Z",
        "sender_employee_id": "string",
        "reason_id": "string",
        "products": [
            {
                "product_id": "string",
                "amount": 0,
                "box_count": 0,
                "box_item": 0,
                "marks": [],
                "expiration_date": "2025-05-01T12:00:00Z",
                "extra_costs": [],
                "used_measure": {
                    "ratio": None,
                    "_id": None,
                    "amount": None,
                },
            },
        ],
        "state": "new",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "source_organization_id": "string",
  "type": "w2w",
  "date": "2025-05-01T12:00:00Z",
  "shipping_date": "2025-05-01T12:00:00Z",
  "sender_employee_id": "string",
  "reason_id": "string",
  "products": [
    {
      "product_id": "string",
      "amount": 0,
      "box_count": 0,
      "box_item": 0,
      "marks": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "extra_costs": [],
      "used_measure": {
        "ratio": null,
        "_id": null,
        "amount": null
      }
    }
  ],
  "state": "new"
}
JSON;

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

:::

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

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `code` | `string` | Нет | Optional human-readable reference code |
| `request_id` | `string` | Нет | Linked transfer-request ObjectId (optional) |
| `source_organization_id` | `string` | Да | Organization ObjectId that owns this transfer |
| `type` | `string` | Да | Transfer type: w2w=warehouse-to-warehouse, w2p=warehouse-to-production, p2w=production-to-warehouse, p2p=production-to-production, o2o=organization-to-organization. Допустимые значения: `w2w`, `w2p`, `p2w`, `p2p`, `o2o` |
| `date` | `string (date-time)` | Да | Transfer document date (ISO 8601) |
| `shipping_date` | `string (date-time)` | Да | Planned shipping date (ISO 8601) |
| `sender_warehouse_id` | `string` | Нет | Source warehouse ObjectId. Required when type is w2w or w2p. |
| `receiver_warehouse_id` | `string` | Нет | Destination warehouse ObjectId. Required when type is p2w or w2w. |
| `sender_employee_id` | `string` | Да | Employee ObjectId responsible for sending |
| `receiver_employee_id` | `string` | Нет | Employee ObjectId responsible for receiving (optional) |
| `reason_id` | `string` | Да | Transfer reason ObjectId |
| `price_id` | `string` | Нет | Price list ObjectId (optional) |
| `note` | `string` | Нет | Free-text note (optional) |
| `products` | `object[]` | Да | List of products to transfer (at least one required) |
| `products[].product_id` | `string` | Да | Product ObjectId |
| `products[].amount` | `number` | Да | Transfer quantity (must be positive) |
| `products[].box_count` | `number` | Нет | Number of boxes (integer, defaults to 0) |
| `products[].box_item` | `number` | Нет | Items per box (optional) |
| `products[].marks` | `string[]` | Нет | Serial / excise mark codes for marked goods |
| `products[].expiration_date` | `string (date-time)` | Нет | Expiration date (ISO 8601) for perishable items |
| `products[].extra_costs` | `object[]` | Нет | Per-product extra cost allocations |
| `products[].used_measure` | `object` | Нет | Override measure ratio if different from the product default |
| `products[].used_measure.ratio` | `number` | Да |  |
| `products[].used_measure._id` | `string` | Да |  |
| `products[].used_measure.amount` | `number` | Да |  |
| `additional_costs` | `object[]` | Нет | Additional costs applied to the whole transfer (defaults to []) |
| `attachments` | `object[]` | Нет | File attachments (optional) |
| `attachments[].name` | `string` | Нет |  |
| `attachments[].path` | `string` | Да |  |
| `attachments[].size` | `number` | Нет |  |
| `attachments[].note` | `string` | Нет |  |
| `state` | `string` | Да | Допустимые значения: `new`, `accepted`, `in_progress`, `done`, `canceled` |

```json
{
  "code": "string",
  "request_id": "string",
  "source_organization_id": "string",
  "type": "w2w",
  "date": "2025-05-01T12:00:00Z",
  "shipping_date": "2025-05-01T12:00:00Z",
  "sender_warehouse_id": "string",
  "receiver_warehouse_id": "string",
  "sender_employee_id": "string",
  "receiver_employee_id": "string",
  "reason_id": "string",
  "price_id": "string",
  "note": "string",
  "products": [
    {
      "product_id": "string",
      "amount": 0,
      "box_count": 0,
      "box_item": 0,
      "marks": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "extra_costs": [],
      "used_measure": {
        "ratio": null,
        "_id": null,
        "amount": null
      }
    }
  ],
  "additional_costs": [
    {}
  ],
  "attachments": [
    {
      "name": "string",
      "path": "string",
      "size": 0,
      "note": "string"
    }
  ],
  "state": "new"
}
```

**Ответ**

| Поле | Тип | Описание |
|---|---|---|
| `code` | `string` | Optional human-readable reference code |
| `request_id` | `string` | Linked transfer-request ObjectId (optional) |
| `source_organization_id` | `string` | Organization ObjectId that owns this transfer |
| `type` | `string` | Transfer type: w2w=warehouse-to-warehouse, w2p=warehouse-to-production, p2w=production-to-warehouse, p2p=production-to-production, o2o=organization-to-organization. Допустимые значения: `w2w`, `w2p`, `p2w`, `p2p`, `o2o` |
| `date` | `string (date-time)` | Transfer document date (ISO 8601) |
| `shipping_date` | `string (date-time)` | Planned shipping date (ISO 8601) |
| `sender_warehouse_id` | `string` | Source warehouse ObjectId. Required when type is w2w or w2p. |
| `receiver_warehouse_id` | `string` | Destination warehouse ObjectId. Required when type is p2w or w2w. |
| `sender_employee_id` | `string` | Employee ObjectId responsible for sending |
| `receiver_employee_id` | `string` | Employee ObjectId responsible for receiving (optional) |
| `reason_id` | `string` | Transfer reason ObjectId |
| `price_id` | `string` | Price list ObjectId (optional) |
| `note` | `string` | Free-text note (optional) |
| `products` | `object[]` | List of products to transfer (at least one required) |
| `products[].product_id` | `string` | Product ObjectId |
| `products[].amount` | `number` | Transfer quantity (must be positive) |
| `products[].box_count` | `number` | Number of boxes (integer, defaults to 0) |
| `products[].box_item` | `number` | Items per box (optional) |
| `products[].marks` | `string[]` | Serial / excise mark codes for marked goods |
| `products[].expiration_date` | `string (date-time)` | Expiration date (ISO 8601) for perishable items |
| `products[].extra_costs` | `object[]` | Per-product extra cost allocations |
| `products[].used_measure` | `object` | Override measure ratio if different from the product default |
| `products[].used_measure.measure_id` | `string` |  |
| `products[].used_measure.ratio` | `number` |  |
| `additional_costs` | `object[]` | Additional costs applied to the whole transfer (defaults to []) |
| `attachments` | `object[]` | File attachments (optional) |
| `attachments[].name` | `string` |  |
| `attachments[].url` | `string` |  |
| `_id` | `string` | Internal transfer ObjectId |
| `status` | `string` | Current transfer state. Допустимые значения: `draft`, `new`, `accepted`, `in_progress`, `done`, `canceled` |
| `state_id` | `string` | Custom kanban state ObjectId (when a custom pipeline column is used) |
| `is_deleted` | `boolean` | Soft-delete flag |
| `created_at` | `string (date-time)` | Creation timestamp (ISO 8601) |
| `updated_at` | `string (date-time)` | Last update timestamp (ISO 8601) |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "code": "string",
    "request_id": "string",
    "source_organization_id": "string",
    "type": "w2w",
    "date": "2025-05-01T12:00:00Z",
    "shipping_date": "2025-05-01T12:00:00Z",
    "sender_warehouse_id": "string",
    "receiver_warehouse_id": "string",
    "sender_employee_id": "string",
    "receiver_employee_id": "string",
    "reason_id": "string",
    "price_id": "string",
    "note": "string",
    "products": [
      {
        "product_id": "string",
        "amount": 0,
        "box_count": 0,
        "box_item": 0,
        "marks": [],
        "expiration_date": "2025-05-01T12:00:00Z",
        "extra_costs": [],
        "used_measure": {
          "measure_id": null,
          "ratio": null
        }
      }
    ],
    "additional_costs": [
      {}
    ],
    "attachments": [
      {
        "name": "string",
        "url": "string"
      }
    ],
    "_id": "string",
    "status": "draft",
    "state_id": "string",
    "is_deleted": false,
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z"
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /internal-transfer/get-by-id/{id}

Fetch a single internal transfer by ObjectId.

**Нужное разрешение:** `internal_transfer` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

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

::: code-group

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

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да | Internal-transfer ObjectId |

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

Тело запроса не требуется.

**Ответ**

Структура ответа совпадает с [POST /internal-transfer/create](#post-internal-transfer-create).

## POST /internal-transfer/get-paging

Paginated list of internal transfers, filterable by organization, warehouse, state, and reason.

**Нужное разрешение:** `internal_transfer` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

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

::: code-group

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

:::

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

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `page` | `number` | Да | По умолчанию: `1` |
| `limit` | `number` | Да | По умолчанию: `20` |
| `source_organization_id` | `string` | Нет | Filter by source organization ObjectId |
| `sender_warehouse_id` | `string` | Нет | Filter by sender warehouse ObjectId |
| `receiver_warehouse_id` | `string` | Нет | Filter by receiver warehouse ObjectId |
| `states` | `string[]` | Нет | Filter by one or more transfer states |
| `reason_id` | `string` | Нет | Filter by transfer reason ObjectId |
| `search` | `string` | Нет | Free-text search. |
| `date_from` | `string (date-time)` | Нет | Start of the date range. |
| `date_to` | `string (date-time)` | Нет | End of the date range. |
| `state_id` | `string` | Нет |  |
| `updated_at` | `string (date-time)` | Нет | Only records updated at or after this time. |
| `organization_id` | `string` | Нет | Organization ObjectId. |

```json
{
  "page": 1,
  "limit": 20,
  "source_organization_id": "string",
  "sender_warehouse_id": "string",
  "receiver_warehouse_id": "string",
  "states": [
    "draft"
  ],
  "reason_id": "string",
  "search": "string",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "state_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "updated_at": "2025-05-01T12:00:00Z",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}
```

**Ответ**

| Поле | Тип | Описание |
|---|---|---|
| `total` | `number` |  |
| `list` | `object[]` |  |
| `list[].code` | `string` | Optional human-readable reference code |
| `list[].request_id` | `string` | Linked transfer-request ObjectId (optional) |
| `list[].source_organization_id` | `string` | Organization ObjectId that owns this transfer |
| `list[].type` | `string` | Transfer type: w2w=warehouse-to-warehouse, w2p=warehouse-to-production, p2w=production-to-warehouse, p2p=production-to-production, o2o=organization-to-organization. Допустимые значения: `w2w`, `w2p`, `p2w`, `p2p`, `o2o` |
| `list[].date` | `string (date-time)` | Transfer document date (ISO 8601) |
| `list[].shipping_date` | `string (date-time)` | Planned shipping date (ISO 8601) |
| `list[].sender_warehouse_id` | `string` | Source warehouse ObjectId. Required when type is w2w or w2p. |
| `list[].receiver_warehouse_id` | `string` | Destination warehouse ObjectId. Required when type is p2w or w2w. |
| `list[].sender_employee_id` | `string` | Employee ObjectId responsible for sending |
| `list[].receiver_employee_id` | `string` | Employee ObjectId responsible for receiving (optional) |
| `list[].reason_id` | `string` | Transfer reason ObjectId |
| `list[].price_id` | `string` | Price list ObjectId (optional) |
| `list[].note` | `string` | Free-text note (optional) |
| `list[].products` | `object[]` | List of products to transfer (at least one required) |
| `list[].products[].product_id` | `string` | Product ObjectId |
| `list[].products[].amount` | `number` | Transfer quantity (must be positive) |
| `list[].products[].box_count` | `number` | Number of boxes (integer, defaults to 0) |
| `list[].products[].box_item` | `number` | Items per box (optional) |
| `list[].products[].marks` | `string[]` | Serial / excise mark codes for marked goods |
| `list[].products[].expiration_date` | `string (date-time)` | Expiration date (ISO 8601) for perishable items |
| `list[].products[].extra_costs` | `object[]` | Per-product extra cost allocations |
| `list[].products[].used_measure` | `object` | Override measure ratio if different from the product default |
| `list[].additional_costs` | `object[]` | Additional costs applied to the whole transfer (defaults to []) |
| `list[].attachments` | `object[]` | File attachments (optional) |
| `list[].attachments[].name` | `string` |  |
| `list[].attachments[].url` | `string` |  |
| `list[]._id` | `string` | Internal transfer ObjectId |
| `list[].status` | `string` | Current transfer state. Допустимые значения: `draft`, `new`, `accepted`, `in_progress`, `done`, `canceled` |
| `list[].state_id` | `string` | Custom kanban state ObjectId (when a custom pipeline column is used) |
| `list[].is_deleted` | `boolean` | Soft-delete flag |
| `list[].created_at` | `string (date-time)` | Creation timestamp (ISO 8601) |
| `list[].updated_at` | `string (date-time)` | Last update timestamp (ISO 8601) |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "code": "string",
        "request_id": "string",
        "source_organization_id": "string",
        "type": "w2w",
        "date": "2025-05-01T12:00:00Z",
        "shipping_date": "2025-05-01T12:00:00Z",
        "sender_warehouse_id": "string",
        "receiver_warehouse_id": "string",
        "sender_employee_id": "string",
        "receiver_employee_id": "string",
        "reason_id": "string",
        "price_id": "string",
        "note": "string",
        "products": [],
        "additional_costs": [],
        "attachments": [],
        "_id": "string",
        "status": "draft",
        "state_id": "string",
        "is_deleted": false,
        "created_at": "2025-05-01T12:00:00Z",
        "updated_at": "2025-05-01T12:00:00Z"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /internal-transfer/update/{id}

Update an existing internal transfer. Only transfers in NEW or DRAFT state may be updated.

**Нужное разрешение:** `internal_transfer_update` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

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

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/update/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "source_organization_id": "string",
  "type": "w2w",
  "date": "2025-05-01T12:00:00Z",
  "shipping_date": "2025-05-01T12:00:00Z",
  "sender_employee_id": "string",
  "reason_id": "string",
  "products": [
    {
      "product_id": "string",
      "amount": 0,
      "box_count": 0,
      "box_item": 0,
      "marks": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "extra_costs": [],
      "used_measure": {
        "ratio": null,
        "_id": null,
        "amount": null
      }
    }
  ]
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/update/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_organization_id": "string",
    "type": "w2w",
    "date": "2025-05-01T12:00:00Z",
    "shipping_date": "2025-05-01T12:00:00Z",
    "sender_employee_id": "string",
    "reason_id": "string",
    "products": [
      {
        "product_id": "string",
        "amount": 0,
        "box_count": 0,
        "box_item": 0,
        "marks": [],
        "expiration_date": "2025-05-01T12:00:00Z",
        "extra_costs": [],
        "used_measure": {
          "ratio": null,
          "_id": null,
          "amount": null
        }
      }
    ]
  }),
})
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/internal-transfer/update/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "source_organization_id": "string",
        "type": "w2w",
        "date": "2025-05-01T12:00:00Z",
        "shipping_date": "2025-05-01T12:00:00Z",
        "sender_employee_id": "string",
        "reason_id": "string",
        "products": [
            {
                "product_id": "string",
                "amount": 0,
                "box_count": 0,
                "box_item": 0,
                "marks": [],
                "expiration_date": "2025-05-01T12:00:00Z",
                "extra_costs": [],
                "used_measure": {
                    "ratio": None,
                    "_id": None,
                    "amount": None,
                },
            },
        ],
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "source_organization_id": "string",
  "type": "w2w",
  "date": "2025-05-01T12:00:00Z",
  "shipping_date": "2025-05-01T12:00:00Z",
  "sender_employee_id": "string",
  "reason_id": "string",
  "products": [
    {
      "product_id": "string",
      "amount": 0,
      "box_count": 0,
      "box_item": 0,
      "marks": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "extra_costs": [],
      "used_measure": {
        "ratio": null,
        "_id": null,
        "amount": null
      }
    }
  ]
}
JSON;

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

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да | Internal-transfer ObjectId |

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

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `code` | `string` | Нет | Optional human-readable reference code |
| `request_id` | `string` | Нет | Linked transfer-request ObjectId (optional) |
| `source_organization_id` | `string` | Да | Organization ObjectId that owns this transfer |
| `type` | `string` | Да | Transfer type: w2w=warehouse-to-warehouse, w2p=warehouse-to-production, p2w=production-to-warehouse, p2p=production-to-production, o2o=organization-to-organization. Допустимые значения: `w2w`, `w2p`, `p2w`, `p2p`, `o2o` |
| `date` | `string (date-time)` | Да | Transfer document date (ISO 8601) |
| `shipping_date` | `string (date-time)` | Да | Planned shipping date (ISO 8601) |
| `sender_warehouse_id` | `string` | Нет | Source warehouse ObjectId. Required when type is w2w or w2p. |
| `receiver_warehouse_id` | `string` | Нет | Destination warehouse ObjectId. Required when type is p2w or w2w. |
| `sender_employee_id` | `string` | Да | Employee ObjectId responsible for sending |
| `receiver_employee_id` | `string` | Нет | Employee ObjectId responsible for receiving (optional) |
| `reason_id` | `string` | Да | Transfer reason ObjectId |
| `price_id` | `string` | Нет | Price list ObjectId (optional) |
| `note` | `string` | Нет | Free-text note (optional) |
| `products` | `object[]` | Да | List of products to transfer (at least one required) |
| `products[].product_id` | `string` | Да | Product ObjectId |
| `products[].amount` | `number` | Да | Transfer quantity (must be positive) |
| `products[].box_count` | `number` | Нет | Number of boxes (integer, defaults to 0) |
| `products[].box_item` | `number` | Нет | Items per box (optional) |
| `products[].marks` | `string[]` | Нет | Serial / excise mark codes for marked goods |
| `products[].expiration_date` | `string (date-time)` | Нет | Expiration date (ISO 8601) for perishable items |
| `products[].extra_costs` | `object[]` | Нет | Per-product extra cost allocations |
| `products[].used_measure` | `object` | Нет | Override measure ratio if different from the product default |
| `products[].used_measure.ratio` | `number` | Да |  |
| `products[].used_measure._id` | `string` | Да |  |
| `products[].used_measure.amount` | `number` | Да |  |
| `additional_costs` | `object[]` | Нет | Additional costs applied to the whole transfer (defaults to []) |
| `attachments` | `object[]` | Нет | File attachments (optional) |
| `attachments[].name` | `string` | Нет |  |
| `attachments[].path` | `string` | Да |  |
| `attachments[].size` | `number` | Нет |  |
| `attachments[].note` | `string` | Нет |  |

```json
{
  "code": "string",
  "request_id": "string",
  "source_organization_id": "string",
  "type": "w2w",
  "date": "2025-05-01T12:00:00Z",
  "shipping_date": "2025-05-01T12:00:00Z",
  "sender_warehouse_id": "string",
  "receiver_warehouse_id": "string",
  "sender_employee_id": "string",
  "receiver_employee_id": "string",
  "reason_id": "string",
  "price_id": "string",
  "note": "string",
  "products": [
    {
      "product_id": "string",
      "amount": 0,
      "box_count": 0,
      "box_item": 0,
      "marks": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "extra_costs": [],
      "used_measure": {
        "ratio": null,
        "_id": null,
        "amount": null
      }
    }
  ],
  "additional_costs": [
    {}
  ],
  "attachments": [
    {
      "name": "string",
      "path": "string",
      "size": 0,
      "note": "string"
    }
  ]
}
```

**Ответ**

Структура ответа совпадает с [POST /internal-transfer/create](#post-internal-transfer-create).

## PUT /internal-transfer/set-status/{id}

Drive a state transition on an internal transfer. Valid transitions: new→draft|canceled|accepted; draft→new; accepted→in_progress|canceled; in_progress→canceled; done→canceled.

**Нужное разрешение:** `internal_transfer_update` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

Приложению, которое отменяет документ, стоит запросить и `internal_transfer_cancel`.

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

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/set-status/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "status": "draft"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/set-status/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "status": "draft"
  }),
})
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/internal-transfer/set-status/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "status": "draft",
    },
)
print(res.json())
```

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

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/set-status/6712f0a9c4d1e87b3a0f9911');
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);
```

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да | Internal-transfer ObjectId |

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

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `status` | `string` | Да | Target state. Valid transitions: new→draft\|canceled\|accepted; draft→new; accepted→in_progress\|canceled; in_progress→canceled; done→canceled.. Допустимые значения: `draft`, `new`, `accepted`, `in_progress`, `done`, `canceled` |

```json
{
  "status": "draft"
}
```

**Ответ**

Структура ответа совпадает с [POST /internal-transfer/create](#post-internal-transfer-create).

## PUT /internal-transfer/receive/{id}

Post stock for an accepted transfer, marking it DONE. Transfer must be in ACCEPTED or IN_PROGRESS state.

**Нужное разрешение:** `internal_transfer_update` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

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

::: code-group

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

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/internal-transfer/receive/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/internal-transfer/receive/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/internal-transfer/receive/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);
```

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да | Internal-transfer ObjectId |

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

Тело запроса не требуется.

**Ответ**

Структура ответа совпадает с [POST /internal-transfer/create](#post-internal-transfer-create).

---

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