PUT /v1/ecommerce/products/:id/stock/branch-links
Make branches sell a product from the stock of another branch, for branches that are one physical store.
PUT
Sincronizar sucursales de un producto
Links branches to a source branch for one product: the branches in
branch_ids sell it from the source’s stock. Use it when two or more branches in Keebai are one physical store, such as a barbershop and a salon under the same roof.
Links are per product, so the same company can have independent pairs: a source with its linked branches in one store, and another source with its own in a second store.
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
What linking does
- The linked branch’s stock moves to the source. Whatever the branch held of this product goes to the source branch, with a
transferentry in the stock movements. The total does not change. - Sales from a linked branch take from the source. The sale’s movement keeps the branch that sold, and the units come off the source’s stock. Connected stores are updated from the source branch.
- A linked branch has no stock of its own. It takes no transfers or adjustments; make them on the source.
- No chains. A linked branch cannot be a source, and a source cannot be linked to another branch.
Example request
Response
200 OK
The product’s stock after linking, in the same shape asGET /v1/ecommerce/products/{id}/stock, with the links in links.
400 Bad Request
The body does not match the schema, 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
- Sending the same set again changes nothing. The call replaces the branches of that source, so a retry is safe.
- To unlink one branch, use
DELETE .../stock/branch-links/{branch_id}, or send the source again without it.
Authorizations
Body
application/json
Sincronizar sucursales de un producto