# Lead finder endpoints

> Lead finder endpoints: read and change a campaign's lead finder settings, turn it on, and list the leads it added and the companies it looked at, each with its score and reasons.

Source: https://docs.ayinbox.com/api/reference/lead-finder/

These endpoints run the [lead finder](/guides/lead-finder/): a campaign that opts in finds companies that match its brain through Looot, scores each lead, verifies the address and adds the leads above its cut-off, inside a daily budget. Every route answers `503 lead_finder_disabled` while the lead finder is unavailable. Gates and scopes are in the [scope map](/api/endpoints/#lead-finder); error codes are under [lead finder refusals](/api/error-codes/#lead-finder-refusals).

Amounts are in US dollars and days are UTC days.

Campaign settings [#campaign-settings]

`GET /campaigns/:id/lead-finder` returns the campaign's lead finder, here switched on and part way through its day:

```json
{
  "available": true,
  "enabled": true,
  "daily_budget_usd": 2,
  "min_score": 60,
  "per_company": 2,
  "explore_percent": 10,
  "stop_reason": "",
  "enabled_by": "8d1c...",
  "enabled_at": "2026-11-25T08:02:11Z",
  "profile_status": "ready",
  "profile": {
    "summary": "B2B software companies whose sales teams run outbound",
    "queries": ["B2B SaaS companies selling to sales teams", "sales engagement software vendors"],
    "countries": ["US", "GB"],
    "employees_min": 51,
    "employees_max": 500,
    "titles": ["Head of Sales", "VP Sales", "Founder"],
    "industries": ["software"],
    "hiring_roles": ["Sales Development Representative"],
    "avoid": ["agencies"]
  },
  "today": {
    "day": "2026-11-25",
    "status": "running",
    "spent_usd": 0.41,
    "companies_seen": 22,
    "companies_qualified": 6,
    "leads_added": 9,
    "note": ""
  },
  "totals": { "leads_added": 120, "companies_seen": 800 },
  "limits": { "budget_min_usd": 0.1, "budget_max_usd": 50, "per_company_max": 3 },
  "next_run_at": "2026-11-25T10:14:00Z",
  "last_error": ""
}
```

A campaign that never turned it on reads as off with the defaults, `profile: null` and `profile_status: "none"`.

* `available` is `false` when the lead finder cannot be turned on in this workspace, for example without a paid plan that includes integrations.
* `daily_budget_usd` is the most the campaign's lookups may spend in one UTC day, $0.10 to $50 (default 2). `min_score` is the cut-off, 0 to 100 (default 60). `per_company` is how many people it adds per company, 1 to 3 (default 2). `explore_percent` is the [test sample](/guides/lead-finder/#the-test-sample) share, 0 to 25 (default 10).
* `profile_status` is `none` (not built yet), `ready` or `thin` (the brain gave nothing to search for). `profile` is the target profile built from the campaign's brain, or `null`; it is read-only.
* `stop_reason` is `""` while nothing holds the campaign back, else `enabler_lost_send`, `plan`, `thin_brain`, `consent_countries`, `no_brain`, `campaign_ended` or `source_error`. The [guide](/guides/lead-finder/#why-it-stops) says what each means.
* `today` is the current UTC day. `status` is `""` when nothing ran today, else `running`, `done`, `budget_reached`, `target_reached`, `no_capacity`, `sources_exhausted`, `out_of_credits`, `model_limit` or `error`. `note` is a sentence about the day when there is one, for example that the workspace reached its plan's contact limit. `spent_usd` is what the daily budget is checked against: settled spend plus what was set aside for lookups that had not settled when a pass ended. A set-aside amount may stay counted for the rest of the UTC day after its lookup settles, so `spent_usd` can be higher than what the lookups cost, never lower.
* `limits` are the bounds of the settings, for a client to show.
* `next_run_at` is when the next pass is due, set only while the lead finder is on.

A client should show an unknown `stop_reason` or `status` by its name rather than refuse it.

`PUT /campaigns/:id/lead-finder` takes any of `{enabled, daily_budget_usd, min_score, per_company, explore_percent}` and returns the same shape as `GET`. A field left out keeps its stored value, so a retry lands on the same state. `enabled` may only be `false`, which turns the lead finder off; `enabled: true` answers `400 lead_finder_enable_route`, because turning it on has [its own route](#turn-it-on). A value outside its range answers `400`, and the message names the field. Settings writes are audited on the campaign.

```json
{ "daily_budget_usd": 5, "min_score": 60, "per_company": 1, "explore_percent": 0 }
```

Turn it on [#turn-it-on]

`POST /campaigns/:id/lead-finder/enable` turns the lead finder on for the campaign, records the caller as the member it works as (for a key or an app, the member who created it), and makes its first pass due at once. It returns the same shape as `GET`. Set the budget and limits with `PUT` first.

Adding leads to a campaign that is sending mails them without anyone reviewing them first, so this route needs `send_campaigns`, `use_integrations` and `manage_contacts` for a signed-in member, with a recent confirmation (`POST /auth/reauth`), and `SEND_CAMPAIGNS`, `INTEGRATIONS` and `BULK_CONTACTS` for a key or an app. The member behind a key or an app must also hold `send_campaigns`, `use_integrations` and `manage_contacts`, and the workspace needs a paid plan that includes integrations. Turning it on also turns on the campaign's keep running for new leads. It sets state, so a repeat is safe without an `Idempotency-Key`.

| Code                        | Status | When                                                                                              |
| --------------------------- | ------ | ------------------------------------------------------------------------------------------------- |
| `lead_finder_plan_required` | 403    | The workspace has no paid plan that includes integrations                                         |
| `agent_workspace_unclaimed` | 403    | The workspace was opened by an AI agent and nobody has claimed it yet                             |
| `forbidden`                 | 403    | The member behind a key or an app lacks `send_campaigns`, `use_integrations` or `manage_contacts` |
| `lead_finder_no_brain`      | 409    | The campaign has no brain, or its brain has neither an offer nor an audience                      |
| `campaign_not_found`        | 404    | No campaign with that id in this workspace                                                        |
| `lead_finder_disabled`      | 503    | The lead finder is not available                                                                  |

A member limited to selected campaigns cannot turn it on: every lead finder route answers them `403 member_access_restricted`. The lead finder rechecks the member it works as on every pass. When they leave the workspace, lose `send_campaigns`, `use_integrations` or `manage_contacts`, are limited to selected campaigns, or are banned, it turns itself off with `stop_reason: "enabler_lost_send"`.

Leads [#leads]

`GET /campaigns/:id/lead-finder/leads?limit=&cursor=` lists the people the lead finder added, newest first, as `data` plus `pagination`. `limit` is 1 to 200 (default 50). A bad cursor or limit answers `400`.

```json
{
  "data": [
    {
      "id": "5b7e...",
      "email": "jane@acme.io",
      "name": "Jane Cooper",
      "contact_id": "c41a...",
      "title": "VP Sales",
      "company": { "domain": "acme.io", "name": "Acme" },
      "score": 100,
      "score_version": 2,
      "explore": false,
      "parts": {
        "fit": { "points": 80, "max": 100, "known": true, "raw": 80 },
        "signals": { "points": 10, "max": 25, "known": true },
        "similar": { "points": 0, "max": 15, "known": false },
        "person": { "points": 10, "max": 10, "known": true }
      },
      "reasons": [
        { "code": "fit", "text": "Sells software to sales teams of the size the offer targets.", "points": 80, "url": "" },
        { "code": "hiring", "text": "Hiring for a related role: Account Executive.", "points": 10, "url": "https://jobs.example.com/acme/ae" },
        { "code": "title_match", "text": "Title matches a target title: VP Sales.", "points": 6, "url": "" },
        { "code": "seniority", "text": "Senior decision maker: VP Sales.", "points": 4, "url": "" }
      ],
      "enrolled_at": "2026-11-25T09:41:00Z",
      "outcome": {
        "first_sent_at": "2026-11-25T14:02:00Z",
        "replied_at": null,
        "reply_class": "",
        "reply_intent": "",
        "positive": false,
        "meeting_booked": false,
        "bounced": false,
        "unsubscribed": false
      }
    }
  ],
  "pagination": { "next_cursor": null, "has_more": false }
}
```

* `score` is 0 to 100 and `score_version` names the formula that made it. `parts` breaks it down: each part has the `points` it earned, its `max`, and whether it is `known`. In version 2 the score is the points of every part added up, at most 100, and the fit part's points are the fit verdict; version 1 averaged the known parts, with fit out of 50. `raw` is the fit verdict from 0 to 100. See [how a lead is scored](/guides/lead-finder/#how-a-lead-is-scored).
* `explore` is `true` for a [test sample](/guides/lead-finder/#the-test-sample) lead: its company was taken forward although its own score was under the cut-off, and the lead was added whatever its own score.
* `reasons` are short sentences with their points; `url` is an evidence link for a signal, else `""`. Codes are `fit`, `hiring`, `hiring_role`, `funding`, `similar_industry`, `similar_size`, `similar_country`, `title_match` and `seniority`.
* `outcome` is read live from the campaign: when the first email went out, a reply with its class and intent, whether the reply was positive, a meeting booked after the lead was added, a bounce and an unsubscribe.
* `name` is the contact's first and last name. It is left out when the contact has none.
* For a caller who may not view contacts (`view_contacts` / `READ_CONTACTS`), `email` is `""` and `name` is left out.
* `contact_id` is `null` once the contact was deleted.

Companies [#companies]

`GET /campaigns/:id/lead-finder/companies?status=&limit=&cursor=` lists every company the campaign looked at, newest first, including the skipped ones, with the same pagination. `status` is one of `found`, `rejected`, `qualified`, `searched` or `enrolled`. A bad cursor, limit or status answers `400`.

```json
{
  "data": [
    {
      "id": "e2f0...",
      "domain": "acme.io",
      "name": "Acme",
      "status": "enrolled",
      "reject_code": "",
      "score": 90,
      "score_version": 2,
      "parts": {
        "fit": { "points": 80, "max": 100, "known": true, "raw": 80 },
        "signals": { "points": 10, "max": 25, "known": true },
        "similar": { "points": 0, "max": 15, "known": false }
      },
      "reasons": [
        { "code": "fit", "text": "Sells software to sales teams of the size the offer targets.", "points": 80, "url": "" },
        { "code": "hiring", "text": "Hiring for a related role: Account Executive.", "points": 10, "url": "https://jobs.example.com/acme/ae" }
      ],
      "facts": {
        "industry": "software",
        "employees": 151,
        "employees_min": 51,
        "employees_max": 250,
        "country": "US",
        "description": "Sales engagement software for B2B teams."
      },
      "people_found": 3,
      "people_enrolled": 2,
      "spent_usd": 0.07,
      "created_at": "2026-11-25T09:30:00Z"
    }
  ],
  "pagination": { "next_cursor": null, "has_more": false }
}
```

* `status` is `found` (from the company search, not judged yet), `rejected` (skipped), `qualified` (passed the fit check), `searched` (people looked for, nobody added) or `enrolled` (at least one person added). When the target profile is built again, a `qualified` company goes back to `found` and is judged again.
* `reject_code` says why a `rejected` company was skipped: `low_fit`, `low_score`, `unjudged` (the fit check gave no verdict for it, even when asked about it alone), `lookup_failed` (its lookups were refused on every attempt), `existing`, `suppressed`, `personal_domain`, `own_domain`, `no_country`, `consent_country`, `outside_country`, `outside_size` or `hard_rule`. The guide's [cut-off](/guides/lead-finder/#the-cut-off) and [what it skips](/guides/lead-finder/#what-it-skips) say when each applies. A client should show an unknown code by its name.
* `score` is the company's own score over fit, signals and similar, or `null` when it was not scored. `parts` has no `person` part.
* `facts` is what the lead finder knew about the company when it judged it: `industry`, `country`, `description` (the company search's own words about the company, provider text), and its size. `employees_min` and `employees_max` are the size band, equal for an exact count, with `employees_max` left out for an open band such as 10,000 or more; `employees` is one number within that band. A key it did not know is left out, and a client should ignore a key it does not recognize.
* `spent_usd` counts the company's settled lookups plus what was set aside for lookups that had not settled, so it can be higher than what its lookups cost, never lower. The workspace is charged only for settled costs.

Realtime [#realtime]

`CAMPAIGN_LEAD_FINDER_UPDATED` fires when a campaign's lead finder is turned on or its settings change, and after a pass that changed it. It carries `org_id` and `campaign_id` only and requires `view_campaigns`; read the state again with `GET /campaigns/:id/lead-finder`. See [realtime](/api/realtime/).
