Skip to content

Count or move a product’s stock

POST
/products/{id}/stock
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.

id
required

UUID v7

string format: uuid
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f

UUID v7

Media typeapplication/json
object
count

What is on the shelf now. Starts counting a product that was not counted.

integer
<= 1000000
Example
24
change

Plus for a delivery in, minus for one broken or lost. Only on a counted product.

integer
>= -1000000 <= 1000000
Example
12
reason
required

Restock: a delivery in. adjustment: counted, broken, lost or found.

string
Allowed values: restock adjustment
note
string
<= 500 characters

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
Allowed values: stop continue
movements
required
Array<object>
object
id
required

UUID v7

string format: uuid
change
required
integer
after
required
integer
reason
required
string
Allowed values: sale cancelled restock adjustment
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
Allowed values: validation
message
required
string
issues
required
Array<object>
object
path
required
string
message
required
string
Example
{
"error": "validation",
"issues": [
{
"path": "email",
"message": "Invalid email"
}
]
}