# storage.write

Canonical URL: https://developers.iagenify.com/sdk/workflows/steps/storage-write/
Language: en

`type: "storage.write"`

Changes a connected database or bucket. Eight actions, each with what it requires — and an empty filter is refused twice.

Status: storage required · 8 actions · empty filter needs all

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `storage` | string | required | The storage. |
| `action` | string | required | `insert` · `update` · `delete` · `sql` · `put` · `remove` · `createCollection` · `dropCollection`. |
| `collection` | string |  | Required by the five document actions. |
| `sql` | string |  | Required by `sql`. |
| `key` | string |  | Required by `put` and `remove`. |
| `all` | boolean |  | Confirms a change with an empty filter. |

```javascript
{ id: "file", type: "storage.write", config: {
    storage: "…", action: "insert", collection: "tickets",
    documents: [{ text: "{{input.text}}", at: "{{input.receivedAt}}" }] } }
```

## An empty filter is refused — twice {#guard}

> **Once on save, once during the run**
>
> Saving catches a filter that is empty as written. But {{steps.find.output.id}} passes validation and can resolve to an empty string at run time — so it is checked again, with the field named. A run with nobody watching must not be able to empty a collection because an upstream template produced nothing.

## Output {#output}

```javascript
{{steps.file.output.result}}
{{steps.file.output.action}}
{{steps.file.output.storage}}
```

## There is no undo {#no-undo}

And no approval required either — this stays inside the account. A [retry](/sdk/ref/workflow-run/retry) from before this step writes again, which is the thing to think about before retrying a chain that writes.

- [storage.query](/sdk/workflows/steps/storage-query): Reading first.
- [write_storage](/sdk/agent/tools/write-storage): The agent's version.
- [Workflow steps](/sdk/workflows/steps): The 23 types.

```python
{"id": "file", "type": "storage.write", "config": {
    "storage": "…", "action": "insert", "collection": "tickets",
    "documents": [{"text": "{{input.text}}", "at": "{{input.receivedAt}}"}]}}
```

```python
"{{steps.file.output.result}}"
"{{steps.file.output.action}}"
"{{steps.file.output.storage}}"
```
