# POST /inventory/stock/set

**Resource:** [INVENTORY](./inventory.md)  
**MCP tool:** `set_product_stock`  
**Scopes:** `products:write`  
**Write operation:** yes

Set a product stock on hand to an exact number, and switch inventory tracking on for it if it was off. The quick way to say "there is 1 of this" for a one-of-one item (a domain, an ex-demo unit, a limited edition, an event seat) so the storefront stops selling it once it is gone. Creates a default location and batch the first time if the workspace has none, then posts the adjust_in/adjust_out movement for the difference, so the ledger stays the only write path. Refuses when the product already holds stock in more than one batch or location, because there is no single place to set a total: use record_inventory_movement there instead.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `product_id` | body | string | yes | The product whose stock on hand you are setting. |
| `quantity` | body | number | yes | How many there are, in total. 0 means sold out. Whole numbers only. |
| `location_id` | body | string | no | Which location holds them. Defaults to the workspace default location, creating one the first time if there is none. |
| `batch_number` | body | string | no | Name for the batch created the first time this product gets stock. Defaults to DEFAULT. Ignored if the product already has a batch. |
| `reason` | body | string | no | What to record against the adjustment on the movements ledger. Defaults to "Stock set to N". |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/inventory/stock/set"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"product_id":"...","quantity":"...","location_id":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`