# Automations & Trash

Base: `/workspaces/{workspaceId}`

## List automations

`GET .../automations?conflicts=1` · `automations:read`

Returns `{ trashEnabled, automations, conflicts }`. Seeds default Trash retention when missing.

## Create

`POST .../automations` · `automations:write`

```json
{
  "kind": "custom",
  "name": "Videos short TTL",
  "scope": { "bucketIds": ["..."] },
  "priority": 10,
  "rules": [
    {
      "kind": "trash_ttl",
      "sortOrder": 0,
      "config": { "ttlDays": 3, "extensions": ["mp4", "mov"] }
    }
  ]
}
```

Omitting `name` auto-names with Haiku.

## Get / patch / delete

- `GET .../automations/{automationId}` · `automations:read`
- `PATCH .../automations/{automationId}` · `automations:write` — fields + optional full `rules` replace; `enabled` toggles on/off; `autoName: true` renames
- `DELETE .../automations/{automationId}` · `automations:write`
- `POST .../automations/{automationId}/name` · `automations:write` — Haiku rename
- `GET .../automations/conflicts` · `automations:read`

## Trash settings

- `GET .../trash` · `automations:read` → `{ trashEnabled }`
- `PATCH .../trash` · `automations:write` → `{ "trashEnabled": true }`

When Trash is off, destructive deletes hard-delete objects (no `_trash/` copy).

## Trash / move files

Under `.../buckets/{bucketId}/files`:

- `POST .../trash` · `files:delete` — `{ "keys": ["a.jpg"] }` (uses Trash rules / hard-delete)
- `POST .../move` · `files:write` — `{ "moves": [{ "fromKey", "toKey" }] }`
- `DELETE .../files/{fileId}` · `files:delete` — same as trash for that file's key
