Returns a material's details and its stock at a storage location.

```
v1/materials/get_entry.php
```

## Parameters

| Field | Type | Required | Description |
|---|---|---|---|
| material_id | int | Yes | Material ID |
| storage_id | int | Yes | Storage location ID |

The material is returned only if it is stocked at storage location storage_id. Stock across all storage locations at once is returned by [v1/materials/get_stocks](https://developers.controlata.com/hc/api-docs/articles/api-materials-get-stocks).

## Response

An object material with the material's fields, its stock at storage location storage_id, its categories and suppliers. The categories and suppliers from the response can be sent to [v1/materials/edit](https://developers.controlata.com/hc/api-docs/articles/api-materials-edit) unchanged.

| Field | Type | Description |
|---|---|---|
| id | int | Material ID |
| name | string | Name |
| sku | string | SKU |
| unit | string | Unit of measure, a code from [Units of Measure](https://developers.controlata.com/hc/api-docs/articles/api-units-get-list) |
| price | float | Price per unit |
| notes | string | Notes |
| archived | int | 1 if the material is archived |
| stock | float | Stock at storage location storage_id |
| minimum | float | Minimum stock at storage location storage_id |
| planned | float | Stock change from operations in the Planned status. null if there are none |
| categories | array | The material's categories: objects with id and name |
| suppliers | array | The material's suppliers: objects with id and name |

## Example request

```
{
    "material_id": 2051,
    "storage_id": 3998
}
```

## Example response

```
{
    "success": true,
    "material": {
        "id": 2051,
        "name": "Oak board",
        "sku": "M010",
        "price": 135000,
        "notes": "",
        "archived": 0,
        "stock": 4.2,
        "minimum": 1,
        "planned": null,
        "unit": "cu m",
        "categories": [
            {
                "id": 12,
                "name": "Wood"
            }
        ],
        "suppliers": [
            {
                "id": 45,
                "name": "Woodtrade Ltd"
            }
        ]
    }
}
```

## Errors

| Error | Reason |
|---|---|
| No material_id in input | A required field is missing (instead of material_id, the field's name) |
| Storage ID not found | Storage location not found or deleted |
| Material not found or access denied | Material not found, deleted or not stocked at the storage location |
