# Production step

Production process steps

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

## POST /production-step/create

Create a new production step (an individual manufacturing stage such as cutting, assembly, or QC).

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

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

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/production-step/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-step/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "name": "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-step/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "name": "string",
    },
)
print(res.json())
```

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

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

:::

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

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `name` | `string` | Да | Display name of the production step (required) |
| `code` | `string` | Нет | Optional human-readable code for this step |
| `note` | `string` | Нет | Optional free-text note |
| `used_warehouse_id` | `string` | Нет | ObjectId of the warehouse used in this step (optional) |
| `employee_ids` | `string[]` | Нет | ObjectIds of employees assigned to this step (optional) |
| `attachments` | `object[]` | Нет | Pre-uploaded attachment object references (optional) |
| `attachments[].name` | `string` | Нет | File name of the attachment |
| `attachments[].size` | `number` | Нет | File size in bytes |
| `attachments[].path` | `string` | Да |  |
| `attachments[].note` | `string` | Нет |  |

```json
{
  "name": "string",
  "code": "string",
  "note": "string",
  "used_warehouse_id": "string",
  "employee_ids": [
    "string"
  ],
  "attachments": [
    {
      "name": "string",
      "size": 0,
      "path": "string",
      "note": "string"
    }
  ]
}
```

**Ответ**

| Поле | Тип | Описание |
|---|---|---|
| `_id` | `string` | Production step ObjectId |
| `name` | `string` | Display name of the step |
| `number` | `string` | Auto-assigned sequential number |
| `code` | `string` | Human-readable code |
| `note` | `string` | Free-text note |
| `used_warehouse` | `object` | Denormalized warehouse used in this step (present when used_warehouse_id is set) |
| `used_warehouse._id` | `string` |  |
| `used_warehouse.name` | `string` |  |
| `used_warehouse.number` | `string` |  |
| `employees` | `object[]` | Denormalized employee records assigned to this step |
| `employees[]._id` | `string` |  |
| `employees[].full_name` | `string` |  |
| `employees[].number` | `string` |  |
| `employees[].attachments` | `object[]` |  |
| `attachments` | `object[]` | Attachment records linked to this step |
| `created_at` | `string (date-time)` | ISO 8601 creation timestamp |
| `updated_at` | `string (date-time)` | ISO 8601 last-update timestamp |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "number": "string",
    "code": "string",
    "note": "string",
    "used_warehouse": {
      "_id": "string",
      "name": "string",
      "number": "string"
    },
    "employees": [
      {
        "_id": "string",
        "full_name": "string",
        "number": "string",
        "attachments": []
      }
    ],
    "attachments": [
      {}
    ],
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z"
  },
  "time": "2025-05-01T12:00:00Z"
}
```

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

Fetch a single production step by ObjectId.

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

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

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/production-step/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-step/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-step/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-step/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` | Да | Production step ObjectId |

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

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

**Ответ**

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

## POST /production-step/get-paging

Paginated list of production steps, filterable by name/code/number search.

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

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

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/production-step/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-step/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-step/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-step/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` |
| `search` | `string` | Нет | Free-text search. |
| `updated_at` | `string (date-time)` | Нет | Only records updated at or after this time. |
| `organization_id` | `string` | Нет | Organization ObjectId. |
| `sort_by` | `string` | Нет | Field name to sort by. |
| `asc` | `integer` | Нет | Sort direction: `1` ascending, `-1` descending.. Допустимые значения: `-1`, `1` |

```json
{
  "page": 1,
  "limit": 20,
  "search": "string",
  "updated_at": "2025-05-01T12:00:00Z",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "sort_by": "string",
  "asc": -1
}
```

**Ответ**

| Поле | Тип | Описание |
|---|---|---|
| `total` | `number` |  |
| `list` | `object[]` |  |
| `list[]._id` | `string` | Production step ObjectId |
| `list[].name` | `string` | Display name of the step |
| `list[].number` | `string` | Auto-assigned sequential number |
| `list[].code` | `string` | Human-readable code |
| `list[].note` | `string` | Free-text note |
| `list[].used_warehouse` | `object` | Denormalized warehouse used in this step (present when used_warehouse_id is set) |
| `list[].used_warehouse._id` | `string` |  |
| `list[].used_warehouse.name` | `string` |  |
| `list[].used_warehouse.number` | `string` |  |
| `list[].employees` | `object[]` | Denormalized employee records assigned to this step |
| `list[].employees[]._id` | `string` |  |
| `list[].employees[].full_name` | `string` |  |
| `list[].employees[].number` | `string` |  |
| `list[].employees[].attachments` | `object[]` |  |
| `list[].attachments` | `object[]` | Attachment records linked to this step |
| `list[].created_at` | `string (date-time)` | ISO 8601 creation timestamp |
| `list[].updated_at` | `string (date-time)` | ISO 8601 last-update timestamp |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "_id": "string",
        "name": "string",
        "number": "string",
        "code": "string",
        "note": "string",
        "used_warehouse": {
          "_id": null,
          "name": null,
          "number": null
        },
        "employees": [],
        "attachments": [],
        "created_at": "2025-05-01T12:00:00Z",
        "updated_at": "2025-05-01T12:00:00Z"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /production-step/update

Update an existing production step. Requires _id plus at minimum the name field.

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

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

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/production-step/update' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "_id": "string"
}'
```

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

```php [PHP]
<?php
$body = <<<'JSON'
{
  "name": "string",
  "_id": "string"
}
JSON;

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

:::

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

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `name` | `string` | Да | Display name of the production step (required) |
| `code` | `string` | Нет | Optional human-readable code for this step |
| `note` | `string` | Нет | Optional free-text note |
| `used_warehouse_id` | `string` | Нет | ObjectId of the warehouse used in this step (optional) |
| `employee_ids` | `string[]` | Нет | ObjectIds of employees assigned to this step (optional) |
| `attachments` | `object[]` | Нет | Pre-uploaded attachment object references (optional) |
| `attachments[].name` | `string` | Нет | File name of the attachment |
| `attachments[].size` | `number` | Нет | File size in bytes |
| `attachments[].path` | `string` | Да |  |
| `attachments[].note` | `string` | Нет |  |
| `_id` | `string` | Да | ObjectId of the production step to update (required) |

```json
{
  "name": "string",
  "code": "string",
  "note": "string",
  "used_warehouse_id": "string",
  "employee_ids": [
    "string"
  ],
  "attachments": [
    {
      "name": "string",
      "size": 0,
      "path": "string",
      "note": "string"
    }
  ],
  "_id": "string"
}
```

**Ответ**

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

## DELETE /production-step/delete/{id}

Soft-delete a production step by ObjectId (sets is_deleted=true). The step is no longer returned in normal listings after deletion.

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

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

::: code-group

```bash [curl]
curl -X DELETE 'https://api.bito.uz/integration-api/integration/api/v2/production-step/delete/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/production-step/delete/6712f0a9c4d1e87b3a0f9911', {
  method: 'DELETE',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "DELETE",
    "https://api.bito.uz/integration-api/integration/api/v2/production-step/delete/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-step/delete/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

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

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да | Production step ObjectId to soft-delete |

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

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

**Ответ**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}
```

---

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