المخزون
2 عمليات
GET/inventory/movements#
List append-only inventory movements
المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
cursorquery | string | |
limitquery | integer | الافتراضي: 50 |
الاستجابات
200Movement page
| الاسم | النوع | الوصف |
|---|---|---|
dataمطلوب | Movement[] | |
next_cursorمطلوبيقبل null | string | Pass back as |
401Missing, invalid, expired, or revoked token
403Required live scope is missing
429Token budget exhausted (180 requests/minute, 60 writes/minute per install)
curl -X GET "https://dukkan.one/platform-api/v1/inventory/movements?limit=50" \
-H "Authorization: Bearer $DUKKAN_ACCESS_TOKEN"{
"data": [
{
"id": "6f1d2c3b-4a59-4e8f-9b70-2d1c3e4f5a6b",
"sequence": 1661,
"variant_id": "6f1d2c3b-4a59-4e8f-9b70-2d1c3e4f5a6b",
"location_id": "6f1d2c3b-4a59-4e8f-9b70-2d1c3e4f5a6b",
"delta": -2,
"stock_after": 38,
"reason": "correction",
"occurred_at": "2026-08-18T16:00:00Z"
}
],
"next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0wOC0xOFQxNjowMDowMFoifQ"
}POST/inventory/movements#
Append an inventory movement; absolute stock writes are forbidden
The response never includes the resulting absolute stock; read the movement list or the product for that.
المعاملات
| الاسم | النوع | الوصف |
|---|---|---|
Idempotency-Keyheaderمطلوب | string | Unique per logical write, at most 200 characters, remembered for 24 hours. Replaying the same key with the same body returns the recorded response; the same key with a different body answers 409. |
جسم الطلب مطلوب
Append an inventory movement.
| الاسم | النوع | الوصف |
|---|---|---|
variant_idمطلوب | string | |
location_idمطلوب | string | |
deltaمطلوب | integer | Signed quantity change. Absolute stock writes are forbidden. |
reasonمطلوب | string | القيم: correctioninitialreturndamage |
noteيقبل null | string |
الاستجابات
201Movement appended
لا جسم للاستجابة.
400Invalid request
401Missing, invalid, expired, or revoked token
403Required live scope is missing
404Resource not found in the token-bound store
409State transition, inventory, refund, or idempotency conflict
429Token budget exhausted (180 requests/minute, 60 writes/minute per install)
curl -X POST "https://dukkan.one/platform-api/v1/inventory/movements" \
-H "Authorization: Bearer $DUKKAN_ACCESS_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"variant_id": "6f1d2c3b-4a59-4e8f-9b70-2d1c3e4f5a6b",
"location_id": "6f1d2c3b-4a59-4e8f-9b70-2d1c3e4f5a6b",
"delta": -2,
"reason": "correction",
"note": "Stock count 2026-08-18"
}'{
"error": {
"code": "invalid_request",
"message": "A human-readable explanation",
"request_id": "req_01J8Z1K5X9",
"details": {}
}
}