Add Product Stock Movement (v1)
Method & Path
POST /api/v1/{workspaceId}/storefront/products/{productId}/stock-movements
Description
Adds a manual stock movement to a product inventory and increases the current stock.
Authentication
Required: Workspace auth with store.products.manage permission.
Headers
Authorization: Bearer <token>Content-Type: application/jsonX-Staff-Id: <staffId>(when acting as staff)
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
workspaceId | string | نعم | Workspace identifier |
productId | string | نعم | Storefront product identifier |
Request Body
{
"quantity": 10,
"direction": "in",
"occurredAt": "2025-01-22T08:00:00.000Z",
"note": "توريد جديد"
}
Direction Values
in: add to stockout: deduct from stock
Response 201 Created
{
"movement": {
"id": "66b3c1f52a6e9d2c52f7b123",
"productId": "66b3c0e22a6e9d2c52f7b0aa",
"orderId": null,
"orderPublicId": null,
"type": "manual-add",
"quantity": 10,
"direction": "in",
"stockAfter": 55,
"note": "توريد جديد",
"actor": {
"type": "staff",
"id": "staff_123",
"name": "Ahmed",
"email": "ahmed@example.com"
},
"occurredAt": "2025-01-22T08:00:00.000Z",
"createdAt": "2025-01-22T08:00:01.000Z"
},
"stockQuantity": 55
}
Common Errors
- 400 Bad Request: Invalid identifiers.
- 401 Unauthorized: Missing/invalid token.
- 403 Forbidden: Missing
store.products.managepermission. - 404 Not Found: Product or workspace not found.
- 422 Unprocessable Entity: Invalid quantity or payload.
- 500 Internal Server Error: Unexpected error.