Skip to main content
POST
Traspasar stock entre bodega y sucursales
Moves units from one place to another. Without from_branch_id they leave the warehouse; without to_branch_id they go back to the warehouse. Between two branches, pass both. The master total stays the same: only where the units sit changes. The move leaves a transfer 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

Where the units go

Example request

Response

200 OK

The product’s stock after the transfer, in the same shape as GET /v1/ecommerce/products/{id}/stock.

400 Bad Request

The body does not match the schema — for example quantity below 1 — or one of these:

401 Unauthorized

Missing, invalid, revoked, or expired token.

403 Forbidden

The token does not have the ecommerce: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 total never changes. A transfer only moves units between the warehouse and branches. To add or remove stock, adjust it.
  • This call is not idempotent. Retrying after a timeout moves the units twice. Check the stock movements before retrying.

Authorizations

Authorization
string
header
required

Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.

Path Parameters

id
string
required

Body

application/json
quantity
number
required

Unidades a traspasar

Required range: x >= 1
variant_id
string

ObjectId de la variante. Obligatorio si el producto tiene más de una

from_branch_id
string

Sucursal de origen. Sin ella, sale de la bodega

to_branch_id
string

Sucursal de destino. Sin ella, vuelve a la bodega

note
string

Motivo del traspaso

Maximum string length: 500

Response

200 - application/json
product_id
string
required
variants
object[]
required