API Reference
Receiving Discrepancies
/api/v1/console/receiving-discrepancies JWT API KeyThe booked shortages over a business-day window, newest day first
The window is on the row's true `businessDate` column, not on `createdAt`: a shortage written up at 01:00 Baghdad belongs to the previous business day, and this is one of the two PUR documents that stores that day rather than deriving it ( item 13).
The response carries the window's total priced shortage alongside the page. That total is over the whole window, never the page — a per-page loss figure changes as the reader pages.
- Capability
receive_purchase- API key scope
cap:receive_purchase(the key's owner must also hold the capability)
Query parameters
| From string (date) | Inclusive first business day. Defaults to 30 days before Panoptes.Application.DTOs.Requests.Purchasing.ListReceivingDiscrepanciesRequest.To. |
| To string (date) | Inclusive last business day. Defaults to today's Baghdad day. |
| InventoryItemId string (uuid) | Narrow to one stockable. Optional. |
| PurchaseInvoiceId string (uuid) | Narrow to the captures against one goods receipt — any of its lines (comeback brands-capture, the goods-receipt detail). Optional. |
| PurchaseOrderId string (uuid) | Narrow to the captures against one purchase order's lines. Optional. |
| Reason string | `short` | `damaged` | `wrong_item`. Optional. |
| Page integer (int32) | — |
| PerPage integer (int32) | — |
| Search string | Free-text filter. Its meaning is per-resource and documented on the endpoint. |
| Skip integer (int32) | Rows to skip, derived — never sent by the caller on this surface. |
| Sort string | A snake_case column key from the endpoint's allow-list (`created_at`, `gross_total`, `status` …). Absent or blank → the endpoint's default order. |
| Dir string | `asc` (the default when Panoptes.Application.Common.SortableRequest.Sort is present) or `desc`. Ignored without a sort. |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/receiving-discrepancies" \
-H "X-Api-Key: <YOUR_API_KEY>"Query parameters
Headers
/api/v1/console/receiving-discrepancies JWT API KeyCapture a short delivery
Period-guarded on the operator's own business date, because the note is usually written up after the shift and back-dating a loss into a closed month is the write the lock exists to refuse. A non-positive short is refused: "ordered equals received" is not a discrepancy, and an over-delivery is a different fact with a different channel.
The capture rebuilds the day's `receiving_short` ledger slice in the same transaction, and the response says on its face whether the priced shortage reached the daily control ledger — read back, never assumed.
- Capability
receive_purchase- API key scope
cap:receive_purchase(the key's owner must also hold the capability)
Request body
{
"inventoryItemId": "00000000-0000-0000-0000-000000000000",
"purchaseInvoiceItemId": "00000000-0000-0000-0000-000000000000",
"orderedQty": 0,
"receivedQty": 0,
"unitCostIqd": 0,
"businessDate": "2026-11-27",
"note": "string",
"reason": "string",
"purchaseOrderItemId": "00000000-0000-0000-0000-000000000000",
"photo": "string"
}| inventoryItemId string (uuid) | — |
| purchaseInvoiceItemId string (uuid) | The received line this reconciles, when there is one. NULL is the standalone case and is stored as System.Guid.Empty — the schema's column is a `uuid`, so the reference build's literal `"manual"` sentinel (FR-PUR-020) cannot be a word here. |
| orderedQty number (double) | STOCK units that should have arrived. A quantity, therefore `decimal`. |
| receivedQty number (double) | STOCK units that actually arrived. |
| unitCostIqd number (double) | Price per STOCK unit, carried at full `numeric(18,4)` precision. <b>Not rounded</b> — v1 rounded it on the way in because its target column was an integer, and every shortage lost its fractional part (FR-PUR-019). |
| businessDate string (date) | The Baghdad business day the shortage happened on. NULL means today. |
| note string | Free text explaining the shortage. Stored on the row (comeback brands-capture) and still carried on the audit row, which is append-only and hash-chained. |
| reason string | `short` (never arrived) | `damaged` (arrived unusable) | `wrong_item` (something else came in its place). Blank means `short`. All three reach `receiving_short`. |
| purchaseOrderItemId string (uuid) | The purchase-order line the capture is against, when the delivery has no receipt line to cite (or the clerk captures at the order). Its order must be this branch's, its item must be the captured item, and an order already closed short is refused with `PO_CLOSED_SHORT` — the close booked that shortfall. Ignored when Panoptes.Application.DTOs.Requests.Purchasing.CreateReceivingDiscrepancyRequest.PurchaseInvoiceItemId is given: the receipt line names its own order line. |
| photo string | Optional photo evidence of the delivery — `data:image/jpeg;base64,…`, PNG or WebP, or the bare base64 payload; at most 256 KiB decoded. Stored as an immutable, hash-anchored `EvidenceSource` in the capture's own transaction, the same evidence store a count photo uses, and re-hashed on every read. |
Responses
curl -X POST "https://staging-api.panoptesos.com/api/v1/console/receiving-discrepancies" \
-H "Content-Type: application/json" \
-H "X-Api-Key: <YOUR_API_KEY>" \
-d '{
"inventoryItemId": "00000000-0000-0000-0000-000000000000",
"purchaseInvoiceItemId": "00000000-0000-0000-0000-000000000000",
"orderedQty": 0,
"receivedQty": 0,
"unitCostIqd": 0,
"businessDate": "2026-11-27",
"note": "string",
"reason": "string",
"purchaseOrderItemId": "00000000-0000-0000-0000-000000000000",
"photo": "string"
}'Request body (JSON)
Headers
/api/v1/console/receiving-discrepancies/{id} JWT API KeyGet id
One capture with the receipt and order it cites and whether its priced shortage reached the loss ledger.
- Capability
receive_purchase- API key scope
cap:receive_purchase(the key's owner must also hold the capability)
Path parameters
| idrequired string (uuid) | — |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/receiving-discrepancies/{id}" \
-H "X-Api-Key: <YOUR_API_KEY>"Path parameters
Headers
/api/v1/console/receiving-discrepancies/{id}/evidence JWT API KeyThe capture's photo, re-hashed on read; the read is audited as a custody act ('s rule)
- Capability
receive_purchase- API key scope
cap:receive_purchase(the key's owner must also hold the capability)
Path parameters
| idrequired string (uuid) | — |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/receiving-discrepancies/{id}/evidence" \
-H "X-Api-Key: <YOUR_API_KEY>"Path parameters
Headers