## List stock levels (tenant:stock:read)

`GET /api/trade/v1/stock`

Module: Trade · operationId: `listStockLevels` · Tag: Stock · Auth: access token (`Authorization: Bearer <accessToken>`)

Stock of the tenant's default warehouse per article: on hand (sum of the movements), reserved (open order
quantity of the newest order revisions, drop-ship orders excluded), on order (open purchase orders, drafts
included) and available (`onHand - reserved + onOrder`). Without `articleIds` every article that has a rule or
a movement is listed, sorted by article id; a requested article without any data is answered with a zero level.
Articles are identified by their masterdata product id. Stock may be negative: deliveries are never blocked by
stock.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `articleIds` | query | string |  | Comma-separated article ids; only these (also when they have no stock yet). |
| `belowMinimum` | query | boolean |  | Only articles with a rule whose available quantity is below the minimum. (default `false`) |

### Responses

- **200** Stock levels (`application/json`)
- **401** No valid session or bearer token (no body).
- **403** Missing permission, no active tenant in the token, or a missing CSRF token on a cookie write. (`application/json`)

Fields of the 200 answer:

- `items` (array of StockLevel)
  - `articleId` (string): Masterdata product id.
  - `available` (number): `onHand - reserved + onOrder`.
  - `belowMinimum` (boolean): The article has a rule and `available` is below `minStock`.
  - `onHand` (number): Sum of the movements; may be negative.
  - `onOrder` (number): Open quantity of purchase orders (drafts included).
  - `reserved` (number): Open quantity of orders.
  - `rule` (null | object): The minimum-stock rule, null without one.
  - `warehouseId` (string): Warehouse code; empty before the first booking.
- `total` (integer)

Example 200 answer:

```json
{
  "items": [
    {
      "articleId": "4b7d9f13-5e6a-4c8b-a1d2-3e4f5a6b7d03",
      "available": 2,
      "belowMinimum": true,
      "onHand": 6,
      "onOrder": 0,
      "reserved": 4,
      "rule": {
        "minStock": 3,
        "reorderQty": 5
      },
      "warehouseId": "HAUPT"
    },
    {
      "articleId": "4b7d9f13-5e6a-4c8b-a1d2-3e4f5a6b7c03",
      "available": 128,
      "belowMinimum": false,
      "onHand": 128,
      "onOrder": 0,
      "reserved": 0,
      "rule": {
        "maxStock": 200,
        "minStock": 50
      },
      "warehouseId": "HAUPT"
    }
  ],
  "total": 2
}
```

### Example request

```bash
curl -X GET 'https://api.mbcom.cloud/api/trade/v1/stock' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
