# Production operation

::: 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 /production-operation/create

This method allows adding production-operation into the account.

**Required permission:** `production_operation_create` · [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/production-operation/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "items": [
    {
      "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "type": "produced",
      "cost_percentage": 10,
      "extra_costs": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      },
      "consumption_type": "variable"
    }
  ],
  "organization_id": "string",
  "used_warehouse_id": "string",
  "produced_warehouse_id": "string",
  "used_date": "2024-07-20T10:30:00Z",
  "produced_date": "2024-07-20T10:30:00Z",
  "currency_id": "string",
  "responsible_id": "string"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-operation/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "items": [
      {
        "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "amount": 10,
        "type": "produced",
        "cost_percentage": 10,
        "extra_costs": [],
        "expiration_date": "2025-05-01T12:00:00Z",
        "used_measure": {
          "_id": null,
          "ratio": null,
          "amount": null
        },
        "consumption_type": "variable"
      }
    ],
    "organization_id": "string",
    "used_warehouse_id": "string",
    "produced_warehouse_id": "string",
    "used_date": "2024-07-20T10:30:00Z",
    "produced_date": "2024-07-20T10:30:00Z",
    "currency_id": "string",
    "responsible_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/production-operation/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "items": [
            {
                "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "amount": 10,
                "type": "produced",
                "cost_percentage": 10,
                "extra_costs": [],
                "expiration_date": "2025-05-01T12:00:00Z",
                "used_measure": {
                    "_id": None,
                    "ratio": None,
                    "amount": None,
                },
                "consumption_type": "variable",
            },
        ],
        "organization_id": "string",
        "used_warehouse_id": "string",
        "produced_warehouse_id": "string",
        "used_date": "2024-07-20T10:30:00Z",
        "produced_date": "2024-07-20T10:30:00Z",
        "currency_id": "string",
        "responsible_id": "string",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "items": [
    {
      "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "type": "produced",
      "cost_percentage": 10,
      "extra_costs": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      },
      "consumption_type": "variable"
    }
  ],
  "organization_id": "string",
  "used_warehouse_id": "string",
  "produced_warehouse_id": "string",
  "used_date": "2024-07-20T10:30:00Z",
  "produced_date": "2024-07-20T10:30:00Z",
  "currency_id": "string",
  "responsible_id": "string"
}
JSON;

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

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `items` | `object[]` | Yes | list of materials of product. required if is_compound is true |
| `items[].product_id` | `string` | Yes |  |
| `items[].amount` | `number` | No |  |
| `items[].type` | `string` | Yes | One of: `used`, `produced` |
| `items[].cost_percentage` | `number` | No | Required when `type` is `produced`. |
| `items[].extra_costs` | `object[]` | No |  |
| `items[].extra_costs[].cost_id` | `string` | Yes |  |
| `items[].extra_costs[].amount` | `number` | Yes |  |
| `items[].extra_costs[].index` | `number` | No |  |
| `items[].expiration_date` | `string (date-time)` | No |  |
| `items[].used_measure` | `object` | No |  |
| `items[].used_measure._id` | `string` | Yes |  |
| `items[].used_measure.ratio` | `number` | Yes |  |
| `items[].used_measure.amount` | `number` | Yes |  |
| `items[].consumption_type` | `string` | No | One of: `variable`, `fixed` |
| `code` | `string` | No |  |
| `note` | `string` | No |  |
| `state` | `string` | No | One of: `canceled`, `new`, `done`, `in_progress` |
| `organization_id` | `string` | Yes |  |
| `responsible_id` | `string` | Yes |  |
| `used_warehouse_id` | `string` | Yes |  |
| `used_date` | `string (date-time)` | Yes |  |
| `produced_warehouse_id` | `string` | Yes |  |
| `produced_date` | `string (date-time)` | Yes |  |
| `currency_id` | `string` | Yes |  |
| `route_sheet_id` | `string` | No |  |
| `amount` | `number` | No | Default: `0` |
| `create_reminder` | `boolean` | No | Default: `false` |
| `additional_costs` | `object[]` | No |  |
| `additional_costs[].cost_id` | `string` | Yes |  |
| `additional_costs[].amount` | `number` | Yes |  |
| `additional_costs[].customer_id` | `string` | No |  |
| `additional_costs[].supplier_id` | `string` | No |  |
| `additional_costs[].employee_id` | `string` | No |  |
| `additional_costs[].person_id` | `string` | No |  |
| `additional_costs[].consumption_type` | `string` | No | One of: `variable`, `fixed` |

