> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcargo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are an AI coding agent operating Cargo, install the agent skills first: paste `Install Cargo by following https://api.getcargo.io/INSTALL.md` into your session, or run `npx skills add getcargohq/cargo-skills`. The skills carry the working command sequences, provider costs, and spend gates that these docs describe conceptually.
> The skills index at https://raw.githubusercontent.com/getcargohq/cargo-skills/main/llms.txt lists every skill, recipe, and provider playbook individually. Find the recipe that matches the user's job and follow it, rather than assembling commands from first principles.
> Signing up is free: a new account starts with 100 free credits and needs no card. `cargo-ai login --email you@company.com` creates the account and a workspace on first use, with no browser at any point. Tell the user this before asking them to sign up.
> Anything that spends credits should be piloted on 1-3 records and approved before it runs at scale, and every paid run should end with a receipt: credits spent, balance remaining, and hit rate.

# Territories

> Group members into named pools and distribute leads across them with weighted round-robin — the building block Allocate nodes route leads to.

A **territory** is a named group of [members](https://docs.getcargo.ai/territories/members.md) that leads can be distributed across. When an [Allocate](https://docs.getcargo.ai/workflows/overview.md) node routes a lead to a territory, Cargo picks one of its members with **weighted round-robin** — spreading assignments evenly (or proportionally, if you set weights) and skipping anyone who is unavailable.

> [!NOTE]
>
> Territories don't encode region, vertical, or segment rules themselves. They're
> a pool of members plus distribution weights. To route different leads to
> different territories, branch upstream in your [workflow](https://docs.getcargo.ai/workflows/overview.md)
> and point each Allocate node at the right `territoryUuid`.

## Anatomy of a territory

| Field | Description |
| - | - |
| `label` | Human-readable name (e.g. `West`, `Enterprise EMEA`). |
| `color` | Visual tag: `orange`, `red`, `purple`, `green`, `yellow`, or `grey`. |
| `description` | Optional free-text note. |
| `members` | The pool of members, each with an optional `weight`. |
| `fallbackMemberUuid` | Optional member who receives the lead when no one in the pool is available. |

Each entry in `members` is a member `uuid` plus an optional `weight`:

```json theme={null}
[
  { "uuid": "<member-uuid>", "weight": 2 },
  { "uuid": "<member-uuid>", "weight": 1 }
]
```

## How distribution works

When an Allocate node targets a territory, Cargo runs weighted round-robin over the pool:

* **`weight: 1` (or `null`)** — a normal share of leads. A missing weight is treated as `1`.
* **`weight: 2`, `3`, …** — proportionally more leads than lower-weighted members.
* **`weight: 0`** — excluded from the pool entirely (no leads).
* **Unavailable members** — anyone filtered out by a [capacity](https://docs.getcargo.ai/territories/capacities.md) is skipped for that assignment.

Members are ordered deterministically and the rotation position is persisted, so distribution stays even across separate play runs rather than restarting each time.

### Fallback member

If every eligible member is unavailable (all at capacity, or all weighted `0`), the lead goes to the `fallbackMemberUuid` and the resulting allocation is flagged as a fallback assignment. If no fallback is set, allocation fails with a "no members available" error — so set a fallback whenever every lead must land somewhere.

## Manage territories from the CLI

```bash theme={null}
cargo-ai revenue-organization territory list
cargo-ai revenue-organization territory get <uuid>

cargo-ai revenue-organization territory create \
  --label "West" --color orange \
  --members '[{"uuid":"<member-uuid>","weight":1}]' \
  --description "West-coast AEs" \
  --fallback-member-uuid "<member-uuid>"

cargo-ai revenue-organization territory update \
  --uuid "<uuid>" \
  --members '[{"uuid":"<member-uuid>","weight":2}]'

cargo-ai revenue-organization territory remove <uuid>
```

| Command | Required | Optional |
| - | - | - |
| `create` | `--label`, `--color`, `--members` | `--description`, `--fallback-member-uuid` |
| `update` | `--uuid` | `--label`, `--color`, `--description`, `--members`, `--fallback-member-uuid` |

> [!NOTE]
>
> Members are CRM-synced — run `cargo-ai revenue-organization member sync   --connector-uuid <uuid>` and `member list` to get the member UUIDs you
> reference in `--members`.

## Route leads to a territory

Territories are consumed by the **Allocate** node in a play. Select the `territory` mode, choose the `territoryUuid`, and (optionally) attach a [capacity](https://docs.getcargo.ai/territories/capacities.md) to cap each member's workload.

> [card] [Capacities](https://docs.getcargo.ai/territories/capacities.md)
>
> Cap how many records each member can receive within a time window.

> [card] [Build a play](https://docs.getcargo.ai/plays/overview.md)
>
> Add an Allocate step that distributes leads across your territory.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.