Count or move a product’s stock
POST
/products/{id}/stock
const url = 'https://example.com/products/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f/stock';const options = { method: 'POST', headers: { cookie: 'bottle.session_token=<bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"count":24,"change":12,"reason":"restock","note":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/products/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f/stock \ --header 'Content-Type: application/json' \ --cookie bottle.session_token=<bottle.session_token> \ --data '{ "count": 24, "change": 12, "reason": "restock", "note": "example" }'Count sets the number on the shelf and records the difference; it is also how counting starts on a product that was not counted. change moves a counted product up (a delivery in, reason restock) or down (broken or lost, reason adjustment). One or the other.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
UUID v7
string format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8fUUID v7
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
count
What is on the shelf now. Starts counting a product that was not counted.
integer
Example
24change
Plus for a delivery in, minus for one broken or lost. Only on a counted product.
integer
Example
12reason
required
Restock: a delivery in. adjustment: counted, broken, lost or found.
string
note
string
Responses
Section titled “Responses”The count, its rules, and the last 50 movements, newest first
Media typeapplication/json
object
productId
required
UUID v7
string format: uuid
stockOnHand
required
integer | null
stockLowAt
required
integer | null
whenOut
required
string | null
movements
required
Array<object>
object
id
required
UUID v7
string format: uuid
change
required
integer
after
required
integer
reason
required
string
orderId
required
UUID v7
string | null format: uuid
note
required
string | null
userId
required
string | null
createdAt
required
string format: date-time
Example
{ "productId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "whenOut": "stop", "movements": [ { "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "reason": "sale", "orderId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" } ]}Not signed in
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Not a member, or without the permission this needs
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Not found
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}A change to a product that is not counted: give a count first
Media typeapplication/json
object
error
required
string
message
required
string
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed
Media typeapplication/json
object
error
required
string
message
required
string
issues
required
Array<object>
object
path
required
string
message
required
string
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}