# Custom Fields

### Custom fields

Storage items support **custom fields** defined in your system (e.g. in `custom_fields`). You can set them when creating or updating a storage item and they are returned in list/get responses.

Request body (create/update): use the optional `custom_fields` array. Each entry has:

| Property   | Type                                 | Description                                                                                       |
| ---------- | ------------------------------------ | ------------------------------------------------------------------------------------------------- |
| `field_id` | number                               | ID of the custom field (positive integer).                                                        |
| `value`    | string \| number \| array of strings | Field value. Strings max 255 characters. Use an array for multi-value fields (e.g. multi-select). |

Response: custom data is returned in the `custom_fields` array on each storage object. Each element includes metadata (e.g. `field_id`, `field_name`, `type_id`, `editor_type`, `enabled`, `sort_value`) and the stored `value`. Dynamic keys of the form `custom_field_{field_id}` also expose the value for convenience.

Create example with custom fields

```http
POST /storage
Content-Type: application/json

{
  "type": "HDD",
  "make": "Vendor",
  "model_name": "Model X",
  "capacity": 1000,
  "capacity_unit": "GB",
  "location_id": 1,
  "custom_fields": [
    { "field_id": 1, "value": "Evidence" },
    { "field_id": 2, "value": 42 },
    { "field_id": 3, "value": ["TagA", "TagB"] }
  ]
}
```

Update example: set or replace custom fields

Include `custom_fields` in the PATCH body. For each `field_id`, the value is set or replaced. To clear a custom value, send an empty value (`""`, `null`, or `[]` for array-type fields).

```http
PATCH /storage/550e8400-e29b-41d4-a716-446655440000
Content-Type: application/json

{
  "custom_fields": [
    { "field_id": 1, "value": "Updated label" },
    { "field_id": 2, "value": "" }
  ]
}
```

Response example (excerpt): `custom_fields` in a GET or create/update response may look like:

```json
"custom_fields": [
  {
    "attribute_id": 101,
    "item_id": 1,
    "field_id": 1,
    "field_name": "Category",
    "value": "Evidence",
    "type_id": 1,
    "editor_type": "text",
    "enabled": 1,
    "sort_value": 0,
    "custom_field_1": "Evidence"
  }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.monolithforensics.com/monolith/monolith-api/storage-api/custom-fields.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
