For AI agents: markdown of this page — /docs-content-en/entities/warehouses/stock-totals.md documentation index — /llms.txt

Aggregated product stock

GET /v1/warehouses/stock/totals

Sums each product's stock across all warehouses in your Bitrix24 account. For a product it returns the total quantity, the total reserve, and the list of warehouses where the product is present. Read-only.

Query parameters

Parameter Type Default Description
productId number Aggregate stock for a single product only
limit number How many products to return in the response
offset number 0 Offset over the product list

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/warehouses/stock/totals?productId=200" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/warehouses/stock/totals?productId=200" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/warehouses/stock/totals', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data, meta } = await res.json()

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/warehouses/stock/totals', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data, meta } = await res.json()

Response fields

Field Type Description
success boolean Always true on success
data array Per-product summary
data[].productId number Product identifier — see Catalog products
data[].amount number Total product quantity across all warehouses
data[].quantityReserved number Total product reserve across all warehouses
data[].storeIds array Identifiers of warehouses where the product is present
meta.total number Number of products in the response
meta.rawTotal number Number of source stock rows processed during aggregation
meta.truncated boolean true if there are more than 5000 source stock rows and some did not make it into the summary

Response example

JSON
{
  "success": true,
  "data": [
    {
      "productId": 200,
      "amount": 25,
      "quantityReserved": 30,
      "storeIds": [1, 2, 5]
    }
  ],
  "meta": {
    "total": 1,
    "truncated": false,
    "rawTotal": 3
  }
}

Error response example

400 — an invalid productId:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "productId must be a positive integer"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS productId, limit, or offset is set incorrectly
401 TOKEN_MISSING The API key has no configured tokens
403 SCOPE_DENIED The API key does not have the catalog scope
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable

The full list of common API errors — Errors.

Known specifics

Summing per product. One product's quantity and reserve are summed across all warehouses where it is present. The list of such warehouses is in storeIds. If quantity is not set in a particular warehouse, it is counted as zero when summing.

Summary limit. The summary is computed over the first 5000 stock rows. If there are more rows, meta.truncated is true and the summary is incomplete. In that case, narrow the selection with the productId parameter.

See also