Sets a material's stock at a storage location. You pass the final stock, not the change: Controlata creates an adjustment for the difference between the current and the new stock.

```
v1/materials/update_stock.php
```

## Parameters

| Field | Type | Required | Description |
|---|---|---|---|
| material_id | int | Yes | Material ID |
| storage_id | int | Yes | Storage location ID |
| stock | float | Yes | New stock |
| notes | string | No | Notes for the adjustment |

## Example request

```
{
    "material_id": 2051,
    "storage_id": 3998,
    "stock": 4.2,
    "notes": "Stocktake at the storage location"
}
```

## Example response

```
{
    "success": true
}
```

## Errors

| Error | Reason |
|---|---|
| No stock in input | A required field is missing (instead of stock, the field's name) |
| Material not found or access denied | Material not found or deleted |
| Storage ID not found | Storage location not found or deleted |
| Invalid stock value. Must be a number | The stock is not a number, e.g. "" or "4,2" |
