Skip to content

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

FieldTypeRequiredDescription
organization_idstringYesOrganization ObjectId the revision belongs to
warehouse_idstringNoWarehouse ObjectId to count stock in (optional — defaults to org's primary warehouse)
responsible_idstringNoEmployee ObjectId responsible for this revision (optional — defaults to the integration principal)
starting_datestring (date-time)YesDate and time the revision counting period starts (ISO 8601)
ending_datestring (date-time)NoOptional date and time the counting period ends (ISO 8601)
descriptionstringNoOptional free-text description or notes
set_countedbooleanNoWhen true, pre-populates counted quantities from current stock levels
category_idsstring[]NoFilter products by category ObjectIds (optional)
supplier_idsstring[]NoFilter products by supplier ObjectIds (optional)
additional_idsstring[]NoAdditional product ObjectIds to include (optional)
removed_idsstring[]NoProduct ObjectIds to exclude from the revision (optional)
attachmentsobject[]NoFile attachments (optional)
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": [
    {}
  ]
}

Response

FieldTypeDescription
_idstring
statestringOne of: 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.

Path parameters

ParameterTypeRequiredDescription
idstringYesRevision 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

FieldTypeRequiredDescription
pagenumberYesDefault: 1
limitnumberYesDefault: 20
organization_idstringNoFilter by organization ObjectId
warehouse_idstringNoFilter by warehouse ObjectId
responsible_idstringNoFilter by responsible employee ObjectId
statestringNoFilter by revision state. One of: pending, in_progress, canceled, done
json
{
  "page": 1,
  "limit": 20,
  "organization_id": "string",
  "warehouse_id": "string",
  "responsible_id": "string",
  "state": "pending"
}

Response

FieldTypeDescription
totalnumber
listobject[]
list[]._idstring
list[].statestringOne of: 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.

Path parameters

ParameterTypeRequiredDescription
idstringYesRevision ObjectId to update

Request body

FieldTypeRequiredDescription
organization_idstringNoOrganization ObjectId
warehouse_idstringNoWarehouse ObjectId
responsible_idstringNoEmployee ObjectId responsible for this revision
starting_datestring (date-time)NoDate and time the revision counting period starts (ISO 8601)
ending_datestring (date-time)NoDate and time the counting period ends (ISO 8601)
descriptionstringNoFree-text description or notes
set_countedbooleanNoRe-populate counted quantities from current stock levels
category_idsstring[]NoFilter products by category ObjectIds
supplier_idsstring[]NoFilter products by supplier ObjectIds
additional_idsstring[]NoAdditional product ObjectIds to include
removed_idsstring[]NoProduct ObjectIds to exclude
attachmentsobject[]NoFile attachments
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": [
    {}
  ]
}

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

ParameterTypeRequiredDescription
idstringYesRevision ObjectId

Request body

FieldTypeRequiredDescription
statusstringYesTarget state. Transitions: pending→in_progress|canceled; in_progress→done|canceled; done→canceled (blocked for products revisions). One of: pending, in_progress, canceled, done
json
{
  "status": "pending"
}

Response

Same response shape as POST /revision/create.


This page is generated from the OpenAPI spec.

Bito 2.0 Integration API