# Collections & Tags

Collections (labelled Tags in the app) group prompts by topic, funnel stage or campaign so every metric can be filtered by them. A prompt can belong to several.

### GET `/dimensions/collections`

Lists collections (Tags) belonging to the project.

### GET `/dimensions/tags`

Alias for `/dimensions/collections`. Returns the same payload, but named as _tags_ for consistency with the UI.

### POST `/collections`

Create a tag (Collection) in a project. Optionally attach existing prompts in the same call. Tag name is case-insensitive unique per project.

Body (JSON):

- `project_id` required
- `name` required
- `description` optional
- `prompt_ids` optional array, must belong to the project

### PATCH/DELETE `/collections/:id`

Rename a tag or change its description, or delete it. Deleting a tag keeps the prompts inside it; only the grouping disappears. Prompt membership is managed via POST `/prompts/assign_tags`.

- PATCH body: `project_id` (required), `name` and/or `description`. DELETE: `project_id` + `:id` in URL.

### POST `/prompts/assign_tags`

Idempotent bulk attachment of tags to existing prompts. Tags can be resolved by id or name.

Body (JSON):

- `project_id` required
- `prompt_ids` required array
- `tag_ids` one-of
- `tag_names` one-of
- `create_missing` optional bool, auto-create unknown tag names
