POST /v1/ecommerce/products/:id/stock/adjust
Add or remove stock of a product or variant, in the warehouse or in one branch. The change syncs to your connected stores.
POST
Ajustar el stock de un producto
Records a stock entry or exit. A positive
delta adds stock, a negative one removes it. Without branch_id the change happens in the warehouse; with it, in that branch.
The change is synced to the stores you have connected, and it leaves an adjustment entry in the stock movements.
Endpoint
Required scope
ecommerce:stock:write
The scope comes from your role. Minting a token with
ecommerce:stock:write requires the permission to adjust and transfer stock in your Keebai role, unless you are the company owner or a superuser. See scopes.Headers
Path parameters
Body
Example request
Response
200 OK
The product’s stock after the adjustment, in the same shape asGET /v1/ecommerce/products/{id}/stock.
400 Bad Request
The body does not match the schema — for exampledelta is 0 or not an integer — or one of these:
401 Unauthorized
Missing, invalid, revoked, or expired token.403 Forbidden
The token does not have theecommerce:stock:write scope.
404 Not Found
No product with that id, or it belongs to a different company.502 Bad Gateway
ECOMMERCE_UPSTREAM_ERROR — the ecommerce service could not answer.
Operational notes
- The change reaches your stores. Connected stores receive the new stock, so an adjustment here is what customers see online.
- This call is not idempotent. Retrying after a timeout applies the delta twice. Check the stock movements before retrying.
- To move stock between branches, transfer it.
POST .../stock/transferkeeps the total; two adjustments would record an exit and an entry instead.
Authorizations
Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.
Path Parameters
Body
application/json
Unidades a sumar (positivo) o restar (negativo). Entero distinto de 0
Example:
-2
ObjectId de la variante. Obligatorio si el producto tiene más de una
Sucursal donde se mueve el stock. Sin ella, el ajuste es sobre la bodega
Motivo del ajuste
Maximum string length:
500Ajustar el stock de un producto