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

# Leads

> Understand the lead data model, lifecycle, and routing in Lofty.

A lead represents a contact or prospect in the Lofty CRM. Nearly every other resource — tasks, transactions, activities, communications — is associated with a lead.

## Data model

| Field | Type | Description |
| - | - | - |
| `leadId` | int64 | Unique identifier |
| `firstName` / `lastName` | string | Name (max 30 chars each) |
| `emails` | string\[] | Email addresses |
| `phones` | string\[] | Phone numbers |
| `assignedUserId` | int64 | Assigned agent's user ID |
| `stage` | string | Pipeline stage name |
| `source` | string | Lead source label |
| `score` | int32 | Lead score |
| `tags` | object\[] | Applied tags |
| `leadTypes` | int32\[] | Type IDs: Buyer (2), Seller (1), Renter (5), Investor (6), Agent (7), Homeowner (8), Landlord (9), Other (-1) |
| `teamId` | int64 | Team the lead belongs to |

> [!NOTE]
>
> All lead IDs are 64-bit integers. JavaScript clients must handle these carefully — see [JS / TS Integration](https://developer.lofty.com/javascript-integration.md).

## Lifecycle

Leads move through four stages:

1. **Capture** — A lead is created via API, form submission, or third-party import. Lofty creates a lead record with contact info and source.

2. **Routing** — If neither `assignedUserId` nor `pondId` is provided, Lofty applies the team's routing rules to automatically assign the lead to an agent. With `pondId`, routing is skipped and the lead goes into that lead pond.

3. **Working** — The assigned agent works the lead. Activities (calls, emails, texts) are tracked in the lead's timeline. Agents can add leads to the working pool for AI assistant follow-up.

4. **Conversion** — The lead progresses through pipeline stages toward a closed deal. Transactions are created and associated with the lead.

## Pipeline stages

Each lead has a `stage` that reflects where it is in the sales process. Stages are configurable per team. Common stages include New Lead, Contacted, Qualified, Under Contract, and Closed.

Stage changes trigger [Pipeline Change webhooks](https://developer.lofty.com/concepts/webhooks.md#12-pipeline-change) (listId: 12).

## Hidden leads

When a lead has visibility restrictions, only the assigned agent receives webhook notifications and can access the lead. Other team members — including admins — are excluded.

## Lead ponds

A lead pond holds leads that have no agent assignee yet. List the ponds you can use with `GET /v1.0/team-features/lead-ponds`, then put a lead into one when you create it, update it, or assign it. See [Move a lead into a lead pond](https://developer.lofty.com/guides/lead-management.md#move-a-lead-into-a-lead-pond).

## Activities

The activity timeline captures all interactions with a lead:

* **V1** (`GET /v1.0/leads/{leadId}/activities`) — Site activities: property views, favorites, searches.
* **V2** (`GET /v2.0/leads/{leadId}/activities`) — Unified timeline: calls, texts, emails, and agent-logged communications in chronological order.

> [!TIP]
>
> Use the V2 activities endpoint for new integrations — it provides a complete picture in a single response.

## Listing leads: `returnFields` and `otherFilters`

[`GET /v1.0/leads`](https://developer.lofty.com/api-reference/leads/list-leads) takes two advanced query parameters. Both are optional; leave them out unless you need them.

### `returnFields` — fetch only part of each lead

A comma-separated list of **source paths** in Lofty's lead search document. Only those parts are loaded, which makes large pages faster to fetch. The response keeps the same shape: fields whose source path you did not request come back `null`, empty, or with their default value.

The values are source paths, **not** response field names. Each path starts with `data.`:

| Path | Fills these response fields |
| - | - |
| `data.lead` | `leadId`, `leadUserId`, `teamId`, `firstName`, `lastName`, `stageId`, `stage`, `assignedUserId`, `assignedUser`, `leadSource`, `source`, `tags`, `score`, `birthday`, `language`, `referredBy`, `lenderUserId`, `ownershipId`, `ownershipScope`, `leadTypes`, `createTime`, `assignTime`, `lastTouch`, `lastVisit`, `streetAddress`, `city`, `state`, `zipCode` |
| `data.emailList` | `emails` |
| `data.phoneList` | `phones` |
| `data.socialInfoList` | `facebook`, `twitter` |
| `data.callOptIn`, `data.textOptIn`, `data.emailOptIn` | `cannotCall`, `cannotText`, `cannotEmail` |
| `data.leadPropertyList` | `leadPropertyList`, and the mailing address in `streetAddress` / `city` / `state` / `zipCode` |
| `data.leadInquiries` | `leadInquiry`, `buyingTimeFrame`, `preQual`, `fthb`, `houseToSell`, `withBuyerAgent` |
| `data.leadListingInfo` | `sellingTimeFrame`, `buyHouse`, `mortgage`, `withListingAgent` |
| `data.groupIds` | `groups`, `segments` |
| `data.familyMemberList` | `leadFamilyMemberList` |
| `data.leadAgentGroupMember` | `pondId`, `pondName` |
| `data.opportunity` | `opportunity` |
| `data.lastUpdateTime` | `lastUpdateTime` |

You can also name a single field under `data.lead`, such as `data.lead.leadId` or `data.lead.firstName`.

> [!WARNING]
>
> * **Always include `data.lead`** (or at least one `data.lead.*` path), and always start paths with `data.`. Response field names such as `leadId` or `firstName` match nothing: the request then returns an empty `leads` array while `_metadata.total` still shows the real count. Paths under `data.` that leave out `data.lead`, such as `data.emailList` alone, make the request fail with `Unknown Error`.
> * **Request `data.callOptIn`, `data.textOptIn` and `data.emailOptIn` whenever you read `cannotCall`, `cannotText` or `cannotEmail`.** If they are not loaded, all three come back `false` for every lead, so leads who opted out look contactable.
> * Unknown paths are ignored without an error. Check a sample response before relying on a field.

```bash theme={null}
curl -G "https://api.lofty.com/v1.0/leads" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  --data-urlencode "limit=100" \
  --data-urlencode "returnFields=data.lead,data.emailList,data.phoneList,data.callOptIn,data.textOptIn,data.emailOptIn"
```

### `otherFilters` — extra filter criteria

A URL-encoded JSON object with filter criteria that have no dedicated query parameter. These keys are supported:

| Key | Type | Effect |
| - | - | - |
| `leadIds` | array of integers | Return only these leads (still limited to the leads you can see) |
| `regStartTime` | integer | Leads created at or after this time, in epoch milliseconds |
| `regEndTime` | integer | Leads created at or before this time, in epoch milliseconds |
| `withTrash` | boolean | `true` includes leads in the Trash stage. Applies only when `stage` is not set; by default Trash leads are excluded |

```bash theme={null}
curl -G "https://api.lofty.com/v1.0/leads" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  --data-urlencode 'otherFilters={"regStartTime":1730419200000,"regEndTime":1733011199999}'
```

Rules:

* **Use the dedicated parameter when one exists.** `offset`, `limit`, `sort`, `desc`, `contacted`, `key` and `returnFields` always win over the same criteria inside `otherFilters`; `stage`, `source`, `segments`, `allTags`, `anyTags`, `assignedUserId` and `groupIds` win when you set them.
* **Invalid input is ignored silently, not rejected.** Keys not in the table above are ignored. If the value is not valid JSON, or a supported key has the wrong type (for example `"leadIds": "123"`), the whole `otherFilters` value is discarded and the request runs **without** those filters. Check the result count when you change a filter.
* `otherFilters` cannot widen what you see: results are always limited to the leads your token's user can access.
* Other keys may happen to work today but are not part of the public API and can change without notice.

## Related resources

> [card] [Lead Management Guide](https://developer.lofty.com/guides/lead-management.md)
>
> Step-by-step: create, update, assign, and delete leads.

> [card] [Leads API Reference](https://developer.lofty.com/api-reference/leads/overview.md)
>
> Full endpoint documentation with parameters and responses.


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