```json
{
  "items": [
    {
      "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "type": "produced",
      "cost_percentage": 10,
      "extra_costs": [],
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      },
      "consumption_type": "variable"
    }
  ],
  "code": "string",
  "note": "string",
  "state": "canceled",
  "organization_id": "string",
  "responsible_id": "string",
  "used_warehouse_id": "string",
  "used_date": "2024-07-20T10:30:00Z",
  "produced_warehouse_id": "string",
  "produced_date": "2024-07-20T10:30:00Z",
  "currency_id": "string",
  "route_sheet_id": "string",
  "amount": 0,
  "create_reminder": false,
  "additional_costs": [
    {
      "cost_id": "string",
      "amount": 0,
      "customer_id": "string",
      "supplier_id": "string",
      "employee_id": "string",
      "person_id": "string",
      "consumption_type": "variable"
    }
  ]
}
```

**Response**

| Field | Type | Description |
|---|---|---|
| `_id` | `string` |  |
| `product` | `object` |  |
| `product._id` | `string` |  |
| `product.name` | `string` |  |
| `product.box_item` | `number` |  |
| `product.barcode` | `string` |  |
| `product.barcodes` | `object[]` |  |
| `product.barcodes[]._id` | `string` |  |
| `product.barcodes[].is_active` | `boolean` |  |
| `product.barcodes[].barcode` | `string` |  |
| `product.measure` | `object` |  |
| `product.measure._id` | `string` |  |
| `product.measure.name` | `string` |  |
| `product.measure.code` | `string` |  |
| `product.measure.short_name` | `string` |  |
| `product.measure.decimal_count` | `integer` |  |
| `product.measure.system_code` | `string` |  |
| `product.dimension` | `object` |  |
| `product.dimension.shape` | `string` | One of: `circular`, `rectangular`, `other` |
| `product.dimension.netto_weight` | `number` |  |
| `product.dimension.gross_weight` | `number` |  |
| `product.dimension.height` | `number` |  |
| `product.dimension.volume` | `number` |  |
| `product.dimension.diameter` | `number` |  |
| `product.dimension.width` | `number` |  |
| `product.dimension.length` | `number` |  |
| `product.is_material` | `boolean` |  |
| `product.is_product` | `boolean` |  |
| `product.is_semi_product` | `boolean` |  |
| `product.is_variant` | `boolean` |  |
| `product.sku` | `string` |  |
| `type` | `string` |  |
| `amount` | `number` |  |
| `marks` | `string[]` |  |
| `warehouse_amount` | `number` |  |
| `total_cost` | `number` |  |
| `total_expense` | `number` |  |
| `extra_costs` | `object[]` |  |
| `cost_percentage` | `number` |  |
| `used_warehouse` | `object` |  |
| `used_warehouse._id` | `string` |  |
| `used_warehouse.name` | `string` |  |
| `produced_warehouse` | `object` |  |
| `produced_warehouse._id` | `string` |  |
| `produced_warehouse.name` | `string` |  |
| `organization` | `object` |  |
| `organization._id` | `string` |  |
| `organization.name` | `string` |  |
| `currency` | `object` |  |
| `currency._id` | `string` |  |
| `currency.name` | `string` |  |
| `currency_id` | `string` |  |
| `items` | `object[]` |  |
| `state` | `string` |  |
| `is_overused` | `boolean` |  |
| `code` | `string` |  |
| `total_produced` | `number` |  |
| `total_used` | `number` |  |
| `number` | `string` |  |
| `produced_date` | `string (date-time)` |  |
| `total_used:` | `number` |  |
| `used_date` | `string (date-time)` |  |
| `additional_costs` | `object[]` |  |
| `additional_costs[]._id` | `string` |  |
| `additional_costs[].cost_id` | `string` |  |
| `additional_costs[].amount` | `number` |  |
| `additional_costs[].customer_id` | `string` |  |
| `additional_costs[].employee_id` | `string` |  |
| `additional_costs[].supplier_id` | `string` |  |
| `additional_costs[].person_id` | `string` |  |
| `created_at` | `string (date-time)` |  |
| `created_by` | `object` |  |
| `created_by._id` | `string` |  |
| `created_by.full_name` | `string` |  |
| `route_sheet` | `object` |  |
| `route_sheet._id` | `string` |  |
| `route_sheet.name` | `string` |  |
| `route_sheet.code` | `string` |  |
| `responsible` | `object` |  |
| `responsible._id` | `string` |  |
| `responsible.full_name` | `string` |  |
| `responsible.phone_number` | `string` |  |
| `note` | `string` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "product": {
      "_id": "string",
      "name": "string",
      "box_item": 0,
      "barcode": "string",
      "barcodes": [
        {
          "_id": null,
          "is_active": null,
          "barcode": null
        }
      ],
      "measure": {
        "_id": "string",
        "name": "string",
        "code": "string",
        "short_name": "string",
        "decimal_count": 0,
        "system_code": "string"
      },
      "dimension": {
        "shape": "circular",
        "netto_weight": 0,
        "gross_weight": 0,
        "height": 0,
        "volume": 0,
        "diameter": 0,
        "width": 0,
        "length": 0
      },
      "is_material": false,
      "is_product": false,
      "is_semi_product": false,
      "is_variant": false,
      "sku": "string"
    },
    "type": "string",
    "amount": 0,
    "marks": [
      "string"
    ],
    "warehouse_amount": 0,
    "total_cost": 0,
    "total_expense": 0,
    "extra_costs": [
      {}
    ],
    "cost_percentage": 0,
    "used_warehouse": {
      "_id": "string",
      "name": "string"
    },
    "produced_warehouse": {
      "_id": "string",
      "name": "string"
    },
    "organization": {
      "_id": "string",
      "name": "string"
    },
    "currency": {
      "_id": "string",
      "name": "string"
    },
    "currency_id": "string",
    "items": [
      {}
    ],
    "state": "string",
    "is_overused": false,
    "code": "string",
    "total_produced": 0,
    "total_used": 0,
    "number": "string",
    "produced_date": "2025-05-01T12:00:00Z",
    "total_used:": 0,
    "used_date": "2025-05-01T12:00:00Z",
    "additional_costs": [
      {
        "_id": "string",
        "cost_id": "string",
        "amount": 0,
        "customer_id": "string",
        "employee_id": "string",
        "supplier_id": "string",
        "person_id": "string"
      }
    ],
    "created_at": "2025-05-01T12:00:00Z",
    "created_by": {
      "_id": "string",
      "full_name": "string"
    },
    "route_sheet": {
      "_id": "string",
      "name": "string",
      "code": "string"
    },
    "responsible": {
      "_id": "string",
      "full_name": "string",
      "phone_number": "string"
    },
    "note": "string"
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /production-operation/update

