popbob logo icon
Shop API

Update product stock

Set the available stock for one product.

Sets the exact available stock for one product. The API key must have the inventory:write permission.

Endpoint

PATCH https://popbob.gg/api/v1/products/{product_id}/stock

Replace {product_id} with the id from the List products response. The product must belong to the shop connected to the API key.

Request body

Send JSON with a non-negative whole-number stock. This replaces the previous stock; it does not add to it.

PATCH /api/v1/products/67f15e3c3d6d55ab781ac123/stock
Authorization: Bearer pb_live_your_key_here
Content-Type: application/json

{
  "stock": 2500
}

Successful response

A successful update returns 200:

{
  "product": {
    "id": "67f15e3c3d6d55ab781ac123",
    "name": "Diamonds",
    "stock": 2500
  }
}

The update is serialized with Popbob's order stock reservations, so an order cannot decrement stock at the same time as this update.

Errors

Invalid JSON or a stock value that is negative, fractional, or not a number returns 400 with:

{
  "error": "Stock must be a non-negative whole number."
}

A missing product or a product from another shop returns404 with { "error": "Product not found" }. Authentication, permission, and rate-limit responses use the same formats described in the List products reference.

Still have questions?

If anything is unclear or your question is not answered anywhere in our docs, contact Support. We will help you and update the docs to make the answer clearer.

HelpHelp