Skip to content
View as Markdown

Cashbox session ​

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 /cashbox-session/open ​

Open a cashier shift (cashbox session) on a cashbox with a declared opening balance. The acting cashier is resolved from the integration token (the optional user_id header, else the tenant owner).

Required permission: cashbox_update · how permissions work

Example request

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/open' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "string",
  "cashbox_id": "string",
  "opened_balance": [
    {
      "currency_id": "string",
      "payment_method_id": "string",
      "expected": 0
    }
  ]
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/open', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "string",
    "cashbox_id": "string",
    "opened_balance": [
      {
        "currency_id": "string",
        "payment_method_id": "string",
        "expected": 0
      }
    ]
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/open",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "string",
        "cashbox_id": "string",
        "opened_balance": [
            {
                "currency_id": "string",
                "payment_method_id": "string",
                "expected": 0,
            },
        ],
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "string",
  "cashbox_id": "string",
  "opened_balance": [
    {
      "currency_id": "string",
      "payment_method_id": "string",
      "expected": 0
    }
  ]
}
JSON;

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

FieldTypeRequiredDescription
organization_idstringYesOrganization ObjectId the session belongs to
cashbox_idstringYesCashbox (till) ObjectId to open a shift on
opened_balanceobject[]YesOpening balance per payment method
opened_balance[].currency_idstringYesCurrency ObjectId
opened_balance[].payment_method_idstringYesPayment-method ObjectId
opened_balance[].expectednumberYesDeclared expected amount for this payment method
opened_atstring (date-time)NoOptional shift open time (ISO 8601); defaults to now
open_notestringNoOptional free-text note
json
{
  "organization_id": "string",
  "cashbox_id": "string",
  "opened_balance": [
    {
      "currency_id": "string",
      "payment_method_id": "string",
      "expected": 0
    }
  ],
  "opened_at": "2025-05-01T12:00:00Z",
  "open_note": "string"
}

Response

FieldTypeDescription
_idstring
session_uuidstring
statestringOne of: open, closed, resolved, flagged
organization_idstring
cashbox_idstring
user_idstring
opened_atstring (date-time)
closed_atstring (date-time)
opened_balanceobject[]
opened_balance[].currency_idstring
opened_balance[].payment_method_idstring
opened_balance[].expectednumber
opened_balance[].actualnumber
closed_balanceobject[]
closed_balance[].currency_idstring
closed_balance[].payment_method_idstring
closed_balance[].expectednumber
closed_balance[].actualnumber
has_diff_on_openboolean
has_diff_on_closeboolean
open_notestring
close_notestring
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "session_uuid": "string",
    "state": "open",
    "organization_id": "string",
    "cashbox_id": "string",
    "user_id": "string",
    "opened_at": "2025-05-01T12:00:00Z",
    "closed_at": "2025-05-01T12:00:00Z",
    "opened_balance": [
      {
        "currency_id": "string",
        "payment_method_id": "string",
        "expected": 0,
        "actual": 0
      }
    ],
    "closed_balance": [
      {
        "currency_id": "string",
        "payment_method_id": "string",
        "expected": 0,
        "actual": 0
      }
    ],
    "has_diff_on_open": false,
    "has_diff_on_close": false,
    "open_note": "string",
    "close_note": "string"
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /cashbox-session/close ​

Close an open shift, reconciling the declared closing balance against the expected totals.

Required permission: cashbox_update · how permissions work

Example request

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/close' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "_id": "string",
  "closed_balance": [
    {
      "currency_id": "string",
      "payment_method_id": "string",
      "expected": 0
    }
  ]
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/close', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "_id": "string",
    "closed_balance": [
      {
        "currency_id": "string",
        "payment_method_id": "string",
        "expected": 0
      }
    ]
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/close",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "_id": "string",
        "closed_balance": [
            {
                "currency_id": "string",
                "payment_method_id": "string",
                "expected": 0,
            },
        ],
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "_id": "string",
  "closed_balance": [
    {
      "currency_id": "string",
      "payment_method_id": "string",
      "expected": 0
    }
  ]
}
JSON;

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

