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

# Select Contacts per Company API

> Pick at most N contacts per company from a search, for example one lead per company - POST /search-contacts/select-with-cap

> [!NOTE]
>
> **Credit cost:** Free. It returns contact IDs only. Fetching them with [Fetch Contacts](https://api.smartlead.ai/api-reference/smart-prospect/fetch-contacts.md) spends credits as usual.

> [!NOTE]
>
> This endpoint requires your API key: pass it as the `api_key` query parameter, or in an `X-API-Key` or `Authorization: Bearer` header (see [Authentication](https://api.smartlead.ai/authentication.md)).

Use this for account-based outreach, when you want one (or a few) contacts per company instead of everyone who matches.

1. Run [Search Contacts](https://api.smartlead.ai/api-reference/smart-prospect/search-contacts.md) and keep its `filter_id`.
2. Call this endpoint with the same filters as `searchFilters`, `maxPerCompany: 1` and the number of contacts you want as `limit`.
3. Call [Fetch Contacts](https://api.smartlead.ai/api-reference/smart-prospect/fetch-contacts.md) with `filter_id` and `id` set to `selected_lead_ids`. Use [Estimate Fetch Cost](https://api.smartlead.ai/api-reference/smart-prospect/fetch-contacts-estimate.md) first to check the cost.

## Request Body

**searchFilters** `object` *required*

The filters, exactly as you sent them to [Search Contacts](https://api.smartlead.ai/api-reference/smart-prospect/search-contacts.md).

**maxPerCompany** `number` *required*

Most contacts to keep per company, 1 to 1000. `1` gives one lead per company.

**limit** `number`

Stop once this many contacts are selected. Omit to select across the whole result.

**netNewOnly** `boolean`

Leave out contacts you already own. Defaults to `true` when `limit` is set, else `false`.

**sort** `object`

Which contacts of a company come first: `{"field": "relevance" | "email_deliverability" | "last_modified", "order": "asc" | "desc"}`. Default `relevance`.

```bash cURL theme={null}
curl -X POST "https://prospect-api.smartlead.ai/api/v1/search-email-leads/search-contacts/select-with-cap" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"searchFilters": {"title": ["VP Sales"], "country": ["United States"]}, "maxPerCompany": 1, "limit": 400}'
```

## Response Fields

All fields are under `data`.

**selected\_lead\_ids** `string[]`

Contact IDs to send to Fetch Contacts as `id`

**selected\_count** `number`

Number of IDs selected

**distinct\_companies** `number`

Companies the selection covers

**companies\_capped** `number`

Companies that had more matches than `maxPerCompany`

**skipped\_count** `number`

Matches left out by the cap

**truncated** `boolean`

`true` when the scan stopped before the end of the result

## Response Codes

**200** `Success`

Selection returned

**400** `Bad Request`

Missing `searchFilters` or `maxPerCompany`, or filters that cannot be served

**401** `Unauthorized`

Missing or invalid API key

```json 200 - One per company theme={null}
{
  "success": true,
  "message": "Bulk selection computed",
  "data": {
    "selected_lead_ids": ["5f22b0c8cff47e0001616f81", "5f22b0c8cff47e0001616f99"],
    "selected_count": 2,
    "distinct_companies": 2,
    "companies_capped": 1,
    "skipped_count": 3,
    "truncated": false
  }
}
```


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