---
search:
  tags:
    - triage
    - POST
seo:
  description: >-
    Ordered auto-delegate rules evaluated on inbound records (lead,… Reference
    for the POST /workspaces/{organizationId}/triage/rules endpoint in the Pile
    API.
sidebar:
  label: Create triage rule
  badge: POST
title: Create triage rule
type: openapi-operation
---
Ordered auto-delegate rules evaluated on inbound records (lead, intake_item, customer, deal, issue, support_ticket). Rules run in sortOrder then createdAt order; the first match wins and the evaluation is logged to /triage/evaluations.

`POST /workspaces/{organizationId}/triage/rules`

**Request body** (`application/json`)

- `name` (string, required)
- `recordType` (string, required)
- `isActive` (boolean)
- `sortOrder` (integer)
- `conditions` (object, required)
- `action` (object, required)

Request body example:

```json
{
  "name": "string",
  "recordType": "lead",
  "isActive": true,
  "sortOrder": 0,
  "conditions": {
    "keywords": [
      "string"
    ],
    "sources": [
      "string"
    ],
    "channels": [
      "string"
    ],
    "customerDomains": [
      "string"
    ],
    "teamIds": [
      "string"
    ],
    "labelIds": [
      "string"
    ],
    "priorities": [
      "string"
    ],
    "statuses": [
      "string"
    ],
    "fields": [
      {
        "field": "string",
        "equals": "string"
      }
    ]
  },
  "action": {
    "type": "delegate",
    "agentId": "string",
    "teamId": "string",
    "templateId": "string",
    "title": "string",
    "status": "triage",
    "priority": "low",
    "labelIds": [
      "string"
    ],
    "repo": "string",
    "instructions": "string",
    "dispatch": true
  }
}
```

**Responses**

- `201` — Rule created

Response example, 201:

```json
{
  "rule": {
    "id": "string",
    "organizationId": "string",
    "name": "string",
    "recordType": "lead",
    "isActive": true,
    "sortOrder": 0,
    "conditions": {
      "keywords": [
        "string"
      ],
      "sources": [
        "string"
      ],
      "channels": [
        "string"
      ],
      "customerDomains": [
        "string"
      ],
      "teamIds": [
        "string"
      ],
      "labelIds": [
        "string"
      ],
      "priorities": [
        "string"
      ],
      "statuses": [
        "string"
      ],
      "fields": [
        {
          "field": "string",
          "equals": "string"
        }
      ]
    },
    "action": {
      "type": "delegate",
      "agentId": "string",
      "teamId": "string",
      "templateId": "string",
      "title": "string",
      "status": "triage",
      "priority": "low",
      "labelIds": [
        "string"
      ],
      "repo": "string",
      "instructions": "string",
      "dispatch": true
    },
    "createdAt": "string",
    "updatedAt": "string"
  }
}
```