FieldTypeRequiredDescription
_idstringYesCashbox-session ObjectId to close
closed_balanceobject[]YesCounted closing balance per payment method
closed_balance[].currency_idstringYesCurrency ObjectId
closed_balance[].payment_method_idstringYesPayment-method ObjectId
closed_balance[].expectednumberYesDeclared expected amount for this payment method
close_notestringNoOptional free-text note
json
{
  "_id": "string",
  "closed_balance": [
    {
      "currency_id": "string",
      "payment_method_id": "string",
      "expected": 0
    }
  ],
  "close_note": "string"
}

Response

Same response shape as POST /cashbox-session/open.

POST /cashbox-session/get-paging ​

Paginated list of cashbox sessions, filterable by organization, cashbox, cashier, state, and discrepancy.

Required permission: cashbox · how permissions work

Example request

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/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/cashbox-session/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/cashbox-session/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/cashbox-session/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

FieldTypeRequiredDescription
pagenumberYesDefault: 1
limitnumberYesDefault: 20
organization_idstringNoFilter by organization ObjectId
cashbox_idstringNoFilter by cashbox ObjectId
user_idstringNoFilter by cashier (user) ObjectId
statestringNoFilter by session state. One of: open, closed, resolved, flagged
has_diffbooleanNoFilter sessions that closed with a discrepancy
searchstringNoFree-text search.
date_fromstring (date-time)NoStart of the date range.
date_tostring (date-time)NoEnd of the date range.
json
{
  "page": 1,
  "limit": 20,
  "organization_id": "string",
  "cashbox_id": "string",
  "user_id": "string",
  "state": "open",
  "has_diff": false,
  "search": "string",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z"
}

Response

FieldTypeDescription
totalnumber
listobject[]
list[]._idstring
list[].session_uuidstring
list[].statestringOne of: open, closed, resolved, flagged
list[].organization_idstring
list[].cashbox_idstring
list[].user_idstring
list[].opened_atstring (date-time)
list[].closed_atstring (date-time)
list[].opened_balanceobject[]
list[].opened_balance[].currency_idstring
list[].opened_balance[].payment_method_idstring
list[].opened_balance[].expectednumber
list[].opened_balance[].actualnumber
list[].closed_balanceobject[]
list[].closed_balance[].currency_idstring
list[].closed_balance[].payment_method_idstring
list[].closed_balance[].expectednumber
list[].closed_balance[].actualnumber
list[].has_diff_on_openboolean
list[].has_diff_on_closeboolean
list[].open_notestring
list[].close_notestring
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "_id": "string",
        "session_uuid": "string",
        "state": "open",
        "organization_id": "string",
        "cashbox_id": "string",
        "user_id": "string",
        "opened_at": "2025-05-01T12:00:00Z",
        "closed_at": "2025-05-01T12:00:00Z",
        "opened_balance": [],
        "closed_balance": [],
        "has_diff_on_open": false,
        "has_diff_on_close": false,
        "open_note": "string",
        "close_note": "string"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

GET /cashbox-session/get-by-id/{id} ​

Fetch a single cashbox session by ObjectId.

Required permission: cashbox · how permissions work

Example request

bash
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/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/cashbox-session/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/cashbox-session/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

ParameterTypeRequiredDescription
idstringYesCashbox-session ObjectId

Request body

No request body.

Response

Same response shape as POST /cashbox-session/open.

POST /cashbox-session/get-active ​

Return the caller's active (open) session in the given organization, if any.

Required permission: cashbox · how permissions work

Example request

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/get-active' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "string"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/cashbox-session/get-active', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_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/cashbox-session/get-active",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "string",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "string"
}
JSON;

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

FieldTypeRequiredDescription
organization_idstringNoOrganization ObjectId to find the caller's active session in
json
{
  "organization_id": "string"
}

Response

Same response shape as POST /cashbox-session/open.


This page is generated from the OpenAPI spec.

Bito 2.0 Integration API