Revision
Stock revisions (inventory counts)
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 /revision/create
Create a new products revision (stock inventory count). type is forced to products. created_by is set from the integration principal.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ObjectId the revision belongs to |
warehouse_id | string | No | Warehouse ObjectId to count stock in (optional — defaults to org's primary warehouse) |
responsible_id | string | No | Employee ObjectId responsible for this revision (optional — defaults to the integration principal) |
starting_date | string (date-time) | Yes | Date and time the revision counting period starts (ISO 8601) |
ending_date | string (date-time) | No | Optional date and time the counting period ends (ISO 8601) |
description | string | No | Optional free-text description or notes |
set_counted | boolean | No | When true, pre-populates counted quantities from current stock levels |
category_ids | string[] | No | Filter products by category ObjectIds (optional) |
supplier_ids | string[] | No | Filter products by supplier ObjectIds (optional) |
additional_ids | string[] | No | Additional product ObjectIds to include (optional) |
removed_ids | string[] | No | Product ObjectIds to exclude from the revision (optional) |
attachments | object[] | No | File attachments (optional) |
{
"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": [
{}
]
}Response
| Field | Type | Description |
|---|---|---|
_id | string | |
state | string | One of: pending, in_progress, canceled, done |
number | string | |
starting_date | string (date-time) | |
ending_date | string (date-time) | |
description | string | |
organization_id | string | |
organization | object | |
organization._id | string | |
organization.name | string | |
warehouse_id | string | |
warehouse | object | |
warehouse._id | string | |
warehouse.name | string | |
responsible_id | string | |
responsible | object | |
responsible._id | string | |
responsible.full_name | string | |
responsible.phone_number | string | |
currency | object | |
total_expected | number | |
total_counted | number | |
total_profit | number | |
total_loss | number | |
difference | number | |
profit_list | object[] | |
profit_list[].currency_id | string | |
profit_list[].amount | number | |
loss_list | object[] | |
loss_list[].currency_id | string | |
loss_list[].amount | number | |
attachments | object[] | |
created_at | string (date-time) | |
updated_at | string (date-time) |
{
"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.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Revision ObjectId |
Request body
No request body.
Response
Same response shape as POST /revision/create.
POST /revision/get-paging
Paginated list of product revisions (type is forced to products). Filterable by organization, warehouse, responsible, and state.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
page | number | Yes | Default: 1 |
limit | number | Yes | Default: 20 |
organization_id | string | No | Filter by organization ObjectId |
warehouse_id | string | No | Filter by warehouse ObjectId |
responsible_id | string | No | Filter by responsible employee ObjectId |
state | string | No | Filter by revision state. One of: pending, in_progress, canceled, done |
{
"page": 1,
"limit": 20,
"organization_id": "string",
"warehouse_id": "string",
"responsible_id": "string",
"state": "pending"
}Response
| Field | Type | Description |
|---|---|---|
total | number | |
list | object[] | |
list[]._id | string | |
list[].state | string | One of: pending, in_progress, canceled, done |
list[].number | string | |
list[].starting_date | string (date-time) | |
list[].ending_date | string (date-time) | |
list[].description | string | |
list[].organization_id | string | |
list[].organization | object | |
list[].organization._id | string | |
list[].organization.name | string | |
list[].warehouse_id | string | |
list[].warehouse | object | |
list[].warehouse._id | string | |
list[].warehouse.name | string | |
list[].responsible | object | |
list[].responsible._id | string | |
list[].responsible.full_name | string | |
list[].responsible.phone_number | string | |
list[].total_expected | number | |
list[].total_counted | number | |
list[].total_profit | number | |
list[].total_loss | number | |
list[].total_difference | number | |
list[].created_at | string (date-time) | |
list[].updated_at | string (date-time) |
{
"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.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Revision ObjectId to update |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | No | Organization ObjectId |
warehouse_id | string | No | Warehouse ObjectId |
responsible_id | string | No | Employee ObjectId responsible for this revision |
starting_date | string (date-time) | No | Date and time the revision counting period starts (ISO 8601) |
ending_date | string (date-time) | No | Date and time the counting period ends (ISO 8601) |
description | string | No | Free-text description or notes |
set_counted | boolean | No | Re-populate counted quantities from current stock levels |
category_ids | string[] | No | Filter products by category ObjectIds |
supplier_ids | string[] | No | Filter products by supplier ObjectIds |
additional_ids | string[] | No | Additional product ObjectIds to include |
removed_ids | string[] | No | Product ObjectIds to exclude |
attachments | object[] | No | File attachments |
{
"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": [
{}
]
}Response
Same response shape as 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.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Revision ObjectId |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | Target state. Transitions: pending→in_progress|canceled; in_progress→done|canceled; done→canceled (blocked for products revisions). One of: pending, in_progress, canceled, done |
{
"status": "pending"
}Response
Same response shape as POST /revision/create.
This page is generated from the OpenAPI spec.