---
title: "POST /v1/workspaces/{workspaceId}/triage-rules"
method: POST
path: "/v1/workspaces/{workspaceId}/triage-rules"
---

# POST /v1/workspaces/{workspaceId}/triage-rules

`POST /v1/workspaces/{workspaceId}/triage-rules`

## Request

- Base URL: `https://api.bangermail.com`
- URL: `https://api.bangermail.com/v1/workspaces/{workspaceId}/triage-rules`
- Auth: HTTP bearer

Create a Triage rule for incoming mail (every plan; enabled rules count toward the plan amount). When = description (judged by Jev) and/or exact_conditions and/or has_label_ids; Then = actions.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `name` string, required
  - `description` string, nullable
  - `exact_conditions` TriageExactConditions
    - `from` string[]
    - `to` string[]
    - `subject_contains` string[]
    - `has_words` string[]
    - `excludes_words` string[]
    - `has_attachment` boolean
  - `has_label_ids` string[]
  - `actions` TriageRuleAction[], required
    - `type` 'apply_label' | 'archive' | 'mark_read' | 'star', required
    - `label_id` string, uuid
  - `enabled` boolean
  - `mailbox_id` string, uuid, required

## Response `201`

Successful response.

- object
  - `data` TriageRule, required
    - `id` string, uuid, required
    - `mailbox_id` string, uuid, required
    - `name` string, required
    - `auto_set_for_label_id` string, uuid, nullable, required
    - `description` string, nullable, required
    - `exact_conditions` TriageExactConditions, required
      - `from` string[]
      - `to` string[]
      - `subject_contains` string[]
      - `has_words` string[]
      - `excludes_words` string[]
      - `has_attachment` boolean
    - `has_label_ids` string[], required
    - `actions` TriageRuleAction[], required
      - `type` 'apply_label' | 'archive' | 'mark_read' | 'star', required
      - `label_id` string, uuid
    - `enabled` boolean, required
    - `version` integer, required
    - `error_code` string, nullable, required
    - `example_count` integer, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required

---

[API](https://skmtc.dev/bangermail/apis/banger-api.md) · [All operations](https://skmtc.dev/bangermail/apis/banger-api/llms.txt) · [OpenAPI document](https://skmtc.dev/bangermail/apis/banger-api/revisions/a149909267f9?raw)
