Skip to content
Markdown

Revision ​

Stock revisions (inventory counts)

INFO

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

POST /revision/create ​

Create a new products revision (stock inventory count). type is forced to products. created_by is set from the integration principal.

Нужное разрешение: revision_customer_cashback_create · как работают разрешения

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

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/revision/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "string",
  "starting_date": "2025-05-01T12:00:00Z",
  "responsible_id": "string"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/revision/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "string",
    "starting_date": "2025-05-01T12:00:00Z",
    "responsible_id": "string"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/revision/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "string",
        "starting_date": "2025-05-01T12:00:00Z",
        "responsible_id": "string",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "string",
  "starting_date": "2025-05-01T12:00:00Z",
  "responsible_id": "string"
}
JSON;

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

Тело запроса

ПолеТипОбязательноОписание
organization_idstringДаOrganization ObjectId the revision belongs to
warehouse_idstringНетWarehouse ObjectId to count stock in (optional — defaults to org's primary warehouse)
responsible_idstringДаEmployee ObjectId responsible for this revision (optional — defaults to the integration principal)
starting_datestring (date-time)ДаDate and time the revision counting period starts (ISO 8601)
ending_datestring (date-time)НетOptional date and time the counting period ends (ISO 8601)
descriptionstringНетOptional free-text description or notes
set_countedbooleanНетWhen true, pre-populates counted quantities from current stock levels
category_idsstring[]НетFilter products by category ObjectIds (optional)
supplier_idsstring[]НетFilter products by supplier ObjectIds (optional)
additional_idsstring[]НетAdditional product ObjectIds to include (optional)
removed_idsstring[]НетProduct ObjectIds to exclude from the revision (optional)
attachmentsobject[]НетFile attachments (optional)
balance_typestringНетRequired when type is balance.. Допустимые значения: customer, supplier, employee, cashbox, person
is_allbooleanНетПо умолчанию: false
json
{
  "organization_id": "string",
  "warehouse_id": "string",
  "responsible_id": "string",
  "starting_date": "2025-05-01T12:00:00Z",
  "ending_date": "2025-05-01T12:00:00Z",
  "description": "string",
  "set_counted": false,
  "category_ids": [
    "string"
  ],
  "supplier_ids": [
    "string"
  ],
  "additional_ids": [
    "string"
  ],
  "removed_ids": [
    "string"
  ],
  "attachments": [
    {}
  ],
  "balance_type": "customer",
  "is_all": false
}

Ответ

ПолеТипОписание
_idstring
statestringДопустимые значения: pending, in_progress, canceled, done
numberstring
starting_datestring (date-time)
ending_datestring (date-time)
descriptionstring
organization_idstring
organizationobject
organization._idstring
organization.namestring
warehouse_idstring
warehouseobject
warehouse._idstring
warehouse.namestring
responsible_idstring
responsibleobject
responsible._idstring
responsible.full_namestring
responsible.phone_numberstring
currencyobject
total_expectednumber
total_countednumber
total_profitnumber
total_lossnumber
differencenumber
profit_listobject[]
profit_list[].currency_idstring
profit_list[].amountnumber
loss_listobject[]
loss_list[].currency_idstring
loss_list[].amountnumber
attachmentsobject[]
created_atstring (date-time)
updated_atstring (date-time)
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "state": "pending",
    "number": "string",
    "starting_date": "2025-05-01T12:00:00Z",
    "ending_date": "2025-05-01T12:00:00Z",
    "description": "string",
    "organization_id": "string",
    "organization": {
      "_id": "string",
      "name": "string"
    },
    "warehouse_id": "string",
    "warehouse": {
      "_id": "string",
      "name": "string"
    },
    "responsible_id": "string",
    "responsible": {
      "_id": "string",
      "full_name": "string",
      "phone_number": "string"
    },
    "currency": {},
    "total_expected": 0,
    "total_counted": 0,
    "total_profit": 0,
    "total_loss": 0,
    "difference": 0,
    "profit_list": [
      {
        "currency_id": "string",
        "amount": 0
      }
    ],
    "loss_list": [
      {
        "currency_id": "string",
        "amount": 0
      }
    ],
    "attachments": [
      {}
    ],
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z"
  },
  "time": "2025-05-01T12:00:00Z"
}

GET /revision/get-by-id/{id} ​

Fetch a single revision by ObjectId. Returns full detail including responsible, organization, warehouse, totals, profit_list, loss_list.

Нужное разрешение: revision_customer_cashback · как работают разрешения

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

bash
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/revision/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/revision/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/revision/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
php
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/revision/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);

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

ПараметрТипОбязательноОписание
idstringДаRevision ObjectId

Тело запроса

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

Ответ

Структура ответа совпадает с POST /revision/create.

POST /revision/get-paging ​

Paginated list of product revisions (type is forced to products). Filterable by organization, warehouse, responsible, and state.

Нужное разрешение: revision_customer_cashback · как работают разрешения

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

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/revision/get-paging' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 1,
  "limit": 20
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/revision/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
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/revision/get-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 1,
        "limit": 20,
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "page": 1,
  "limit": 20
}
JSON;

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

Тело запроса

