Stock
Adjust stock
POST
/api/v1/products/variants/:variantId/stockApplies a signed stock adjustment to a variant — positive to restock, negative to remove stock. Fails atomically if it would take stock below zero.
Requires Authorization
SELLER only
Authenticated action
Path parameters
variantIdstringrequired | Must belong to one of the seller's shops. |
Body parameters
typestringrequired | e.g. RESTOCK, ADJUSTMENT, DAMAGE — a free-form label recorded on the movement. |
amountnumberrequired | Signed integer. Positive adds stock, negative removes it. |
reasonstring | Free-text note. |
Possible errors
| 409 | CONFLICT | Le stock ne peut pas être négatif. |
Request
curl --request POST \
--url https://api.swiftgoma.com/api/v1/products/variants/:variantId/stock \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"type": "<type>",
"amount": "<amount>",
"reason": "<reason>"
}'200Example response
{
"success": true,
"data": {
"id": "var_4d5e6f",
"name": null,
"attributes": null,
"sku": null,
"price": "12.50",
"stock": 60,
"isDefault": true
}
}