# Storage Webhooks

## Storage webhooks

When storage items are created, updated, or deleted, the API can send **webhook** notifications to endpoints you configure via the Monolith webhooks API. Use this to keep external systems in sync with storage changes (e.g. audit logs, asset management).

Event type

Storage webhooks use the event type `storage`. When creating or updating a webhook, include `"storage"` in the `events` array to receive storage-related payloads.

When webhooks are sent

| Action   | When it fires                                                         |
| -------- | --------------------------------------------------------------------- |
| `create` | A new storage item is created (`POST /storage`).                      |
| `update` | A storage item is updated (`PATCH /storage/:uuid` or assign-to-case). |
| `delete` | A storage item is deleted (`DELETE /storage/:uuid`).                  |

Payload shape

Each webhook request is an HTTP POST to your configured URL with a JSON body like:

| Field               | Type   | Description                                                               |
| ------------------- | ------ | ------------------------------------------------------------------------- |
| `action`            | string | One of: `create`, `update`, `delete`.                                     |
| `type`              | string | Event resource type; always `"storage"` for storage webhooks.             |
| `timestamp`         | string | ISO 8601 time when the event occurred.                                    |
| `webhook_timestamp` | string | ISO 8601 time when the webhook was sent.                                  |
| `webhook_uuid`      | string | UUID of the webhook configuration that triggered this delivery.           |
| `data`              | object | The storage item (same shape as in list/get).                             |
| `updated_from`      | object | *(Update only.)* Previous values for fields that changed; may be partial. |

Example: create

```json
{
  "action": "create",
  "type": "storage",
  "timestamp": "2024-01-15T14:30:00.000Z",
  "webhook_timestamp": "2024-01-15T14:30:00.100Z",
  "webhook_uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": {
    "storage_id": 1,
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "storage_number": "STR-2024-0001",
    "type": "HDD",
    "make": "Vendor",
    "model_name": "Model X",
    "capacity": 1000,
    "capacity_unit": "GB",
    "location": { "..." },
    "case": null,
    "created_on": "2024-01-15T14:30:00.000Z",
    "is_general_storage": true,
    "custom_fields": []
  }
}
```

Example: update (with updated\_from)

```json
{
  "action": "update",
  "type": "storage",
  "timestamp": "2024-01-16T09:00:00.000Z",
  "webhook_timestamp": "2024-01-16T09:00:00.050Z",
  "webhook_uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": {
    "storage_id": 1,
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "notes": "Updated after audit",
    "..."
  },
  "updated_from": {
    "notes": "Previous notes value"
  }
}
```

Example: delete

```json
{
  "action": "delete",
  "type": "storage",
  "timestamp": "2024-01-20T11:00:00.000Z",
  "webhook_timestamp": "2024-01-20T11:00:00.030Z",
  "webhook_uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": {
    "storage_id": 1,
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "storage_number": "STR-2024-0001",
    "..."
  }
}
```

Headers and signature

* Monolith-Event — The event type (e.g. `storage`).
* Monolith-signature — HMAC signature of the raw JSON body using your webhook secret, so you can verify the request came from Monolith. Verify this before trusting the payload.

Webhook subscription, URL, and secret are configured through the Monolith webhooks API (create/update webhook with `events: ["storage"]`).


---

# 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/storage-webhooks.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.
