Skip to main content

Purpose

Fetch the stock write-offs caused by a single receipt — the inventory deducted from your storages when the receipt’s products were sold. Use it to reconcile a sale against the warehouse movements it produced (“Çıxarılan ehtiyat” / stock deduction by receipt id). Only the deductions of the receipt itself are returned: each item has operation_id = null and a non-null receipt_product_id. Manual stock corrections or operations from other documents are excluded. This endpoint requires the receipts:read scope.

HTTP Request

GET https://integrations.clopos.com/open-api/v2/receipts/{id}/stock-operations
This endpoint requires authentication. Include your JWT in the x-token header. See Authentication for how to obtain a token and Errors for error responses.

Path Parameters

ParameterTypeDescription
idnumberUnique identifier of the receipt whose stock deductions you want to inspect.

Request Example

curl --location "https://integrations.clopos.com/open-api/v2/receipts/1/stock-operations" \
  -H "x-token: oauth_example_token"

Response

200 OK — Stock operations

{
  "data": [
    {
      "id": 1001,
      "receipt_id": 1,
      "receipt_product_id": 14,
      "product_id": 31042,
      "stock_id": 5001,
      "storage_id": 3,
      "quantity": 1,
      "before_quantity": 120,
      "after_quantity": 119,
      "cost": 8000,
      "before_cost": 8000,
      "total_cost": 8000,
      "operated_at": "2026-01-19 15:07:49",
      "product": {
        "id": 31042,
        "name": "Апельсинли реване"
      },
      "stock": {
        "id": 5001,
        "storage": {
          "id": 3,
          "name": "Main Storage"
        }
      }
    },
    {
      "id": 1002,
      "receipt_id": 1,
      "receipt_product_id": 15,
      "product_id": 31046,
      "stock_id": 5002,
      "storage_id": 3,
      "quantity": 2,
      "before_quantity": 50,
      "after_quantity": 48,
      "cost": 1500,
      "before_cost": 1500,
      "total_cost": 3000,
      "operated_at": "2026-01-19 15:07:49",
      "product": {
        "id": 31046,
        "name": "Ачма узум жевиз"
      },
      "stock": {
        "id": 5002,
        "storage": {
          "id": 3,
          "name": "Main Storage"
        }
      }
    }
  ]
}

404 Not Found — Invalid ID

{
  "success": false,
  "error": "not_found",
  "message": "Receipt not found"
}

Field Reference

Stock operation object

FieldTypeDescription
idnumberStock operation identifier.
receipt_idnumberReceipt the operation belongs to.
receipt_product_idnumberReceipt product line that produced the write-off (always set for receipt deductions).
product_idnumberProduct whose stock was deducted.
stock_idnumberStock record affected by the operation.
storage_idnumberStorage the stock belongs to.
quantitynumberQuantity deducted from stock.
before_quantitynumberStock quantity before the operation.
after_quantitynumberStock quantity after the operation.
costnumberUnit cost applied to the deduction.
before_costnumberStock cost before the operation.
total_costnumberTotal cost of the deducted quantity.
operated_atstringWhen the operation was applied (YYYY-MM-DD HH:mm:ss).
productobjectRelated product. Present even when the product was soft-deleted.
stockobjectAffected stock together with its storage.

stock

FieldTypeDescription
idnumberStock identifier.
storageobjectStorage the stock belongs to (id, name).

Notes

  • The endpoint returns only the receipt’s own deductions (operation_id = null, receipt_product_id != null); inventory adjustments from other documents are not included.
  • A product may be soft-deleted but is still returned so historical receipts remain fully reconcilable.
  • Combine with Get Receipt by ID to map each receipt_product_id back to its sold line item.