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

# Working Leads

> See which Sales Agents you can use and their capacity, assign leads to a Sales Agent, check who works a lead, list working leads and stop follow-up with the Lofty V2 API.

A *working lead* is a lead that a Sales Agent (Lofty's AI assistant) is following up. This guide shows how to find the Sales Agents you can use, check their capacity, assign leads, check and list the leads they work, and stop follow-up on a lead.

You can use up to two Sales Agents: your own (`salesAgentType` `personal`) and the team Sales Agent you borrow from your team owner (`team`). A team owner's own Sales Agent is the team Sales Agent. Responses name a Sales Agent by `salesAgentType`, `ownerUserId`, `ownerName` and `assistantName`. A Sales Agent you cannot use, such as another member's personal Sales Agent, shows up as `other`.

Sales Agent settings cannot be read or changed through the API. Change them in the Lofty CRM.

## List the Sales Agents you can use

Send a `GET` request to `/v2.0/sales-agents/current`. See [List usable Sales Agents](https://developer.lofty.com/api-reference/sales-agents/get-current-users-sales-agent.md).

```bash theme={null}
curl -X GET https://api.lofty.com/v2.0/sales-agents/current \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

The response holds a `salesAgents` array, your own Sales Agent first. It is empty when you have no usable Sales Agent. Each entry carries `status` (`ACTIVE` or `INACTIVE`), `planType` and the four channel switches: `websiteChannel`, `textChannel`, `emailChannel` and `callChannel`.

## Check capacity

Send a `GET` request to `/v2.0/sales-agents/quota`. See [Get Sales Agent quota](https://developer.lofty.com/api-reference/sales-agents/get-current-users-sales-agent-quota.md).

```bash theme={null}
curl -X GET https://api.lofty.com/v2.0/sales-agents/quota \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

The response holds a `quotas` array with one entry per usable Sales Agent: `totalQuota`, `usedQuota` and `remainingQuota`.

Capacity is concurrent. One lead takes one slot, however many messages it gets. `usedQuota` is the number of leads worked now, not cumulative usage. A slot frees up only when a lead is finished or stopped, or when more capacity is bought; capacity never resets on a schedule. A borrowed team Sales Agent reports the team owner's capacity.

## Assign leads to a Sales Agent

Send a `POST` request to `/v2.0/working-leads/assign` with 1 to 100 lead IDs. See [Assign leads to Sales Agent](https://developer.lofty.com/api-reference/sales-agents/assign-working-leads.md).

```bash theme={null}
curl -X POST https://api.lofty.com/v2.0/working-leads/assign \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "leadIds": [789012345678, 789012345679],
    "salesAgent": "team"
  }'
```

* Without `salesAgent`, each lead goes by ownership: a team lead to the team Sales Agent, a personal lead to your personal one.
* With `salesAgent` set to `personal` or `team`, every lead that is not worked yet goes to that Sales Agent. If you have no such Sales Agent, the whole request is refused with `400`.

The response reports each lead:

* **`succeededLeads`** — leads a Sales Agent now works. A lead that was already worked counts as succeeded with `alreadyWorking: true`. It uses no capacity and stays with the Sales Agent working it, even when `salesAgent` names another one; the entry names the Sales Agent actually working it.
* **`failedLeads`** — leads that were not assigned, each with a `reason` code and a readable `message`.
* **`remainingQuota`** — the capacity left on each of your Sales Agents after the request.

| `reason` | Meaning |
| - | - |
| `QUOTA_EXCEEDED` | The Sales Agent has no free capacity for another lead. |
| `NO_SEAT` | No Sales Agent seat is available for this lead. |
| `SALES_AGENT_NOT_AVAILABLE` | The chosen Sales Agent cannot work this lead. |
| `LEAD_NOT_FOUND` | The lead does not exist. |
| `NO_ACCESS` | You have no access to this lead. |
| `DO_NOT_CONTACT` | The lead is in the Do Not Contact pipeline. |
| `SAME_PHONE_LEAD_FOLLOWING` | Another lead with the same phone number is already being followed up. |
| `INTERNAL_ERROR` | The lead could not be assigned because of an internal error. Try again later. |

Assign is the only Sales Agent endpoint that uses capacity. It is rate limited to 30 requests per account, 60 per client IP and 1000 across all callers every 60 seconds. Over any of these limits it returns `429` with a `Retry-After` header. When the rate limit cannot be checked, the request is refused with `503` (code `200144`) and no lead is assigned; retry later.

## Check whether a Sales Agent works a lead

Send a `GET` request to `/v2.0/sales-agents/by-lead` with a `leadId` query parameter. See [Get Sales Agent by lead](https://developer.lofty.com/api-reference/sales-agents/get-sales-agent-by-lead-id.md).

```bash theme={null}
curl -X GET "https://api.lofty.com/v2.0/sales-agents/by-lead?leadId=789012345678" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

The response's `salesAgent` object has a `workingStatus`:

| `workingStatus` | Meaning |
| - | - |
| `working` | A Sales Agent follows up the lead now. |
| `stopped` | A Sales Agent worked the lead and was stopped. The other fields describe that Sales Agent. |
| `not_working` | No Sales Agent works the lead. Every Sales Agent field is `null`. |

`workingStartedAt` is when the Sales Agent started its latest follow-up of the lead. A lead you cannot access returns `403`.

## List working leads

Send a `GET` request to `/v2.0/working-leads`. Page with `limit` (1 to 100, default 20) and `offset` (default 0); `offset` + `limit` must not exceed 10000. See [List working leads](https://developer.lofty.com/api-reference/sales-agents/query-working-leads-paginated.md).

```bash theme={null}
curl -X GET "https://api.lofty.com/v2.0/working-leads?limit=20&offset=0" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

The response holds `workingLeads` and `metadata` (`total`, `count`, `offset`, `limit`). Each lead names the Sales Agent working it and has `workingStartedAt`, when that Sales Agent started its latest follow-up.

> [!NOTE]
>
> The list comes from a search index that trails the actual state. A lead that was just stopped can stay listed for a short while, with its Sales Agent fields and `workingStartedAt` set to `null`. Use [Get Sales Agent by lead](https://developer.lofty.com/api-reference/sales-agents/get-sales-agent-by-lead-id.md) for a lead's current state.

Filtering by AI stage is no longer supported. A request with a non-empty `aiStage` returns `400`.

## Stop follow-up on a lead

Send a `PUT` request to `/v2.0/working-leads/{leadId}/stop`. It takes no request body. See [Stop Sales Agent working a lead](https://developer.lofty.com/api-reference/sales-agents/stop-working-lead.md).

```bash theme={null}
curl -X PUT https://api.lofty.com/v2.0/working-leads/789012345678/stop \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

This is the same action as stopping the Sales Agent in the CRM, and the lead's timeline records you as the person who stopped it. The response's `success` field reports whether the request was accepted.

To resume follow-up, [assign the lead again](#assign-leads-to-a-sales-agent). That takes a capacity slot again, like a new lead.

## Retired endpoints

These endpoints were retired in [December 2026](https://developer.lofty.com/changelog/2026-12). They still answer, but every call returns `410 Gone` with error code `200128` (`ENDPOINT_RETIRED`) and a message naming the replacement.

| Retired endpoint | Use instead |
| - | - |
| `POST /v2.0/working-leads/add` | [`POST /v2.0/working-leads/assign`](https://developer.lofty.com/api-reference/sales-agents/assign-working-leads) |
| `PUT /v2.0/sales-agents/working-lead/{leadId}/unmute` | [`POST /v2.0/working-leads/assign`](https://developer.lofty.com/api-reference/sales-agents/assign-working-leads) with the lead |
| `GET /v2.0/sales-agents/working-lead/{leadId}` | [`GET /v2.0/sales-agents/by-lead`](https://developer.lofty.com/api-reference/sales-agents/get-sales-agent-by-lead-id), `workingStatus` |
| `GET /v2.0/sales-agent/lead/mute-status` | [`GET /v2.0/sales-agents/by-lead`](https://developer.lofty.com/api-reference/sales-agents/get-sales-agent-by-lead-id), `workingStatus` `stopped` |
| `GET /v2.0/sales-agent/settings` | [`GET /v2.0/sales-agents/current`](https://developer.lofty.com/api-reference/sales-agents/get-current-users-sales-agent) for the channel switches; other settings are no longer exposed |
| `POST /v2.0/sales-agent/ai-number/send-sms-to-agent` | [`POST /v2.0/sales-agent/message/sms/send-to-agent`](https://developer.lofty.com/api-reference/notifications/send-system-sms-to-agent) |
| `GET /v2.0/plan-tasks/lead/{leadId}` | None. It no longer returned any data. |


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