> ## 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.

# Form Routing

> Route leads via API or funnel builder based on form submissions, with conditional, base, failover, thresholds, and authentication settings.

# Form Routing

## The Basics

**Form Routing** sends lead data to endpoints via API calls or built-in funnel forms. You configure routing rules, filters, CAPs, rotational thresholds, and authentication within each endpoint’s **Form Settings**.

***

## Routing Models

Pingtree offers three routing models for form distribution:

* **Base Routing**\
  Add an endpoint here if **no** custom routing rules apply (excluding filters, CAPs, response mapping). Leads flow to all base endpoints in priority order.

* **Conditional Routing**\
  Use this when **custom IF/THEN rules** are defined. Only leads matching those conditions route here.

* **Failover Routing**\
  Configure endpoints here to catch leads **not sold** by Base or Conditional routing. Only applies if earlier models do not accept the lead.

***

## Example Scenarios

### Scenario A: Geolocation-Based Routing

Route **Lead A** (California) to a specific endpoint and **Lead B** (others) to a fallback:

1. **Endpoint A**
   * In **Form Settings**, set **Send Method** to REST API.
   * Add a **Geolocation Filter** for California (auto-detected or user-defined).

2. **Failover Endpoint**
   * Configure a generic endpoint under **Failover Routing**.

3. **Routing Setup**
   * Add **Endpoint A** under **Conditional Routing**.
   * Add the failover endpoint under **Failover Routing**.

***

### Scenario B: Rotational Thresholds

Distribute leads by percentage across multiple endpoints:

1. Set a **Rotational Count** (e.g., 100 leads).
2. Create a **Routing Bucket** and add active endpoints.
3. Assign each endpoint a **percentage** of the count (e.g., 50%, 30%, 20%).
4. Pingtree rotates leads based on these weights, ensuring CAP limits are met.

***

### Scenario C: Multi-Tier Routing

Combine conditional, base, and failover logic:

1. **Conditional Routing** – applies specific IF/THEN rules.
2. **Base Routing** – default delivery for leads that pass filters/CAP.
3. **Failover Routing** – catches all remaining leads.

Pingtree processes in order: **Conditional → Base → Failover**.

***

### Scenario D: Short-Lived Authentication Token

Some endpoints require a temporary token for each POST:

1. In **Form Settings**, open the **Auth** tab.
2. Configure the **Auth Request** to retrieve a short-lived token.
3. Map the token in **Response Mapping**.
4. In the **POST** mapping, include the token variable for authentication.

***

## How Form Routing is Triggered

Form Routing is activated when:

* You call the **Form API** directly.
* A lead completes a **campaign funnel** built with our funnel builder.
* A lead is ingested into a campaign via **Sources > Form API**.

***

!\[REPLACE HERE: Form Routing Flow Diagram]
