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

# Routing Rules

> Create custom IF/THEN logic to control exactly which endpoints receive each lead, based on lead metadata.

# Routing Rules

Routing Rules let you precisely control which endpoints (buyers) receive each lead. By defining IF/THEN logic around lead metadata, you decide **when** and **why** a lead should (or should not) be sent to a given endpoint.

## Rule Components

### Name

A human-readable label for your rule. It doesn’t affect logic—it’s how you’ll identify it.

### Groups

Groups combine multiple sets of conditions. Use the top-level `AND/OR` to specify whether **all** groups must match (`AND`) or **any** group match suffices (`OR`).

### Conditions (IF/THEN)

Within each group, define one or more IF/THEN statements:

```text theme={null}
IF  [Field Parameter]  [Operator]  {Value}
THEN [Action]
```

## Building a Condition

* **Field Parameter**
  The lead attribute you’re testing (e.g., `partner_id`, `state`, or any custom field). Only captured fields appear in this dropdown.

* **Operator**
  Specifies the comparison method:
  * `=` (Equal)
  * `!=` (Not Equal)
  * `>` , `<` , `>=` , `<=` (Numeric comparisons; value must be an integer)
  * `IN` , `NOT IN` (List membership)

* **Value**
  The exact string or number stored in Pingtree. **Case-sensitive**; must exactly match the stored data.

## Logical Combinations

* **Within a Group**
  Choose if **all** conditions must be true (`AND`) or if **any** one suffices (`OR`).

* **Across Groups**
  The top-level `AND/OR` determines if **every** group must match (`AND`) or if **any** single group match suffices (`OR`).

## Assigning Endpoints

1. Select one or more **enabled** endpoints.
2. Only endpoints without existing routing rules will appear.
3. If an endpoint is missing, ensure it’s enabled and not already assigned to another routing logic.

## Example

```text theme={null}
RULE NAME: High-Value California Leads

GROUP A (AND):
  IF  utm_source = "google"
  IF  state      = "CA"

THEN SEND TO:
  • Endpoint "California Premium Buyer"
```

!\[REPLACE HERE: Routing Rules Diagram]
