# POST /opportunities/lead-segments

**Resource:** [Opportunities](./opportunities.md)  
**MCP tool:** `create_lead_segment`  
**Scopes:** `opportunities:write`  
**Write operation:** yes

Create a lead segment. Leads already in it when it is created are recorded without starting anything; from then on each lead that joins starts its automations once (up to the daily limit). Check the rules first with preview_lead_segment, or build them from a sentence with draft_lead_segment.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `name` | body | string | yes | Short name, up to 80 characters, e.g. "Hot, not contacted". |
| `description` | body | string | no | What the segment is for, one sentence. Send "" to clear. |
| `rules` | body | object | yes | Who is in it. rules = { "include": [condition, ...], "exclude": [condition, ...] }. A lead is in the segment when it matches EVERY include and NO exclude. At least one include is required.
A condition is { "field", "op", "value" }:
- score \| fit \| interest: op "gte" or "lte", value 1 to 10 (unresearched leads never match).
- band: op "in", value from ["hot","warm","cool","none"] (hot is 8+, warm 5 to 7, cool under 5, none is not scored).
- kind: op "in", value from ["business","person","unknown","none"].
- status: op "in", value from ["open","won","lost"].
- feedback: op "in", value from ["not_a_fit","wrong_person","none"].
- contacted \| replied \| researched: op "is", value true or false.
- age_days: op "gte" (arrived at least N days ago) or "lte" (arrived in the last N days), value 0 to 365.
- quiet_days: op "gte", value 1 to 365 (days since the team last called, texted, emailed or met them, or since arrival).
- source: op "in", value a list of lead source names.
- pipeline \| stage: op "in", value a list of workflow or stage ids.
- assigned: op "in", value a list of user ids, or "none" for nobody assigned.
- custom: { "field": "custom", "key": "<custom field id>", "op": "eq" \| "neq" \| "contains" \| "empty" \| "not_empty", "value": "<text>" } (no value for empty / not_empty). |
| `daily_cap` | body | number | no | The most leads a day that can join and start its automations (1 to 1000, default 25). Leads over the limit still join, quietly. |
| `is_active` | body | boolean | no | false pauses it: no one joins and nothing starts. Switching it on records who is already in it without starting anything. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/opportunities/lead-segments"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"name":"...","description":"...","rules":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`