This method allows updating production-operation in the account.

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

**Example request**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/production-operation/update' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "items": [
    {
      "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "type": "produced",
      "cost_percentage": 10,
      "extra_costs": [],
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      },
      "consumption_type": "variable"
    }
  ],
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-operation/update', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "items": [
      {
        "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "amount": 10,
        "type": "produced",
        "cost_percentage": 10,
        "extra_costs": [],
        "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
        "expiration_date": "2025-05-01T12:00:00Z",
        "used_measure": {
          "_id": null,
          "ratio": null,
          "amount": null
        },
        "consumption_type": "variable"
      }
    ],
    "_id": "64b7f4d9e2b3b6a0b7c5d80a"
  }),
})
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/production-operation/update",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "items": [
            {
                "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "amount": 10,
                "type": "produced",
                "cost_percentage": 10,
                "extra_costs": [],
                "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
                "expiration_date": "2025-05-01T12:00:00Z",
                "used_measure": {
                    "_id": None,
                    "ratio": None,
                    "amount": None,
                },
                "consumption_type": "variable",
            },
        ],
        "_id": "64b7f4d9e2b3b6a0b7c5d80a",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "items": [
    {
      "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "type": "produced",
      "cost_percentage": 10,
      "extra_costs": [],
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      },
      "consumption_type": "variable"
    }
  ],
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

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

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `_id` | `string` | Yes |  |
| `items` | `object[]` | Yes | list of materials of product. required if is_compound is true |
| `items[].product_id` | `string` | No |  |
| `items[].amount` | `number` | No |  |
| `items[].type` | `string` | No | One of: `used`, `produced` |
| `items[].cost_percentage` | `number` | No | Required when `type` is `produced`. |
| `items[].extra_costs` | `object[]` | No |  |
| `items[].extra_costs[].cost_id` | `string` | Yes |  |
| `items[].extra_costs[].amount` | `number` | Yes |  |
| `items[].extra_costs[].index` | `number` | No |  |
| `items[]._id` | `string` | No |  |
| `items[].expiration_date` | `string (date-time)` | No |  |
| `items[].used_measure` | `object` | No |  |
| `items[].used_measure._id` | `string` | Yes |  |
| `items[].used_measure.ratio` | `number` | Yes |  |
| `items[].used_measure.amount` | `number` | Yes |  |
| `items[].consumption_type` | `string` | No | One of: `variable`, `fixed` |
| `code` | `string` | No |  |
| `note` | `string` | No |  |
| `organization_id` | `string` | No |  |
| `responsible_id` | `string` | No |  |
| `used_warehouse_id` | `string` | No |  |
| `used_date` | `string (date-time)` | No |  |
| `produced_warehouse_id` | `string` | No |  |
| `produced_date` | `string (date-time)` | No |  |
| `currency_id` | `string` | No |  |
| `route_sheet_id` | `string` | No |  |
| `amount` | `number` | No | Default: `0` |
| `create_reminder` | `boolean` | No | Default: `false` |
| `additional_costs` | `object[]` | No |  |
| `additional_costs[].cost_id` | `string` | Yes |  |
| `additional_costs[].amount` | `number` | Yes |  |
| `additional_costs[].customer_id` | `string` | No |  |
| `additional_costs[].supplier_id` | `string` | No |  |
| `additional_costs[].employee_id` | `string` | No |  |
| `additional_costs[].person_id` | `string` | No |  |
| `additional_costs[].consumption_type` | `string` | No | One of: `variable`, `fixed` |