ПолеТипОбязательноОписание
pagenumberДаПо умолчанию: 1
limitnumberДаПо умолчанию: 20
organization_idstringНетFilter by organization ObjectId
warehouse_idstringНетFilter by warehouse ObjectId
responsible_idstringНетFilter by responsible employee ObjectId
statestringНетFilter by revision state. Допустимые значения: pending, in_progress, canceled, done
balance_typestringНетДопустимые значения: customer, supplier, employee, cashbox, person
state_idstringНет
searchstringНетFree-text search.
updated_atstring (date-time)НетOnly records updated at or after this time.
date_fromstring (date-time)НетStart of the date range.
date_tostring (date-time)НетEnd of the date range.
json
{
  "page": 1,
  "limit": 20,
  "organization_id": "string",
  "warehouse_id": "string",
  "responsible_id": "string",
  "state": "pending",
  "balance_type": "customer",
  "state_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "search": "string",
  "updated_at": "2025-05-01T12:00:00Z",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z"
}

Ответ

ПолеТипОписание
totalnumber
listobject[]
list[]._idstring
list[].statestringДопустимые значения: pending, in_progress, canceled, done
list[].numberstring
list[].starting_datestring (date-time)
list[].ending_datestring (date-time)
list[].descriptionstring
list[].organization_idstring
list[].organizationobject
list[].organization._idstring
list[].organization.namestring
list[].warehouse_idstring
list[].warehouseobject
list[].warehouse._idstring
list[].warehouse.namestring
list[].responsibleobject
list[].responsible._idstring
list[].responsible.full_namestring
list[].responsible.phone_numberstring
list[].total_expectednumber
list[].total_countednumber
list[].total_profitnumber
list[].total_lossnumber
list[].total_differencenumber
list[].created_atstring (date-time)
list[].updated_atstring (date-time)
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "_id": "string",
        "state": "pending",
        "number": "string",
        "starting_date": "2025-05-01T12:00:00Z",
        "ending_date": "2025-05-01T12:00:00Z",
        "description": "string",
        "organization_id": "string",
        "organization": {
          "_id": null,
          "name": null
        },
        "warehouse_id": "string",
        "warehouse": {
          "_id": null,
          "name": null
        },
        "responsible": {
          "_id": null,
          "full_name": null,
          "phone_number": null
        },
        "total_expected": 0,
        "total_counted": 0,
        "total_profit": 0,
        "total_loss": 0,
        "total_difference": 0,
        "created_at": "2025-05-01T12:00:00Z",
        "updated_at": "2025-05-01T12:00:00Z"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /revision/update/{id} ​

Update an existing revision. Only allowed while state is pending; returns AlreadyInProgress otherwise.

Нужное разрешение: revision_customer_cashback · как работают разрешения

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

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/revision/update/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "string",
  "responsible_id": "string",
  "starting_date": "2025-05-01T12:00:00Z"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/revision/update/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "string",
    "responsible_id": "string",
    "starting_date": "2025-05-01T12:00:00Z"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/revision/update/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "string",
        "responsible_id": "string",
        "starting_date": "2025-05-01T12:00:00Z",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "string",
  "responsible_id": "string",
  "starting_date": "2025-05-01T12:00:00Z"
}
JSON;

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

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

ПараметрТипОбязательноОписание
idstringДаRevision ObjectId to update

Тело запроса

ПолеТипОбязательноОписание
organization_idstringДаOrganization ObjectId
warehouse_idstringНетWarehouse ObjectId
responsible_idstringДаEmployee ObjectId responsible for this revision
starting_datestring (date-time)ДаDate and time the revision counting period starts (ISO 8601)
ending_datestring (date-time)НетDate and time the counting period ends (ISO 8601)
descriptionstringНетFree-text description or notes
set_countedbooleanНетRe-populate counted quantities from current stock levels
category_idsstring[]НетFilter products by category ObjectIds
supplier_idsstring[]НетFilter products by supplier ObjectIds
additional_idsstring[]НетAdditional product ObjectIds to include
removed_idsstring[]НетProduct ObjectIds to exclude
attachmentsobject[]НетFile attachments
balance_typestringНетRequired when type is balance.. Допустимые значения: customer, supplier, employee, cashbox, person
is_allbooleanНетПо умолчанию: false
json
{
  "organization_id": "string",
  "warehouse_id": "string",
  "responsible_id": "string",
  "starting_date": "2025-05-01T12:00:00Z",
  "ending_date": "2025-05-01T12:00:00Z",
  "description": "string",
  "set_counted": false,
  "category_ids": [
    "string"
  ],
  "supplier_ids": [
    "string"
  ],
  "additional_ids": [
    "string"
  ],
  "removed_ids": [
    "string"
  ],
  "attachments": [
    {}
  ],
  "balance_type": "customer",
  "is_all": false
}

Ответ

Структура ответа совпадает с POST /revision/create.

PUT /revision/set-status/{id} ​

Transition a revision to a new state. Valid transitions: pending→in_progress|canceled; in_progress→done|canceled; done→canceled (blocked for products type). DONE triggers stock reconciliation and invoice creation.

Нужное разрешение: revision_customer_cashback · как работают разрешения

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

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/revision/set-status/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "status": "pending"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/revision/set-status/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "status": "pending"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/revision/set-status/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "status": "pending",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "status": "pending"
}
JSON;

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

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

ПараметрТипОбязательноОписание
idstringДаRevision ObjectId

Тело запроса

ПолеТипОбязательноОписание
statusstringНетTarget state. Transitions: pending→in_progress|canceled; in_progress→done|canceled; done→canceled (blocked for products revisions). Допустимые значения: pending, in_progress, canceled, done
json
{
  "status": "pending"
}

Ответ

Структура ответа совпадает с POST /revision/create.


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

Bito 2.0 Integration API