# Tags & saved views

> **TL;DR for agents:** Tags: `GET/POST /api/tags`. Tag an entity: `POST /api/tags/{entity}/{id}`. Saved views: `POST /api/saved-views {entity, name, filters, sort, columns}`.

## Tag CRUD

```bash
curl -s "https://api.live-direct-marketing.online/api/tags" -H "Authorization: Bearer $LDM_KEY"

curl -s -X POST "https://api.live-direct-marketing.online/api/tags" \
  -H "Authorization: Bearer $LDM_KEY" -H "Content-Type: application/json" \
  -d '{"name":"hot","color":"#ef4444"}'
```

## Save / re-run a filter set as a view

Scope: `views:write`. View describes filters + sort + chosen columns. Reload the same exact CRM screen later by id.

```bash
curl -s -X POST "https://api.live-direct-marketing.online/api/saved-views" \
  -H "Authorization: Bearer $LDM_KEY" -H "Content-Type: application/json" \
  -d '{
    "entity":"leads",
    "name":"Hot inbound — last 7d",
    "filters":{"tags":["hot"],"createdAfter":"-7d"},
    "sort":[{"field":"createdAt","dir":"desc"}],
    "columns":["title","amount","stage","contact_name"]
  }'
```