```json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "items": [
    {
      "product_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "type": "produced",
      "cost_percentage": 10,
      "extra_costs": [],
      "_id": "64b7f4d9e2b3b6a0b7c5d7ff",
      "expiration_date": "2025-05-01T12:00:00Z",
      "used_measure": {
        "_id": null,
        "ratio": null,
        "amount": null
      },
      "consumption_type": "variable"
    }
  ],
  "code": "string",
  "note": "string",
  "organization_id": "string",
  "responsible_id": "string",
  "used_warehouse_id": "string",
  "used_date": "2024-07-20T10:30:00Z",
  "produced_warehouse_id": "string",
  "produced_date": "2024-07-20T10:30:00Z",
  "currency_id": "string",
  "route_sheet_id": "string",
  "amount": 0,
  "create_reminder": false,
  "additional_costs": [
    {
      "cost_id": "string",
      "amount": 0,
      "customer_id": "string",
      "supplier_id": "string",
      "employee_id": "string",
      "person_id": "string",
      "consumption_type": "variable"
    }
  ]
}
```

**Response**

Same response shape as [POST /production-operation/create](#post-production-operation-create).

## POST /production-operation/get-paging

Get production-operation by paging

**Required permission:** `production_operation` · [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/production-operation/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/production-operation/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/production-operation/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/production-operation/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);
```

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `page` | `number` | Yes | Default: `1` |
| `limit` | `number` | Yes | Default: `20` |
| `search` | `string` | No | search string to filter by code or name |
| `state` | `string` | No | state of the production operation. One of: `canceled`, `new`, `done`, `in_progress` |
| `organization_id` | `string` | No | organization id to filter by organization |
| `responsible_id` | `string` | No | responsible id to filter by responsible |
| `route_sheet_id` | `string` | No | route sheet id to filter by route sheet |

```json
{
  "page": 1,
  "limit": 20,
  "search": "string",
  "state": "canceled",
  "organization_id": "string",
  "responsible_id": "string",
  "route_sheet_id": "string"
}
```

**Response**

`data.total` is the total number of records and `data.data[]` holds the current page. The table below describes one record.

| Field | Type | Description |
|---|---|---|
| `_id` | `string` |  |
| `used_warehouse` | `object` |  |
| `used_warehouse._id` | `string` |  |
| `used_warehouse.name` | `string` |  |
| `produced_warehouse` | `object` |  |
| `produced_warehouse._id` | `string` |  |
| `produced_warehouse.name` | `string` |  |
| `organization` | `object` |  |
| `organization._id` | `string` |  |
| `organization.name` | `string` |  |
| `currency` | `object` |  |
| `currency._id` | `string` |  |
| `currency.name` | `string` |  |
| `currency_id` | `string` |  |
| `items` | `object[]` |  |
| `state` | `string` |  |
| `is_overused` | `boolean` |  |
| `code` | `string` |  |
| `total_produced` | `number` |  |
| `total_used` | `number` |  |
| `total_cost` | `number` |  |
| `number` | `string` |  |
| `produced_date` | `string (date-time)` |  |
| `amount` | `number` |  |
| `total_used:` | `number` |  |
| `used_date` | `string (date-time)` |  |
| `additional_costs` | `object[]` |  |
| `additional_costs[]._id` | `string` |  |
| `additional_costs[].cost_id` | `string` |  |
| `additional_costs[].amount` | `number` |  |
| `additional_costs[].customer_id` | `string` |  |
| `additional_costs[].employee_id` | `string` |  |
| `additional_costs[].supplier_id` | `string` |  |
| `additional_costs[].person_id` | `string` |  |
| `total_expense` | `number` |  |
| `created_at` | `string (date-time)` |  |
| `created_by` | `object` |  |
| `created_by._id` | `string` |  |
| `created_by.full_name` | `string` |  |
| `route_sheet` | `object` |  |
| `route_sheet._id` | `string` |  |
| `route_sheet.name` | `string` |  |
| `route_sheet.code` | `string` |  |
| `responsible` | `object` |  |
| `responsible._id` | `string` |  |
| `responsible.full_name` | `string` |  |
| `responsible.phone_number` | `string` |  |
| `note` | `string` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "_id": "string",
        "used_warehouse": {
          "_id": "string",
          "name": "string"
        },
        "produced_warehouse": {
          "_id": "string",
          "name": "string"
        },
        "organization": {
          "_id": "string",
          "name": "string"
        },
        "currency": {
          "_id": "string",
          "name": "string"
        },
        "currency_id": "string",
        "items": [
          {}
        ],
        "state": "string",
        "is_overused": false,
        "code": "string",
        "total_produced": 0,
        "total_used": 0,
        "total_cost": 0,
        "number": "string",
        "produced_date": "2025-05-01T12:00:00Z",
        "amount": 0,
        "total_used:": 0,
        "used_date": "2025-05-01T12:00:00Z",
        "additional_costs": [
          {
            "_id": "string",
            "cost_id": "string",
            "amount": 0,
            "customer_id": "string",
            "employee_id": "string",
            "supplier_id": "string",
            "person_id": "string"
          }
        ],
        "total_expense": 0,
        "created_at": "2025-05-01T12:00:00Z",
        "created_by": {
          "_id": "string",
          "full_name": "string"
        },
        "route_sheet": {
          "_id": "string",
          "name": "string",
          "code": "string"
        },
        "responsible": {
          "_id": "string",
          "full_name": "string",
          "phone_number": "string"
        },
        "note": "string"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /production-operation/get-by-id/{id}

Get production-operation using its _id

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

**Example request**

::: code-group

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

:::

**Path parameters**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | Yes |  |

**Request body**

No request body.

**Response**

Same response shape as [POST /production-operation/create](#post-production-operation-create).

## PUT /production-operation/set-state

setState production-operation

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

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

**Example request**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/production-operation/set-state' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "state": "new",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
```

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

```php [PHP]
<?php
$body = <<<'JSON'
{
  "state": "new",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

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

:::

**Request body**

| Field | Type | Required | Description |
|---|---|---|---|
| `_id` | `string` | Yes |  |
| `state` | `string` | Yes | One of: `canceled`, `new`, `done`, `in_progress` |

```json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state": "new"
}
```

**Response**

Same response shape as [POST /production-operation/create](#post-production-operation-create).

---

*This page is generated from the OpenAPI spec.*
