# Find a lead by external_id, or list leads

> Find a lead by external_id, or list leads: GET /leads.

**GET** `/leads`

With external_id: the one lead carrying your ID, as `{ data: lead }`.
external_id is unique per campaign, not per organization: a match in
two of the key's campaigns is 409 ambiguous_external_id with
`candidates` ([{ id, campaign_id }]); add campaign_id to pick one.

Without it: the key's leads, newest first, keyset-paged
(`starting_after` = the last lead's id), as
`{ data: [lead], meta: { next_cursor, has_more } }`. With a status
filter a page can hold fewer than `limit` leads while has_more is
true; keep paging with next_cursor. place_in_line is only given on
a single-lead read.

status is one of: new, queued, scheduled, held, dialing, on_call,
callback_scheduled, done, out_of_queue.

## Parameters

| Name | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `external_id` | query | string |  | At most 200 characters. |
| `campaign_id` | query | string (uuid) |  |  |
| `status` | query | string |  | One of `new` / `queued` / `scheduled` / `held` / `dialing` / `on_call` / `callback_scheduled` / `done` / `out_of_queue`. |
| `created[gte]` | query | string |  | Created at or after (ISO 8601 or unix seconds). |
| `limit` | query | integer |  | Default `20`. 1 to 100. |
| `starting_after` | query | string (uuid) |  |  |

## Example request

### curl

```bash
curl -X GET 'https://v2-api.callview.ai/api/v1/external/leads' \
  -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET"
```

### Node

```js
const auth = Buffer.from(`${process.env.CALLVIEW_KEY_ID}:${process.env.CALLVIEW_SECRET}`).toString('base64');

const res = await fetch('https://v2-api.callview.ai/api/v1/external/leads', {
  method: 'GET',
  headers: { Authorization: `Basic ${auth}` },
});
console.log(res.status, res.headers.get('request-id'));
console.log(await res.text());
```

### Python

```python
import os

import requests

res = requests.request(
    "GET",
    "https://v2-api.callview.ai/api/v1/external/leads",
    auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]),
    timeout=30,
)
print(res.status_code, res.headers.get("Request-Id"))
print(res.text)
```

### PHP

```php
<?php
$ch = curl_init('https://v2-api.callview.ai/api/v1/external/leads');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HEADER => false,
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n";
```

## Response

**200** With external_id, the one lead. Without it, a page of leads.

```json
{
  "data": {
    "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10",
    "external_id": "crm-10442",
    "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01",
    "name": "LEAD_NAME",
    "phone": "+15555550142",
    "email": "lead@example.com",
    "address": "1 Example Street, Springfield",
    "fields": {
      "roof_age": "12"
    },
    "consent": {
      "source": "web_form",
      "agreed_at": "2026-10-06T16:58:02Z",
      "url": "https://example.com/quote"
    },
    "lead_source": "Example CRM",
    "owner": null,
    "created": "2026-10-06T16:58:04.000Z",
    "updated": "2026-10-06T16:58:04.000Z",
    "status": "queued",
    "call_now": true,
    "place_in_line": 3,
    "estimated_wait_seconds": 90,
    "scheduled_for": null,
    "scheduled_reason": null,
    "held_reason": null,
    "callback_at": null,
    "late": false,
    "attempts": 0,
    "last_outcome": null,
    "last_outcome_label": null,
    "next_dial_at": null,
    "calls": [],
    "livemode": true
  }
}
```

## Errors

| Status | Codes |
| --- | --- |
| 400 | [`invalid_request`](https://developers.callview.ai/reference/errors/#invalid_request) |
| 401 | [`authentication_failed`](https://developers.callview.ai/reference/errors/#authentication_failed) |
| 403 | [`permission_denied`](https://developers.callview.ai/reference/errors/#permission_denied) |
| 404 | [`not_found`](https://developers.callview.ai/reference/errors/#not_found) |
| 409 | [`ambiguous_external_id`](https://developers.callview.ai/reference/errors/#ambiguous_external_id) |
| 429 | [`rate_limited`](https://developers.callview.ai/reference/errors/#rate_limited), [`too_many_concurrent_requests`](https://developers.callview.ai/reference/errors/#too_many_concurrent_requests) |
| 500 | [`internal_error`](https://developers.callview.ai/reference/errors/#internal_error) |

Part of [Leads](https://developers.callview.ai/reference/leads/). Every example sends your key ID and secret as `CALLVIEW_KEY_ID` and `CALLVIEW_SECRET` (see [Keys and authentication](https://developers.callview.ai/guides/authentication/)).
