# CallView API > CallView's AI phones your leads and your team takes over when someone wants to buy. The CallView API lets a CRM, a web form or any system hand leads to CallView and hear back what happened on each call. --- # Getting started Source: https://developers.callview.ai/ > Send leads to CallView and hear back what happened on the call. Guides, examples and the full API reference. CallView's AI phones your leads, and your team takes over when someone wants to buy. The CallView API lets your CRM, your web forms or any system you run hand leads to CallView and hear back what happened on each call. Send a lead, and the AI calls it, often within seconds. When the call is over, we send the outcome, a short note and links to the recording and transcript to your webhook. - [API reference](https://developers.callview.ai/reference/): Every endpoint, with examples in curl, Node, Python and PHP. - [Create an API key](https://developers.callview.ai/guides/create-an-api-key/): Make a key in Settings > API and choose what it can do. - [Quickstart](https://developers.callview.ai/quickstart/): Your first lead and your first webhook, in about 10 minutes. - [Download the OpenAPI description](https://developers.callview.ai/downloads/): openapi.json, openapi.yaml and a Postman collection. ## How a lead travels 1. You send the lead with [`POST /leads`](https://developers.callview.ai/reference/leads/add-a-lead/). 2. CallView's AI calls it, inside the campaign's calling hours. 3. If the lead wants to buy, someone on your team takes over the same call. 4. When the call is over, we send [`call.completed`](https://developers.callview.ai/reference/events/call-completed/) to your webhook. A test key runs all of this on sample data. It never phones anyone and never costs anything, so you can build the whole integration before you go live. See [Test mode](https://developers.callview.ai/guides/test-mode/). ## The basics | | | | --- | --- | | Address | `https://v2-api.callview.ai/api/v1/external`. Every path in this guide starts from there. | | Keys | A key ID (`ck_live_...` or `ck_test_...`) and a secret (`cs_live_...` or `cs_test_...`), made in CallView under Settings > API. See [Keys and authentication](https://developers.callview.ai/guides/authentication/). | | Format | JSON in and out. Phone numbers as `+1` and 10 digits. Times in UTC, like `2026-10-06T17:05:20Z`. | | Test or live | Every object says `"livemode": true` or `false`, so you can tell sample data from real data at a glance. | | Limits | Requests and new leads a minute per key, and optional day limits. See [Rate limits](https://developers.callview.ai/guides/rate-limits/) and [Money guards](https://developers.callview.ai/guides/money-guards/). | ## Where to go next - **Connecting a CRM?** Start with [How every recipe works](https://developers.callview.ai/recipes/), then the one for your tool: [your own CRM](https://developers.callview.ai/recipes/your-own-crm/), [HubSpot](https://developers.callview.ai/recipes/hubspot/), [GoHighLevel](https://developers.callview.ai/recipes/gohighlevel/), [Follow Up Boss](https://developers.callview.ai/recipes/follow-up-boss/), [Zapier](https://developers.callview.ai/recipes/zapier/) or [Make](https://developers.callview.ai/recipes/make/). - **Sending leads from a web form?** Read [Speed to lead](https://developers.callview.ai/guides/speed-to-lead/) and [Consent and calling hours](https://developers.callview.ai/guides/consent-and-calling-hours/). - **Receiving results?** Read [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) and the [list of events](https://developers.callview.ai/reference/events/). - **Working with an AI assistant?** Copy page, next to each page's title, copies the page as Markdown. [llms.txt](https://developers.callview.ai/llms.txt) lists every page, and [llms-full.txt](https://developers.callview.ai/llms-full.txt) holds the whole guide in one file. ## Getting help - **Help in the CallView app.** Open a ticket and paste the `Request-Id` header from the reply that looks wrong. We can find your exact request from it. - **Status.** [status.callview.ai](https://status.callview.ai) shows whether CallView is up. - **No place to make a key?** The API is switched on one organization at a time. If Settings > API has no keys section, open a ticket from Help and ask for it. --- # Create an API key Source: https://developers.callview.ai/guides/create-an-api-key/ > Make a key in CallView under Settings > API, choose its campaigns and what it can do, and copy the secret. Keys are made in the CallView app by an admin of your organization. Each key has its own campaigns and permissions, so give each system its own key. ## Make the key 1. **Open Settings > API.** Sign in to [CallView](https://agent.callview.ai) as an admin and open **Settings**, then **API**. If the page has no keys section, the API isn't switched on for your organization yet: open a ticket from **Help** and ask for it. 2. **Click + Create API key.** 3. **Name it** after the system that will use it, like `Website form - Roofing leads`. Only your team sees the name. 4. **Pick Test or Live.** A live key works with real leads and real calls. A test key gets sample data only: it doesn't call anyone or touch your real leads, so start with one. See [Test mode](https://developers.callview.ai/guides/test-mode/). 5. **Pick its campaigns.** Either **All campaigns, including ones you add later**, or **Only the ones I pick**. A key limited to some campaigns can't see or add leads anywhere else. 6. **Choose what it can do.** Start from a ready-made set, then tick or untick boxes: - **CRM speed to lead**: add leads, start their calls, and read outcomes and events. Most CRM hook-ups want this one. - **Reporting only**: read everything except recordings and transcripts. - **Full access**: every permission in every campaign. Only the organization's owner can make one. Two boxes need a closer look. **Start calls** lets the key put leads in a dial queue, which means the AI phones those people. **Recordings & transcripts** lets it download what the lead said. Leave both off a key that doesn't need them. [The permissions](https://developers.callview.ai/guides/authentication/#the-permissions) lists every box. 7. **Lead source** (optional). It's written on every lead the key adds, so your reports show where leads came from. 8. **Advanced** (optional). Here you can list **allowed IP addresses** (requests from anywhere else are refused) and set a date the key **stops working on**. The request limits are here too ([Rate limits](https://developers.callview.ai/guides/rate-limits/)), with **calls per day** and a **daily spend cap** for this key alone ([Money guards](https://developers.callview.ai/guides/money-guards/#limits-for-one-key)). 9. **Click Create key**, then copy the **key ID** (`ck_test_...` or `ck_live_...`) and the **secret** (`cs_test_...` or `cs_live_...`). The secret is shown this once. Store it somewhere safe, like your server's secret store, then click **I've stored it**. ## Try it Click **Test** on the key's row. CallView runs a few requests as that key (list campaigns, look up a lead, check a number against Do Not Call and so on) and shows the request and the reply. It runs from CallView's own server, so you don't need to paste the secret. Writes are a dry run. Then make your first real request: the [Quickstart](https://developers.callview.ai/quickstart/) takes about 10 minutes. ## After that - **Edit access** changes what the key can do, without a new secret. - **Roll secret** gives the key a new secret. The old one keeps working for a grace period you choose, so you can switch over without dropping a request. - **Revoke** stops the key. It stops working on the next request. - The **Usage** column shows each key's requests, leads, calls and cost, today and for the last 30 days. It updates every 5 minutes. Keep the secret on your server, not in a web page or a mobile app. [Keys and authentication](https://developers.callview.ai/guides/authentication/) covers sending the key and what to do if one leaks. --- # Quickstart Source: https://developers.callview.ai/quickstart/ > Make a test key, add a pretend lead, get call.completed on a request bin and check its signature. About 10 minutes. In about 10 minutes you'll add a lead with a test key, watch a pretend call play out, and receive its `call.completed` webhook, signed, on a page you can see in your browser. Nothing here dials a real person or costs anything. A test key only ever sees sample data. You need: a CallView login that can open Settings > API (an admin), a terminal with `curl`, and one campaign that is running. 1. **Make a test key.** In CallView, open **Settings > API** and click **+ Create API key**. Under Test or Live, pick Test, and let it use all campaigns. Under What it can do, pick Full access if you're the organization's owner. Otherwise tick Read and Write for Leads and Webhooks, Start calls, and Read for Campaigns, Calls and Events. Copy the key ID (`ck_test_...`) and the secret (`cs_test_...`). The secret is shown once, so put it somewhere safe now. Then, in your terminal: ```bash export CALLVIEW_KEY_ID=ck_test_paste_yours_here export CALLVIEW_SECRET=cs_test_paste_yours_here ``` 2. **Open a request bin.** Go to [webhook.site](https://webhook.site) and copy **Your unique URL**. Any public HTTPS address that shows you what it receives will do. 3. **Ask for `call.completed` events at that address.** ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Content-Type: application/json' \ -d '{ "url": "https://webhook.site/your-unique-id", "events": ["call.completed"] }' ``` The reply has a `secret` that starts with `whsec_`. Copy it: it's how you'll check our signature in step 7, and you won't see it again. Because you used a test key, this endpoint only ever gets test events. 4. **Find a campaign.** ```bash curl 'https://v2-api.callview.ai/api/v1/external/campaigns' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" ``` Copy the `id` of a campaign that is running in CallView. A test key sees your real campaigns' IDs and names, so the same `campaign_id` works later with a live key. You can also copy it in CallView: **Settings > API > Campaign IDs**, or **Copy campaign ID** in a campaign's ⋯ menu. 5. **Add a lead with the magic number `+15550100001`.** ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/leads' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: quickstart-lead-1' \ -d '{ "campaign_id": "PASTE_THE_CAMPAIGN_ID", "external_id": "quickstart-1", "phone": "+15550100001", "name": "Test Lead", "call_now": true, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } }' ``` You get `201` and `"status": "queued"`. In test mode, `+15550100001` plays a call where the lead is interested and someone on your team takes over. [Test mode](https://developers.callview.ai/guides/test-mode/) lists the other magic numbers. > **Note** > > If the reply says `"status": "held"` with `"held_reason": "campaign_paused"`, the campaign isn't running. Pick one that is, or start it in CallView. A held lead waits, just as it would for real. 6. **Watch the request bin.** The pretend call starts a few seconds later and lasts about three and a half minutes, like a real one. Then `call.completed` arrives at your bin with `"outcome": "interested"` and `"livemode": false`. Names and notes are placeholders such as `LEAD_NAME` and `AI_NOTE`. You can also ask where the lead is at any time: ```bash curl 'https://v2-api.callview.ai/api/v1/external/leads?external_id=quickstart-1' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" ``` 7. **Check the signature.** In the request bin, copy the **raw** body into a file called `body.json`, and copy the `CallView-Signature` header (it looks like `t=1791306131,v1=5257a8...`). Save one of these as a file, then run it with your `whsec_` secret: ## Node ```bash node verify-signature.js whsec_your_secret 't=...,v1=...' body.json ``` ## Python ```bash python verify_signature.py whsec_your_secret 't=...,v1=...' body.json ``` ## PHP ```bash php verify-signature.php whsec_your_secret 't=...,v1=...' body.json ``` The files are on [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/#check-the-signature). It prints `valid`. > **Caution** > > Do this within 5 minutes of the delivery. A signature older than that is refused on purpose, so nobody can replay an old event at you. Missed it? Send yourself a fresh one with [Send a test event](https://developers.callview.ai/reference/webhook-endpoints/send-a-test-event/). ## What next - Wire your CRM to send leads as they arrive: [Speed to lead](https://developers.callview.ai/guides/speed-to-lead/). - Handle every event, retries and repeats included: [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/). - Try the other magic numbers (voicemail, no answer, a callback): [Test mode](https://developers.callview.ai/guides/test-mode/). - Ready for real calls? Make a live key, point a live webhook endpoint at your server, and change nothing else. Prefer clicking to typing? Import the [Postman collection](https://developers.callview.ai/downloads/). Its Quickstart folder runs steps 3 to 6 for you. --- # Keys and authentication Source: https://developers.callview.ai/guides/authentication/ > Test and live keys, how to send them, what a key may touch, and what to do if one leaks. Every request carries a key. A key is two parts: | Part | Looks like | Is it secret? | | --- | --- | --- | | Key ID | `ck_live_8Fq2LmZ0pR4tV6xY9aBcDe` | No. Safe to show and to log. | | Secret | `cs_live_...` (43 more characters) | Yes. Shown once, when you make the key. | Test keys start `ck_test_` and `cs_test_`. ## Sending the key Use either of these. Both work on every endpoint. **HTTP Basic**: the key ID as the username and the secret as the password. Most tools do this for you: ```bash curl -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" 'https://v2-api.callview.ai/api/v1/external/campaigns' ``` **Bearer**: the secret alone: ```bash curl -H "Authorization: Bearer $CALLVIEW_SECRET" 'https://v2-api.callview.ai/api/v1/external/campaigns' ``` Always use `https://`. Never send a key over plain `http://`: the request is not processed, but the key has already crossed the network unencrypted, so roll it. Today a plain `http://` request gets a `301` redirect to `https://` (don't follow it: many HTTP clients turn a redirected `POST` into a `GET`); behind CallView's edge it gets a `403` and never reaches the API. A missing, wrong, revoked or expired key gets `401` with the code `authentication_failed`. The `reason` field says which one. After 20 failed tries from one address in 5 minutes, that address is blocked for 15 minutes (`429`). Keys work only on the API described here (`/api/v1/external`). They can't sign in to the CallView app or reach anything else. ## Test keys and live keys A **live key** works with your real leads and calls, and the leads you add get called. A **test key** doesn't dial anyone and costs nothing. It can't see or change real leads or calls: it gets sample data in the same shapes, so you can build your whole integration with it. See [Test mode](https://developers.callview.ai/guides/test-mode/). Both see your real campaign IDs and names, so moving from test to live means changing the key and nothing else. ## What a key may touch When you make a key in **Settings > API**, you choose: - **Which campaigns.** A key limited to some campaigns can't see or add leads anywhere else. Asking about another campaign gets `403 permission_denied`. - **What it can do.** Read or Write, area by area (the table below). A request outside that gets `403 permission_denied`, and `missing_permission` names what's missing, for example `dialing:write`. - **A lead source** (optional): stamped on every lead the key adds, so you can tell where leads came from. - **Allowed IP addresses** (optional): requests from anywhere else are refused. - **When it stops working** (optional). - **Limits**: requests and new leads a minute, see [Rate limits](https://developers.callview.ai/guides/rate-limits/). - **Day limits** (optional): calls per day and a daily spend cap, for this key alone. See [Money guards](https://developers.callview.ai/guides/money-guards/#limits-for-one-key). ### The permissions | Permission | In the app | What it allows | | --- | --- | --- | | `leads:read` | Leads: read | See leads and where they are | | `leads:write` | Leads: write | Update a lead (`PATCH /leads/{id}`) and opt it out. Adding a lead needs Start calls too. | | `calls:read` | Calls: read | See calls, outcomes and notes | | `calls:write` | Calls: write | Call a lead now (`POST /calls`), together with Start calls | | `dialing:write` | Start calls | Anything that puts a lead in a dial queue or starts dialing: `POST /leads`, `POST /leads/batch`, `POST /campaigns/{id}/leads` and its batch, `POST /calls`, and starting a campaign (`POST /campaigns/{id}/activate`). A `dry_run` needs it too. | | `recordings:read` | Recordings & transcripts | `GET /calls/{id}/recording` and `GET /calls/{id}/transcript`, together with Calls: read | | `campaigns:read` | Campaigns: read | See the campaigns | | `campaigns:write` | Campaigns: write | Start and pause them. Starting one (`POST /campaigns/{id}/activate`) needs Start calls too, because a started campaign dials its waiting leads. | | `callbacks:read` | Callbacks: read | See booked callbacks | | `callbacks:write` | Callbacks: write | Book and cancel them | | `dnc:read` | Do Not Call: read | Check numbers | | `dnc:write` | Do Not Call: write | Add and remove numbers | | `webhooks:read` | Webhooks: read | See endpoints and deliveries | | `webhooks:write` | Webhooks: write | Add, change and re-send | | `events:read` | Events: read | See events | | `usage:read` | Usage: read | See usage and cost. Only the organization's owner can give it. | Start calls is its own box because adding a lead to a running campaign means the AI phones that person. A key with Leads: write and no Start calls can keep your leads up to date but can't start a call. Recordings & transcripts is its own box because a recording is what the lead actually said. A key can read every outcome and note without it. ### The ready-made sets Three sets fill in the boxes for you. Change any box afterwards. | Set | Campaigns | Permissions | | --- | --- | --- | | CRM speed to lead | You pick them | `leads:read`, `leads:write`, `calls:read`, `dialing:write`, `events:read` | | Reporting only | All | `leads:read`, `calls:read`, `campaigns:read`, `callbacks:read`, `dnc:read`, `webhooks:read`, `events:read`, `usage:read` (each read permission except recordings and transcripts) | | Full access | All | Every permission. Only the organization's owner can make one. | Give each system its own key, with only what it needs. A CRM that sends leads and reads outcomes needs Leads (read and write), Start calls, Calls (read) and Events (read): the CRM speed to lead set. Tick Recordings & transcripts as well only if the CRM stores recordings or transcripts. Keys made before Start calls and Recordings & transcripts existed kept what they could do: every key with Leads: write, Calls: write or Campaigns: write was given Start calls, and every key with Calls: read was given Recordings & transcripts. Untick them on keys that don't need them. ## Keeping keys safe Keep the secret on your server. Don't put it in a web page, a mobile app or a public repository. - **Roll** a key in Settings > API to get a new secret without making a new key. The old secret keeps working for a grace period you choose (24 hours unless you pick another, at most 7 days), so you can switch over without dropping a request. - **Revoke** a key you no longer use. It stops working on the next request. - If a secret leaks, revoke the key right away, or roll it with a grace period of 0 so the leaked secret dies at once. --- # Test mode Source: https://developers.callview.ai/guides/test-mode/ > Build your integration with a test key. Sample data only, magic numbers that play out real call flows with real timing, and the placeholders you'll see. A test key (`ck_test_...`, `cs_test_...`) works on every endpoint, but it only ever touches sample data: - It doesn't dial anyone, and it costs nothing. - It can't see or change your real leads, calls, Do Not Call list or events. - Every reply has the same shape as a live one, with `"livemode": false`. - It does see your real campaign IDs and names, so the same `campaign_id` works later with a live key. Everything else is real: the key's permissions and campaigns, the rate limits, `Idempotency-Key`, and every check and error code that doesn't need real data. ## Magic numbers The phone number you send picks what the pretend call does. Each one sends the same events, in the same order and with the same timing, as a real call would. | Phone | What the call does | Events after `lead.created` and `lead.queued` | `call.completed` arrives | | --- | --- | --- | --- | | `+15550100001` | Answers, is interested, an SDR takes the call | `call.started`, `call.answered`, `lead.interested`, `handover.accepted`, `call.completed` | 216 seconds after you add the lead | | `+15550100002` | A voicemail is left | `call.started`, `call.answered`, `voicemail.left`, `call.completed` | 71 seconds | | `+15550100003` | No answer | `call.started`, `call.completed` | 41 seconds | | `+15550100004` | Busy | `call.started`, `call.completed` | 15 seconds | | `+15550100005` | Asks not to be called again | `call.started`, `call.answered`, `lead.opted_out`, `call.completed` | 44 seconds | | `+15550100006` | Books a callback for tomorrow at 14:00 UTC | `call.started`, `call.answered`, `callback.booked`, `call.completed` | 121 seconds | | `+15550100007` | Wrong number | `call.started`, `call.answered`, `call.completed` | 41 seconds | | Anything else | One of the seven above | The same as that one | | For any other number, the flow is picked from your `external_id` (or the phone, if you send no `external_id`). The same input always gets the same flow, so you can run a test again and get the same result. How the pretend calls behave: - The call only happens for a `call_now` lead (`"call_now": true`, or a campaign that calls new leads straight away). Without it, the lead waits in the queue. - In a paused or not-yet-started campaign, the lead is held: you get `lead.created` and then `lead.queued` with `status: "held"`, and no call, just like live. - Add the field `"test_late": "true"` (in `fields`) to a `call_now` lead to get `lead.late` 15 seconds after it's queued. The call starts after that. Live only marks `call_now` leads late, so a lead without `call_now` gets no `lead.late`. - `POST /leads/{id}/opt_out` and `POST /dnc` (or `/dnc/batch`) send `lead.opted_out` for your test leads with that number, as live. The real Do Not Call list is never touched. - `POST /calls` on a test lead plays its call again, up to 3 times in 24 hours, as live. - A test key needs the same [permissions](https://developers.callview.ai/guides/authentication/#the-permissions) as a live one: Start calls to add a lead or use `POST /calls`, and Recordings & transcripts for the sample recording and transcript. A key's own [day limits](https://developers.callview.ai/guides/money-guards/#limits-for-one-key) never hold a test lead: pretend calls cost nothing. - A test key can have 20 pretend calls going at once. Past that you get `429 test_flows_busy` with `Retry-After`. - Test leads and calls are deleted after 7 days. ## Placeholders Test replies and test events carry no real data. Where a live reply would have a person's details, you get these: | Field | Test value | | --- | --- | | Lead name | `LEAD_NAME` | | Lead email | `LEAD_EMAIL` | | Lead address | `LEAD_ADDRESS` | | Phone | The magic number you sent, otherwise `+15550100001` | | Your custom fields | Your field names, each with the value `FIELD_VALUE` | | `consent.ip` | `LEAD_IP` (the rest of `consent` is what you sent) | | `external_id` | What you sent | | The AI's note | `AI_NOTE` | | `intent.excerpt` (what the lead said) | `INTENT_EXCERPT` | | `handled_by` | `{ "id": "usr_test_sdr", "name": "SDR_NAME", "role": "sdr" }` | | `owner` | `{ "id": "usr_test_owner", "name": "OWNER_NAME" }` | | Recording link | `https://developers.callview.ai/samples/recording.mp3` | | Transcript lines | `AI_LINE_1`, `LEAD_LINE_1`, `SDR_LINE_1` and so on | | Callback time zone | `UTC` | | Export file | `https://developers.callview.ai/samples/export.csv` | ## The other areas | Area | With a test key | | --- | --- | | Do Not Call | Only `+15550100005` is "on the list". Adding or removing numbers answers as live, and your real list stays as it was. | | Campaigns | You see each campaign's `id` and `name`. Starting or pausing one answers with the status it would have, and the real campaign stays as it is. | | Exports | You get the sample file above. | | Webhooks | Endpoints made with a test key are test endpoints. They get test events only, and live endpoints don't get test events. | | Usage | `GET /usage` counts only your test requests and leads. None of it is billed. | ## Send a test event To try your receiver without waiting for a call, send yourself any event: ```bash curl -X POST "https://v2-api.callview.ai/api/v1/external/webhook_endpoints/$ENDPOINT_ID/test" \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Content-Type: application/json' \ -d '{ "type": "lead.interested" }' ``` It's that event's example, marked `"sample": true`, signed and retried like a real delivery. It works with a live key on a live endpoint too. --- # Rate limits Source: https://developers.callview.ai/guides/rate-limits/ > How many requests a key can make, what happens past a limit, and the headers that tell you where you stand. Each key has these limits: | Limit | Default | Past it | | --- | --- | --- | | Requests at the same time | 20 | `429 too_many_concurrent_requests` | | Requests a minute | 120, with bursts of up to 20 at once | `429 rate_limited` | | New leads a minute | 60 (each lead in a batch counts) | `429 lead_rate_limited` | Your organization's plan also has a limit on requests a minute, across all your keys together (`429 rate_limited`). Every plan allows at least 120 a minute, so one key at its default can always use its whole limit. An admin can change a key's limits in Settings > API. Requests at the same time can be anything from 1 to 50. "120 a minute with bursts of 20" means you can send 20 requests at once, then about 2 a second after that, up to 120 in any minute. ## Past a limit You get `429` at once, with a `Retry-After` header: the seconds to wait. **We never hold a request in a queue**, so a `429` comes back fast and you decide what to do. Wait, then send the same request again (with the same `Idempotency-Key` for a write; see [Safe retries](https://developers.callview.ai/guides/idempotency/)). ## Where you stand Every answer carries: | Header | What it says | | --- | --- | | `RateLimit-Limit` | Requests allowed a minute (the tighter of your key's and your plan's). | | `RateLimit-Remaining` | How many are left this minute. | | `RateLimit-Reset` | Seconds until the minute starts again. | ## Tips - Sending many leads? Use `POST /leads/batch` (up to 60 in one request, a minute's worth of new leads). It's one request toward the per-minute limit, though each lead still counts toward new leads a minute. - Don't ask for the same thing in a loop. Use [webhooks](https://developers.callview.ai/guides/webhooks/) to hear about changes, and `GET /events` to catch up. - Give each system its own key, so one busy system can't use up another's limits. --- # Paging and filters Source: https://developers.callview.ai/guides/paging/ > Get long lists page by page, and narrow them by date, campaign, status or your own ID. Lists come back one page at a time, newest first: ```json { "data": [ { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "...": "..." } ], "meta": { "next_cursor": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "has_more": true } } ``` For the next page, send `starting_after` with the `next_cursor` you got. When `has_more` is `false`, you have it all. There are no page numbers and no totals: that keeps every page fast, however long the list. ```bash curl 'https://v2-api.callview.ai/api/v1/external/calls?limit=100&starting_after=e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" ``` | List | Page size (default, most) | Next page with | | --- | --- | --- | | `GET /leads` | 20, 100 | `starting_after` | | `GET /calls` | 50, 100 | `starting_after` | | `GET /events` | 50, 100 | `starting_after` | | `GET /webhook_endpoints/{id}/deliveries` | 25, 100 | `starting_after` | | `GET /campaigns`, `GET /dnc`, `GET /campaigns/{campaignId}/leads` | 50, 100 | `cursor` | The last row are older lists. They work the same way, but the parameter is called `cursor`. With a `status` filter on `GET /leads`, a page can have fewer leads than `limit` while `has_more` is still `true`. Keep going until `has_more` is `false`. ## Filters | Filter | Works on | Example | | --- | --- | --- | | `created[gte]`, `created[lte]` | `/calls`, `/events` (and `created[gte]` on `/leads`) | `created[gte]=2026-10-01` or `created[gte]=1791306131` | | `campaign_id` | `/leads`, `/calls`, `/events` | `campaign_id=7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01` | | `external_id` | `/leads`, `/calls` | `external_id=crm-10442` | | `status` | `/leads`, `/webhook_endpoints/{id}/deliveries` | `status=queued` | | `outcome` | `/calls` | `outcome=interested` | | `type` | `/events` | `type=call.completed,lead.interested` | | `lead_id`, `object_id` | `/calls`, `/events` | `object_id=2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10` | Dates are UTC: a plain date like `2026-10-01` means midnight UTC. Unix seconds work too. Some tools need the square brackets written as `%5B` and `%5D`. --- # Errors and retries Source: https://developers.callview.ai/guides/errors/ > The one error shape, which errors to retry and which to fix, and how to get help with one. Every error has the same shape, from every endpoint: ```json { "error": { "type": "invalid_request_error", "code": "duplicate_lead", "message": "A lead with this external_id already exists in this campaign.", "param": "external_id", "request_id": "req_6f1c2a9b0d3e4f5a6b7c8d9e0f1a2b3c", "lead_id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10" } } ``` - `code` is a fixed word. Write your code against it. [Error codes](https://developers.callview.ai/reference/errors/) lists every one. - `message` is for people. It can change, so don't match on it. Phone numbers and emails in it are partly hidden. - `param` names the field the error is about, when there is one. - `reason` sometimes adds the exact cause, for example why a key was refused. - `request_id` matches the `Request-Id` header. Quote it when you ask us for help: open a ticket from Help in the CallView app. ## Retry, or fix? | What you got | What to do | | --- | --- | | `429` (`rate_limited`, `too_many_concurrent_requests`, `lead_rate_limited`, `queue_full`, `call_limit_reached`, `test_flows_busy`) | Wait the number of seconds in `Retry-After`, then send the same request again. | | `409 idempotency_in_progress` | Your first request with this `Idempotency-Key` is still running. Wait `Retry-After` and send it again. | | `500 internal_error`, `503 service_unavailable`, or no answer at all | Retry with the same `Idempotency-Key`, waiting longer each time (1 s, 2 s, 4 s and so on). The key makes sure nothing happens twice. | | Any other `4xx` | Sending it again gets the same answer. Fix the request, or record the refusal. | Some refusals are answers, not mistakes. `duplicate_lead` tells you that you already sent this lead, and `on_dnc_list` that the person asked not to be called. Record them in your CRM and move on. ## Common ones | Code | Usually means | | --- | --- | | `authentication_failed` | Wrong key ID or secret, a revoked or expired key, or a secret that was rolled. `reason` says which. | | `permission_denied` | The key can't do this, or can't use this campaign. The message says what's missing. | | `invalid_request` | A field is missing, unknown or the wrong type. `param` names it. Unknown fields are refused, so a typo like `phon` is caught. | | `invalid_phone` | Not a US or Canadian number. | | `not_found` | No such object, or it belongs to a campaign the key can't use. We don't say which. | | `duplicate_lead` | Already in this campaign. `lead_id` is the lead you have. | Bodies over 1 MB, and broken JSON, get `400 invalid_request`. --- # Versions and changes Source: https://developers.callview.ai/guides/versioning/ > What we may change without warning, what we never change without notice, and how to tell. The API's version is in the address: `/api/v1/external`. Events also say which version made them, in `api_version` (today `2026-10-01`). ## What we may add at any time These don't break a well-written integration, so we add them without notice: - New endpoints. - New fields in replies and events. - New event types (you only get the ones you ask for). - New error codes, outcome words, statuses and `reason` values. - New optional fields in requests. So: ignore fields you don't know, and have a sensible default for a code or word you haven't seen. ## What we never change without notice Renaming or removing a field, an endpoint, an error code, an outcome word or an event type. That gets at least 6 months' notice, and the old way keeps working until then. An endpoint on its way out answers with a `Deprecation: true` header, and the reference marks it as old. For example, the first webhook endpoints (`/webhooks`) still work, but point you to `/webhook_endpoints` with a `Link` header. ## Later We plan to add dated versions you can pin, sent as a `CallView-Version` header, so you can move to a new version when it suits you. Until then there is one version, and the rules above apply. --- # Downloads Source: https://developers.callview.ai/downloads/ > The API description (OpenAPI 3.1, JSON and YAML) and a Postman collection with the Quickstart. These are made from the same description the API is tested against, so they match what it does today. | File | What it's for | | --- | --- | | [openapi.json](https://developers.callview.ai/openapi.json) | The whole API as OpenAPI 3.1. Load it into a code generator, an API client, or a mock server. | | [openapi.yaml](https://developers.callview.ai/openapi.yaml) | The same, as YAML. | | [callview.postman_collection.json](https://developers.callview.ai/callview.postman_collection.json) | Every endpoint as a Postman request, plus the Quickstart. | ## Postman 1. In Postman, choose **Import** and pick `callview.postman_collection.json`. 2. Open the collection's **Variables** and fill in: - `key_id`: your key ID (use a test key, `ck_test_...`, while you build) - `key_secret`: your secret (`cs_test_...`) - `request_bin_url`: an address that shows what it receives, such as one from [webhook.site](https://webhook.site) 3. Run the requests in the **Quickstart** folder in order. Each one saves what the next one needs (the campaign, the lead, the webhook secret). Every request takes its login from the collection, so you set the key once. Writes send a fresh `Idempotency-Key` each time. ## Samples Test mode links to these: - [samples/recording.mp3](https://developers.callview.ai/samples/recording.mp3): the sample recording (a few seconds of silence) - [samples/export.csv](https://developers.callview.ai/samples/export.csv): the sample export file --- # Speed to lead Source: https://developers.callview.ai/guides/speed-to-lead/ > What happens after POST /leads. The checks, the queue, call now, held and scheduled leads, late leads, and the 5,000-lead limit. When you send a lead with `POST /leads`, it goes straight into its campaign's dial queue. A `call_now` lead goes to the front, so a lead from your web form can be on the phone within seconds. ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/leads' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: crm-10442-create' \ -d '{ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "crm-10442", "phone": "+12125557812", "name": "Dana Smith", "fields": { "roof_age": "12" }, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" }, "call_now": true }' ``` `campaign_id` is CallView's ID for the campaign the lead goes into. Get it once from [`GET /campaigns`](https://developers.callview.ai/reference/campaigns/), which lists each campaign's `id` and `name`, or copy it in CallView (**Settings > API > Campaign IDs**, or **Copy campaign ID** in a campaign's ⋯ menu), and keep it in your settings. It's the same for test and live keys. `external_id` is your own ID for the lead, such as the contact's ID in your CRM. Send it every time: it stops repeats, and you can look the lead up by it later. `fields` are your own fields, and the campaign's script can use them. The key needs Leads: write and Start calls (`dialing:write`), because adding a lead to a running campaign means calling it. See [Keys and authentication](https://developers.callview.ai/guides/authentication/#the-permissions). ## The checks Before anything is stored, the lead is checked in this order. The first one that fails is your answer, and nothing is saved. | Check | If it fails | | --- | --- | | The campaign exists and isn't finished | `404 not_found` or `409 campaign_closed` | | The phone is a US or Canadian number, `+1` and 10 digits | `400 invalid_phone` | | Not a premium-rate or international number | `422 number_not_allowed` (see [Money guards](https://developers.callview.ai/guides/money-guards/)) | | Not on your Do Not Call list | `422 on_dnc_list` | | Not a number the campaign retired after repeated failed calls | `422 number_retired` | | Not already in the campaign (same `external_id`, or same phone) | `409 duplicate_lead`, with `lead_id` naming the one that exists | | Consent is there, if the campaign asks for it | `422 consent_required` | | The campaign has fewer than 5,000 API leads waiting | `429 queue_full`, with `Retry-After` | Numbers in the 555-0100 to 555-0199 range are made up, so they fail as `invalid_phone` (in test mode, the [magic numbers](https://developers.callview.ai/guides/test-mode/) are the exception). Add `"dry_run": true` to run every check and get the answer without saving anything. It's handy for testing a form. ## The answer `201` means the lead was accepted. `status` tells you what happens next: | `status` | What it means | | --- | --- | | `dialing` | A line is free. It's being called now. `place_in_line` is 0. | | `queued` | Waiting for a free line. `place_in_line` is 1 when it's next, and `estimated_wait_seconds` is a rough guess. | | `scheduled` | It can't be called yet. `scheduled_for` says when (UTC) and `scheduled_reason` says why: `outside_calling_hours`, or `recent_contact_cooldown` when another of your campaigns called the number in the last 24 hours. Reading the lead later (`GET /leads/{id}`, lead events) gives the same reason while that time stands, and can also say `next_dial_time` (CallView moved its next try, say for a retry wait) or `retry_after_outcome` (the last call ended in an outcome it tries again after, like no answer). | | `held` | Kept, but nothing is dialing: `held_reason` is `campaign_paused`, `campaign_not_started`, `spend_cap_reached` (your organization's API spend cap) or `key_limit_reached` (this key's own calls per day or daily spend cap, see [Money guards](https://developers.callview.ai/guides/money-guards/#limits-for-one-key)). It's called once the hold lifts. | ```json { "data": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } } ``` The place and the wait are estimates, made from the campaign's free lines and its recent call lengths. ## Call now With `call_now: true` the lead jumps ahead of the campaign's other leads. Among `call_now` leads, the oldest goes first, so none keeps slipping back when many arrive at once. Leave `call_now` out and the campaign's own setting decides. `call_now` never goes past the campaign's lines. If the campaign has 5 lines and all 5 are on calls, your lead waits for the first one to free up. That's why the queue exists: the limit is phone lines, not the API. To call an existing lead again right away, use `POST /calls` with its `lead_id` or `external_id` (the key needs Calls: write and Start calls). Each lead can be called this way 3 times in 24 hours (`429 call_limit_reached` after that). ## Late leads If a `call_now` lead is still waiting 15 minutes after it arrived (each campaign can change that number), it's still called, but we mark it late: `"late": true` on the lead, and a `lead.late` event goes to your webhook. Use it to warn someone, or to follow up another way. ## The 5,000-lead limit Each campaign holds at most 5,000 API leads waiting to be called. Past that you get `429 queue_full` with `Retry-After` (in seconds). Nothing is lost: send the lead again later. Leads you load into the campaign in the app don't count toward this. ## Repeats The same `external_id`, or the same phone, in the same campaign within 30 days is a duplicate: `409 duplicate_lead`, and `error.lead_id` is the lead you already have. Each campaign can change the 30 days. After that window, sending the lead again puts the existing lead back in the queue. You get `200` with `"requeued": true` and the same `id`. ## Many leads at once `POST /leads/batch` takes up to 60 leads. Each one gets the same checks and its own result, in the order you sent them, and one bad lead doesn't stop the rest: ```json { "data": { "succeeded": 1, "failed": 1, "dry_run": false, "results": [ { "index": 0, "ok": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "status": "queued", "...": "..." } }, { "index": 1, "ok": false, "error": { "code": "duplicate_lead", "message": "...", "param": "external_id", "lead_id": "..." } } ] } } ``` Every lead in a batch counts toward your 60 new leads a minute. ## Following the lead - `GET /leads/{id}` or `GET /leads?external_id=crm-10442` says where it is: `new`, `queued`, `scheduled`, `held`, `dialing`, `on_call`, `callback_scheduled`, `done` or `out_of_queue`, with its last 10 calls. - The events tell you as it happens: `lead.created` and `lead.queued` right away, then `call.started`, `call.answered`, `lead.interested`, `handover.accepted` and `call.completed`. See [Events](https://developers.callview.ai/reference/events/). - `PATCH /leads/{id}` changes the name, email, address, fields or consent. The phone can't change: add a new lead instead. - `POST /leads/{id}/opt_out` stops all calls to the number and adds it to your Do Not Call list. --- # Outcomes Source: https://developers.callview.ai/guides/outcomes/ > The fixed words a call's outcome can be, what each one means, and how corrections arrive. Every finished call has an `outcome`: one word from a fixed list. Build your CRM rules on these words. Renaming or removing one takes at least 6 months' notice. We may add new ones, so treat a word you don't know as `other`. Next to it, `outcome_label` is your organization's own name for the outcome, the one your team sees in the app (for example `Hung Up`). Show it to people; branch on `outcome`. | `outcome` | What happened | | --- | --- | | `interested` | The lead wants what you offer. Usually someone on your team took the call (`handled_by` says who). | | `not_interested` | The lead said no. | | `callback` | A time to call back was booked. `callback_at` has it, in UTC. | | `voicemail` | We left a voicemail, and it was delivered. A message that didn't go through doesn't count. | | `no_answer` | Nobody picked up. This includes a mailbox that was full or not set up. | | `busy` | The line was busy. | | `failed` | The call didn't connect, or a phone menu never reached a person. | | `dnc` | The lead asked not to be called again. The number is now on your Do Not Call list, and `lead.opted_out` was sent too. | | `wrong_number` | The person who answered isn't the lead. | | `hung_up` | Someone answered, spoke, then hung up before anything was decided. | | `screened` | A call screener or an assistant answered, and the lead didn't come on. | | `language_barrier` | The person who answered doesn't speak English. | | `not_qualified` | The lead talked, but doesn't fit what the campaign is for. | | `undetermined` | Our after-call check couldn't tell what happened. Not knowing isn't a "no", so it has its own word. | | `other` | An outcome your team made up, or none. `outcome_label` has the name. A call a person handled that nobody filed within 10 minutes arrives as `other` with the note "No outcome was filed". | `outcome` is `null` while the call has no outcome yet. ## The note `note` is a sentence or two on what was said, written by the AI after the call (or typed by the person who took it). For example: "Wants a quote for a 6 kW system; home owner, roof replaced 2019." ## When the outcome is final `call.completed` is sent once the outcome is final: | The call | `call.completed` is sent | | --- | --- | | Only the AI spoke to the lead | A few seconds after it ends, once our after-call check has looked at it | | Someone on your team took it | When they file the outcome, or after 10 minutes if they don't | If someone corrects the outcome later, `call.completed` is sent again for the same call, with `revision` 2 (then 3 and so on) and a newer `updated`. Keep the one with the highest `revision`. ## Filtering by outcome ```bash curl 'https://v2-api.callview.ai/api/v1/external/calls?outcome=interested&created[gte]=2026-10-01' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" ``` Each lead also carries `last_outcome` and `last_outcome_label`, the outcome of its latest finished call. --- # Consent and calling hours Source: https://developers.callview.ai/guides/consent-and-calling-hours/ > Sending proof of consent, when leads get called, the Do Not Call list, and opt-outs. Calling people comes with rules. CallView applies these on every call, whatever a request asks for. ## Consent Send what the lead agreed to with the lead. We store it and return it with the lead: ```json "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote", "text": "I agree to be called about solar quotes at the number above.", "ip": "203.0.113.9" } ``` | Field | Required | What to put | | --- | --- | --- | | `source` | yes | Where they agreed: `web_form`, `crm`, `purchased_list` or your own word. | | `agreed_at` | yes | When, with a time zone (`Z` for UTC). | | `text` or `url` | one of them | The words they agreed to, or the page they agreed on. | | `ip` | no | Their IP address at the time, if you have it. | Campaigns ask for consent on every API lead unless someone turns that off for the campaign in CallView. A lead without it then gets `422 consent_required`. Send consent whenever you have it, even when it's not required. ## Calling hours A lead is only called during its campaign's calling hours, and never before 8 AM or after 9 PM in the lead's own time zone. We work out the time zone from the phone number's area code. If you send a lead outside those hours, it isn't refused. You get `"status": "scheduled"` with `"scheduled_reason": "outside_calling_hours"`, and `scheduled_for` is the first minute it can be called (in UTC). It's called then. A campaign can be set in CallView to call at any hour, for leads who asked to be called right away. That's a choice made in the app; the API can't switch it on. ## Not calling the same person twice If another of your campaigns (or an inbound call) reached the same number in the last 24 hours, the lead waits until that 24 hours is up: `"status": "scheduled"`, `"scheduled_reason": "recent_contact_cooldown"`. The person doesn't hear from you twice in a day. ## The Do Not Call list Your organization has one Do Not Call list, shared by every campaign. A number on it is never called: - `POST /leads` with that number gets `422 on_dnc_list`, and `POST /calls` does too. - The list is checked again just before each call, so a number added after the lead was queued is still skipped. To manage the list: `GET /dnc/check?phone=...`, `POST /dnc`, `POST /dnc/batch` and `DELETE /dnc/{id}`. See [DNC](https://developers.callview.ai/reference/dnc/). ## Opt-outs A number goes on the list when: - you call `POST /leads/{id}/opt_out` (or `POST /dnc`), - the lead asks not to be called again during a call, and the AI or your team takes them off, - someone marks it in the app, or the call's outcome is `dnc`, - the lead replies STOP to a text. Each time, `lead.opted_out` is sent for every lead of yours with that number. `opt_out.source` says how it happened: `api`, `ai`, `outcome`, `manual`, `bulk` or `sms`. Mirror it in your CRM, so no other system calls them either. `POST /leads/{id}/opt_out` never cuts a call that's in progress. The reply says `"call_in_progress": true` when one is, and the number is never dialed again after it. --- # Money guards Source: https://developers.callview.ai/guides/money-guards/ > The spend cap on API-started calls, the day limits on one key, the numbers we won't dial, and the limit on calling one lead. A key that can add leads can start real phone calls, and calls cost money. A runaway loop in a CRM, or a leaked key, could get expensive. These guards are there so it can't. ## The spend cap Your organization has a daily and a monthly budget for calls started through the API. By default it's **$300 a day** and **$3,000 a month**. The spend is the calls' billable minutes at your rate, the same numbers as your bill. Days and months follow your organization's time zone. Only API-started calls count. Leads you load into a campaign in the app keep dialing as usual. When a cap is reached: - New API leads aren't refused. They're kept and **held**: `"status": "held"`, `"held_reason": "spend_cap_reached"`. The same goes for `POST /calls`. - API leads already waiting aren't dialed until the cap lifts. - Your organization's admins get one email about it (once per cap, per day or month). The cap lifts by itself at midnight (or on the 1st, for the monthly cap), or as soon as the cap is raised. Held leads are then called in their usual order. Org admins can lower the caps in CallView. To go above the defaults, ask CallView support. ## Limits for one key The spend cap covers your whole organization. A CRM stuck in a loop could still use all of it on its own, so each key can have day limits of its own as well. Both are optional, and you set them on the key in **Settings > API**: | Limit | What it counts | Allowed values | | --- | --- | --- | | Calls per day | Calls started for the leads this key added, re-sent or called with `POST /calls` | 1 to 100,000 | | Daily spend cap | What those calls cost: billable minutes at your rate, the same rule as the organization's cap | $1 to $1,000,000, in cents | Leave one empty and the key has no limit of that kind. The organization's spend cap still applies either way. The day is your organization's day, in its time zone. A test key's pretend calls cost nothing and never count. When a key reaches either limit: - New leads from that key, and `POST /calls`, aren't refused. They're kept and **held**: `"status": "held"`, `"held_reason": "key_limit_reached"`. - A lead of that key's that comes up to be dialed isn't called. It waits until midnight in your organization's time zone, and the campaign moves on to its other leads, so other keys' leads and the campaign's own keep dialing. - At midnight the key starts a new day and its waiting leads are called in their usual order. If both the organization's cap and the key's limit are reached, the answer is `spend_cap_reached`: the organization's cap is checked first. Two things to know when you size a limit: - **It can go over by up to a minute's worth of calls.** We count each key's calls and spend once a minute, not on every call, so calls that start in that minute can take a key a little past its limit. The organization's cap works the same way. - **Raising a limit doesn't bring back leads already waiting for midnight.** New leads are dialed under the new limit within a minute. To call a waiting lead today, send it again with `POST /calls`. ## Numbers we won't dial Premium-rate numbers (900, 976 and the like) and international numbers, including `+1` numbers in the Caribbean, are refused for API leads: ```json { "error": { "type": "invalid_request_error", "code": "number_not_allowed", "message": "phone: premium-rate numbers (such as 900 and 976) are not dialed for this organization. Ask CallView support to allow them.", "param": "phone", "request_id": "req_6f1c2a9b0d3e4f5a6b7c8d9e0f1a2b3c", "reason": "premium" } } ``` `reason` is `premium` or `international`. If you really need to call one of these, ask CallView support to allow it for your organization. ## Calling one lead again `POST /calls` calls an existing lead right away. Each lead can be called this way at most 3 times in 24 hours. The 4th gets `429 call_limit_reached`, with `Retry-After` saying when you can again. ## Knowing which key started a call Every call says what started it, in `started_by`: `{ "type": "api", "api_key_id": "ck_live_..." }` for a call your key started, `dialer` for the campaign's own dialing, or `person` for a call someone placed by hand. The calls with your key's ID are the ones its day limits count. Settings > API shows each key's calls and cost for today and the last 30 days, next to any limit it has. --- # Safe retries (Idempotency-Key) Source: https://developers.callview.ai/guides/idempotency/ > Send the same write twice without making two leads or two calls. Networks fail. Your request might reach us and the answer get lost on the way back. If you then send it again, you don't want two leads or two calls. So every `POST` and `PATCH` takes an `Idempotency-Key` header: ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/leads' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: crm-10442-create' \ -H 'Content-Type: application/json' \ -d '{ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "crm-10442", "phone": "+12125557812", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } }' ``` `campaign_id` comes from [`GET /campaigns`](https://developers.callview.ai/reference/campaigns/) (each campaign's `id`), and `external_id` is your own ID for the lead, such as the contact's ID in your CRM. See [Speed to lead](https://developers.callview.ai/guides/speed-to-lead/). ## How it works - The key is any text you choose, 1 to 255 visible characters. Use a new one for each new action, and the same one when you retry that action. Something built from your own record works well, like `crm-10442-create`. - The first time we see a key, the request runs and we keep its answer for **24 hours**. - Send the same key with the same request in that time, and you get the kept answer back, exactly, with the header `Idempotent-Replayed: true`. Nothing runs again. That includes a kept error: a `403 permission_denied` or a `409 duplicate_lead` comes back the same way, so after you fix the cause, send with a new key. - Send the same key with a different request (another path or another body) and you get `409 idempotency_mismatch`. - Send it while the first one is still running and you get `409 idempotency_in_progress` with `Retry-After: 1`. Keys belong to one API key: two of your systems with different API keys can't clash. ## What isn't kept - `5xx` errors and `429` answers are not kept. Retrying with the same key really runs the request again, which is what you want after a hiccup on our side. - A request refused before it starts (a bad key, a rate limit, a body that fails the checks) never uses up the key. If we can't check a key (very rare), the write is refused with `503 service_unavailable` rather than run without the safety net. Retry it. `GET` and `DELETE` don't need a key: asking twice is always safe. --- # Webhooks and signatures Source: https://developers.callview.ai/guides/webhooks/ > Get events at your own address, check that each one came from us, and what happens when your server is down. A webhook is an address on your server where we send events as they happen: a lead was queued, a call was answered, the lead is interested, the call is over. You don't have to keep asking. ## Set one up ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Content-Type: application/json' \ -d '{ "url": "https://crm.example.com/callview", "events": ["call.completed", "lead.interested", "lead.opted_out"] }' ``` - The address must be `https://` and on the public internet. We don't follow redirects, so give the final address. - `events` lists what you want. [Events](https://developers.callview.ai/reference/events/) has them all. - The key needs **Webhooks: write**, and it can only ask for events whose data it may read anyway. Lead events (`lead.created`, `lead.queued`, `lead.opted_out`, `lead.late`, `callback.booked`) need **Leads: read**. Call events (`call.started`, `call.answered`, `call.completed`, `lead.interested`, `handover.accepted`, `voicemail.left`) need **Calls: read**. Without it you get `403 permission_denied`, naming the permission that's missing. - `campaign_ids` limits it to some campaigns. Leave it out for all of them, which needs a key for every campaign: a key limited to some campaigns must list them (all of them its own), or it gets `403 permission_denied`. - The endpoint takes the key's mode. One made with a test key only ever gets test events, and one made with a live key only gets live ones. - The reply has a `secret` (`whsec_...`). It's shown this once. You need it to check our signature. - You can have up to 10 endpoints. ## What we send A `POST` with a JSON body, and these headers: | Header | What it is | | --- | --- | | `CallView-Signature` | The signature. See below. | | `CallView-Event-Id` | The event's `id` (`evt_...`). | | `CallView-Event-Type` | For example `call.completed`. | | `CallView-Delivery-Id` | This delivery. A re-send gets a new one. | | `CallView-Delivery-Attempt` | 1 the first time, then 2, 3 and so on. | | `User-Agent` | `CallView-Webhooks/1.0` | The body is the event: ```json { "id": "evt_callcompletedxxxxxxxxxxx", "type": "call.completed", "created": "2026-10-06T17:05:20Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "outcome": "interested", "note": "Wants a quote for a 6 kW system...", "...": "..." } } } ``` ## Answer fast Answer with any `2xx` status within 10 seconds. Anything else, or no answer in time, counts as a failure and we try again later. If your work takes longer (writing to your CRM, say), save the event, answer `200`, then do the work. ## Check the signature Anyone can send a `POST` to your address. The signature proves an event came from us and wasn't changed on the way. The `CallView-Signature` header looks like this: ``` t=1791306131,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd ``` - `t` is when we signed it, in unix seconds. - `v1` is an HMAC-SHA256, in hex, of the text `t`, a dot, then the raw body, using your endpoint's `whsec_` secret as the key. To check it: 1. Take the **raw** body, byte for byte as it arrived. If your framework parsed the JSON for you and you turn it back into text, the bytes can change and the check fails. 2. Work out HMAC-SHA256 of `t` + `.` + raw body with your secret, and compare it to each `v1` (a constant-time compare). 3. Refuse it if `t` is more than 5 minutes away from your clock. That stops anyone replaying an old event at you. The code for Node, Python and PHP is below. Our test suite runs these exact files against our real signer on every build, so you can copy them as they are. ### Node **verify-signature.js** ```js // Check that a webhook really came from CallView (Node 18 or later, no packages). // // Every delivery has a CallView-Signature header like: // t=1791306131,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd // t is when we sent it (unix seconds). v1 is HMAC-SHA256 of ".", // keyed with your endpoint's secret (whsec_...), in hex. While you roll the // secret there are two v1 values: one matching is enough. // // Use the RAW body, byte for byte as it arrived. JSON you parsed and turned // back into text won't match. // // This is an ES module. In a CommonJS project, change the first line to: // const crypto = require('node:crypto'); import crypto from 'node:crypto'; export function verifyCallViewSignature(rawBody, header, secret, toleranceSeconds = 300) { let timestamp = null; const signatures = []; for (const part of String(header || '').split(',')) { const i = part.indexOf('='); if (i === -1) continue; const key = part.slice(0, i).trim(); const value = part.slice(i + 1).trim(); if (key === 't' && /^\d+$/.test(value)) timestamp = Number(value); if (key === 'v1' && /^[0-9a-f]{64}$/i.test(value)) signatures.push(value.toLowerCase()); } if (timestamp === null || signatures.length === 0 || !secret) return false; // Older than 5 minutes (or from the future): refuse it, so nobody can replay an old one. if (Math.abs(Math.floor(Date.now() / 1000) - timestamp) > toleranceSeconds) return false; const body = Buffer.isBuffer(rawBody) ? rawBody : Buffer.from(String(rawBody), 'utf8'); const expected = crypto .createHmac('sha256', secret) .update(Buffer.concat([Buffer.from(`${timestamp}.`, 'utf8'), body])) .digest(); return signatures.some((sig) => { const got = Buffer.from(sig, 'hex'); return got.length === expected.length && crypto.timingSafeEqual(got, expected); }); } // Try it from the command line with a delivery you saved: // node verify-signature.js whsec_... 't=...,v1=...' body.json // It prints "valid" or "invalid". import { readFileSync } from 'node:fs'; import { pathToFileURL } from 'node:url'; if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { const [secret, header, bodyFile] = process.argv.slice(2); const ok = verifyCallViewSignature(readFileSync(bodyFile), header, secret); console.log(ok ? 'valid' : 'invalid'); process.exit(ok ? 0 : 1); } ``` ### Python **verify_signature.py** ```python # Check that a webhook really came from CallView (Python 3.8 or later, no packages). # # Every delivery has a CallView-Signature header like: # t=1791306131,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd # t is when we sent it (unix seconds). v1 is HMAC-SHA256 of ".", # keyed with your endpoint's secret (whsec_...), in hex. While you roll the # secret there are two v1 values: one matching is enough. # # Use the RAW body, byte for byte as it arrived (request.get_data() in Flask, # request.body in Django). JSON you parsed and turned back into text won't match. import hashlib import hmac import time HEX = set("0123456789abcdefABCDEF") def verify_callview_signature(raw_body, header, secret, tolerance_seconds=300): timestamp = None signatures = [] for part in (header or "").split(","): key, _, value = part.strip().partition("=") value = value.strip() if key == "t" and value.isdigit(): timestamp = int(value) elif key == "v1" and len(value) == 64 and set(value) <= HEX: signatures.append(value.lower()) if timestamp is None or not signatures or not secret: return False # Older than 5 minutes (or from the future): refuse it, so nobody can replay an old one. if abs(int(time.time()) - timestamp) > tolerance_seconds: return False if isinstance(raw_body, str): raw_body = raw_body.encode("utf-8") expected = hmac.new( secret.encode("utf-8"), str(timestamp).encode("utf-8") + b"." + raw_body, hashlib.sha256, ).hexdigest() return any(hmac.compare_digest(expected, sig) for sig in signatures) # Try it from the command line with a delivery you saved: # python verify_signature.py whsec_... 't=...,v1=...' body.json # It prints "valid" or "invalid". if __name__ == "__main__": import sys secret, header, body_file = sys.argv[1:4] with open(body_file, "rb") as f: ok = verify_callview_signature(f.read(), header, secret) print("valid" if ok else "invalid") sys.exit(0 if ok else 1) ``` ### PHP **verify-signature.php** ```php .", // keyed with your endpoint's secret (whsec_...), in hex. While you roll the // secret there are two v1 values: one matching is enough. // // Use the RAW body, byte for byte as it arrived: file_get_contents('php://input'). // JSON you decoded and encoded again won't match. function verify_callview_signature(string $rawBody, string $header, string $secret, int $toleranceSeconds = 300): bool { $timestamp = null; $signatures = []; foreach (explode(',', $header) as $part) { $pair = explode('=', trim($part), 2); if (count($pair) !== 2) { continue; } [$key, $value] = [trim($pair[0]), trim($pair[1])]; if ($key === 't' && ctype_digit($value)) { $timestamp = (int) $value; } elseif ($key === 'v1' && preg_match('/^[0-9a-f]{64}$/i', $value)) { $signatures[] = strtolower($value); } } if ($timestamp === null || count($signatures) === 0 || $secret === '') { return false; } // Older than 5 minutes (or from the future): refuse it, so nobody can replay an old one. if (abs(time() - $timestamp) > $toleranceSeconds) { return false; } $expected = hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret); foreach ($signatures as $signature) { if (hash_equals($expected, $signature)) { return true; } } return false; } // In your webhook handler: // $raw = file_get_contents('php://input'); // $header = $_SERVER['HTTP_CALLVIEW_SIGNATURE'] ?? ''; // if (!verify_callview_signature($raw, $header, getenv('CALLVIEW_WEBHOOK_SECRET'))) { // http_response_code(400); // exit; // } // Try it from the command line with a delivery you saved: // php verify-signature.php whsec_... 't=...,v1=...' body.json // It prints "valid" or "invalid". if (PHP_SAPI === 'cli' && isset($argv[0]) && realpath($argv[0]) === __FILE__) { [, $secret, $header, $bodyFile] = $argv; $ok = verify_callview_signature(file_get_contents($bodyFile), $header, $secret); echo $ok ? "valid\n" : "invalid\n"; exit($ok ? 0 : 1); } ``` ### A whole receiver #### Node **receive-express.js** ```js // A webhook receiver in Express that checks the signature, skips repeats and // answers fast. npm install express import express from 'express'; import { verifyCallViewSignature } from './verify-signature.js'; const app = express(); const seen = new Set(); // use your database in real life: event ids you have handled // express.raw keeps the body as bytes. Don't put express.json() in front of // this route: the signature is over the raw bytes. app.post('/callview', express.raw({ type: 'application/json' }), (req, res) => { const ok = verifyCallViewSignature(req.body, req.get('CallView-Signature'), process.env.CALLVIEW_WEBHOOK_SECRET); if (!ok) return res.status(400).send('bad signature'); const event = JSON.parse(req.body.toString('utf8')); if (seen.has(event.id)) return res.sendStatus(200); // already handled: still say OK seen.add(event.id); // Answer within 10 seconds. Do slow work (CRM updates) after answering. res.sendStatus(200); if (event.type === 'call.completed') { const call = event.data.object; console.log(`${call.lead?.external_id}: ${call.outcome} - ${call.note ?? ''}`); } }); app.listen(3000, () => console.log('Listening on http://localhost:3000/callview')); ``` #### Python **receive_flask.py** ```python # A webhook receiver in Flask that checks the signature, skips repeats and # answers fast. pip install flask import json import os from flask import Flask, request from verify_signature import verify_callview_signature app = Flask(__name__) seen = set() # use your database in real life: event ids you have handled @app.post("/callview") def callview(): raw = request.get_data() # the raw bytes: the signature is over these header = request.headers.get("CallView-Signature", "") if not verify_callview_signature(raw, header, os.environ["CALLVIEW_WEBHOOK_SECRET"]): return "bad signature", 400 event = json.loads(raw) if event["id"] in seen: return "", 200 # already handled: still say OK seen.add(event["id"]) # Answer within 10 seconds. Hand slow work (CRM updates) to a queue. if event["type"] == "call.completed": call = event["data"]["object"] lead = call.get("lead") or {} print(f'{lead.get("external_id")}: {call["outcome"]} - {call.get("note") or ""}') return "", 200 if __name__ == "__main__": app.run(port=3000) ``` #### PHP **receive.php** ```php **Tip** > > `POST /webhook_endpoints/{id}/test` with `{ "type": "call.completed" }` sends a signed sample of any event to your endpoint. It's marked `"sample": true` and `"livemode": false`, so you can test your receiver at any time. --- # Events Source: https://developers.callview.ai/reference/events/ > Every event we send: when, what it carries, and an example. Every event comes in the same envelope: `id`, `type`, `created`, `livemode`, `api_version` and `data.object`. The object is the lead or the call as the API returns it, plus a few fields of the event's own. Check the signature before you trust an event: see [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/). An event can arrive twice: skip an `id` you have already handled. | Event | About | When | | --- | --- | --- | | [`lead.created`](https://developers.callview.ai/reference/events/lead-created/) | lead | A lead was added: through POST /leads, or one Add Lead in the app. CSV imports do not send it. | | [`lead.queued`](https://developers.callview.ai/reference/events/lead-queued/) | lead | A lead was put in the dialing queue, right after lead.created (or when POST /leads re-queued an existing lead). status says queued, scheduled or held, with scheduled_for. | | [`lead.interested`](https://developers.callview.ai/reference/events/lead-interested/) | call | The AI saw buying intent. intent carries what the lead said (excerpt) and who the call is offered to (the ready SDRs first, else the closers). | | [`lead.opted_out`](https://developers.callview.ai/reference/events/lead-opted_out/) | lead | The lead's number went on the Do Not Call list. opt_out.source says how: api, ai (the AI's tool during the call), outcome (a DNC outcome), manual, bulk or sms (a STOP reply). One event per lead of yours with that number. | | [`lead.late`](https://developers.callview.ai/reference/events/lead-late/) | lead | A speed-to-lead lead was still waiting for its call after the campaign's late minutes (default 15). It is still called; late is true. | | [`call.started`](https://developers.callview.ai/reference/events/call-started/) | call | A call to the lead started dialing (the call record exists). | | [`call.answered`](https://developers.callview.ai/reference/events/call-answered/) | call | The far end picked up. answered_by is person, machine (a voicemail box or a phone menu) or unknown (nothing checked). | | [`call.completed`](https://developers.callview.ai/reference/events/call-completed/) | call | The outcome is final: outcome, the note, duration, handled_by, owner, and the API paths for the recording and transcript. An AI-only call sends it after the after-call check; a call a person handled sends it when they file the outcome (or after 10 minutes with none: outcome other, note "No outcome was filed"). A later correction sends it again with the same id, a newer updated and revision 2, 3 ... | | [`handover.accepted`](https://developers.callview.ai/reference/events/handover-accepted/) | call | A person took the call: handled_by names them (an SDR or a closer), tth_seconds is how long it took from the intent. | | [`voicemail.left`](https://developers.callview.ai/reference/events/voicemail-left/) | call | A voicemail was delivered. Never sent for a message that was not delivered. | | [`callback.booked`](https://developers.callview.ai/reference/events/callback-booked/) | lead | A day and time to call the lead back was booked. callback.at is UTC; callback.timezone is the lead's. | --- # lead.created Source: https://developers.callview.ai/reference/events/lead-created/ > A lead was added: through POST /leads, or one Add Lead in the app. A lead was added: through POST /leads, or one Add Lead in the app. CSV imports do not send it. **Sent when:** POST /leads accepted a new lead; A person added one lead in the app. ```json { "id": "evt_leadcreatedxxxxxxxxxxxxx", "type": "lead.created", "created": "2026-10-06T16:58:04Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "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": null, "estimated_wait_seconds": null, "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 } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # lead.queued Source: https://developers.callview.ai/reference/events/lead-queued/ > A lead was put in the dialing queue, right after lead.created (or when POST /leads re-queued an existing lead). A lead was put in the dialing queue, right after lead.created (or when POST /leads re-queued an existing lead). status says queued, scheduled or held, with scheduled_for. **Sent when:** POST /leads accepted a lead; POST /leads re-queued a lead last sent longer ago than the duplicate window. ```json { "id": "evt_leadqueuedxxxxxxxxxxxxxx", "type": "lead.queued", "created": "2026-10-06T16:58:04Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "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": null, "estimated_wait_seconds": null, "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 } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # lead.interested Source: https://developers.callview.ai/reference/events/lead-interested/ > The AI saw buying intent. The AI saw buying intent. intent carries what the lead said (excerpt) and who the call is offered to (the ready SDRs first, else the closers). **Sent when:** The AI detected buying intent during the call. Besides the call object's fields, it carries: | Field | Type | Notes | | --- | --- | --- | | `intent` | object | | ```json { "id": "evt_leadinterestedxxxxxxxxxx", "type": "lead.interested", "created": "2026-10-06T16:59:02Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "in_progress", "outcome": null, "outcome_label": null, "note": null, "duration_seconds": null, "started": "2026-10-06T16:58:06.000Z", "answered": "2026-10-06T16:58:14.000Z", "ended": null, "updated": "2026-10-06T16:59:02.000Z", "handled_by": { "id": null, "name": "AI", "role": "ai" }, "owner": null, "tth_seconds": null, "callback_at": null, "recording_available": false, "transcript_available": false, "started_by": { "type": "api", "api_key_id": "key_example" }, "intent": { "at": "2026-10-06T16:59:02.000Z", "excerpt": "Yes, I'd like to hear what it would cost for my house.", "confidence": 0.92, "offered_to": [ { "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "name": "SDR_NAME", "role": "sdr" } ] } } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # lead.opted_out Source: https://developers.callview.ai/reference/events/lead-opted_out/ > The lead's number went on the Do Not Call list. The lead's number went on the Do Not Call list. opt_out.source says how: api, ai (the AI's tool during the call), outcome (a DNC outcome), manual, bulk or sms (a STOP reply). One event per lead of yours with that number. **Sent when:** POST /leads/{id}/opt_out, or the DNC endpoints; The AI took the number off the list on a call; A DNC outcome; Mark DNC, the DNC page or bulk DNC in the app; A STOP reply by text. Besides the lead object's fields, it carries: | Field | Type | Notes | | --- | --- | --- | | `opt_out` | object | | ```json { "id": "evt_leadoptedoutxxxxxxxxxxxx", "type": "lead.opted_out", "created": "2026-10-06T17:01:40Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "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-06T17:01:40.000Z", "status": "out_of_queue", "call_now": true, "place_in_line": null, "estimated_wait_seconds": null, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "callback_at": null, "late": false, "attempts": 0, "last_outcome": "dnc", "last_outcome_label": "DNC", "next_dial_at": null, "calls": [], "livemode": true, "opt_out": { "source": "ai", "at": "2026-10-06T17:01:40.000Z" } } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # lead.late Source: https://developers.callview.ai/reference/events/lead-late/ > A speed-to-lead lead was still waiting for its call after the campaign's late minutes (default 15). A speed-to-lead lead was still waiting for its call after the campaign's late minutes (default 15). It is still called; late is true. **Sent when:** The late sweep stamped the lead (every 30 s). ```json { "id": "evt_leadlatexxxxxxxxxxxxxxxx", "type": "lead.late", "created": "2026-10-06T17:13:04Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "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-06T17:13:04.000Z", "status": "queued", "call_now": true, "place_in_line": null, "estimated_wait_seconds": null, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "callback_at": null, "late": true, "attempts": 0, "last_outcome": null, "last_outcome_label": null, "next_dial_at": null, "calls": [], "livemode": true } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # call.started Source: https://developers.callview.ai/reference/events/call-started/ > A call to the lead started dialing (the call record exists). A call to the lead started dialing (the call record exists). **Sent when:** The dialer, speed to lead, POST /calls or a person dialed the lead. ```json { "id": "evt_callstartedxxxxxxxxxxxxx", "type": "call.started", "created": "2026-10-06T16:58:06Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "ringing", "outcome": null, "outcome_label": null, "note": null, "duration_seconds": null, "started": "2026-10-06T16:58:06.000Z", "answered": null, "ended": null, "updated": "2026-10-06T16:58:06.000Z", "handled_by": { "id": null, "name": "AI", "role": "ai" }, "owner": null, "tth_seconds": null, "callback_at": null, "recording_available": false, "transcript_available": false, "started_by": { "type": "api", "api_key_id": "key_example" } } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # call.answered Source: https://developers.callview.ai/reference/events/call-answered/ > The far end picked up. The far end picked up. answered_by is person, machine (a voicemail box or a phone menu) or unknown (nothing checked). **Sent when:** The answering-machine check decided; The voicemail detector decided (or 20 s passed with no mailbox); A person on our side picked the call up directly. Besides the call object's fields, it carries: | Field | Type | Notes | | --- | --- | --- | | `answered_by` | string | One of `person` / `machine` / `unknown`. | ```json { "id": "evt_callansweredxxxxxxxxxxxx", "type": "call.answered", "created": "2026-10-06T16:58:14Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "in_progress", "outcome": null, "outcome_label": null, "note": null, "duration_seconds": null, "started": "2026-10-06T16:58:06.000Z", "answered": "2026-10-06T16:58:14.000Z", "ended": null, "updated": "2026-10-06T16:58:14.000Z", "handled_by": { "id": null, "name": "AI", "role": "ai" }, "owner": null, "tth_seconds": null, "callback_at": null, "recording_available": false, "transcript_available": false, "started_by": { "type": "api", "api_key_id": "key_example" }, "answered_by": "person" } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # call.completed Source: https://developers.callview.ai/reference/events/call-completed/ > The outcome is final: outcome, the note, duration, handled_by, owner, and the API paths for the recording and transcript. The outcome is final: outcome, the note, duration, handled_by, owner, and the API paths for the recording and transcript. An AI-only call sends it after the after-call check; a call a person handled sends it when they file the outcome (or after 10 minutes with none: outcome other, note "No outcome was filed"). A later correction sends it again with the same id, a newer updated and revision 2, 3 ... **Sent when:** The after-call check filed an AI-only call's outcome; A person filed the outcome; 10 minutes passed with no outcome filed; The outcome was corrected later. Besides the call object's fields, it carries: | Field | Type | Notes | | --- | --- | --- | | `revision` | integer | | | `recording_path` | string or null | GET it for a 5-minute recording link | | `transcript_path` | string or null | | ```json { "id": "evt_callcompletedxxxxxxxxxxx", "type": "call.completed", "created": "2026-10-06T17:05:20Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "ended", "outcome": "interested", "outcome_label": "Interested", "note": "Wants a quote for a 6 kW system; home owner, roof replaced 2019.", "duration_seconds": 412, "started": "2026-10-06T16:58:06.000Z", "answered": "2026-10-06T16:58:14.000Z", "ended": "2026-10-06T17:04:58.000Z", "updated": "2026-10-06T17:05:20.000Z", "handled_by": { "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "name": "SDR_NAME", "role": "sdr" }, "owner": null, "tth_seconds": 9.3, "callback_at": null, "recording_available": true, "transcript_available": true, "started_by": { "type": "api", "api_key_id": "key_example" }, "revision": 1, "recording_path": "/api/v1/external/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/recording", "transcript_path": "/api/v1/external/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/transcript" } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # handover.accepted Source: https://developers.callview.ai/reference/events/handover-accepted/ > A person took the call: handled_by names them (an SDR or a closer), tth_seconds is how long it took from the intent. A person took the call: handled_by names them (an SDR or a closer), tth_seconds is how long it took from the intent. **Sent when:** An SDR bridged or took over the call; A closer pressed 1. ```json { "id": "evt_handoveracceptedxxxxxxxx", "type": "handover.accepted", "created": "2026-10-06T16:59:11Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "in_progress", "outcome": null, "outcome_label": null, "note": null, "duration_seconds": null, "started": "2026-10-06T16:58:06.000Z", "answered": "2026-10-06T16:58:14.000Z", "ended": null, "updated": "2026-10-06T16:59:11.300Z", "handled_by": { "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "name": "SDR_NAME", "role": "sdr" }, "owner": null, "tth_seconds": 9.3, "callback_at": null, "recording_available": false, "transcript_available": false, "started_by": { "type": "api", "api_key_id": "key_example" } } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # voicemail.left Source: https://developers.callview.ai/reference/events/voicemail-left/ > A voicemail was delivered. A voicemail was delivered. Never sent for a message that was not delivered. **Sent when:** The voicemail agent reported the message delivered, confirmed after the call. ```json { "id": "evt_voicemailleftxxxxxxxxxxx", "type": "voicemail.left", "created": "2026-10-06T16:58:54Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "ended", "outcome": "voicemail", "outcome_label": "Voicemail", "note": null, "duration_seconds": 48, "started": "2026-10-06T16:58:06.000Z", "answered": null, "ended": "2026-10-06T16:58:54.000Z", "updated": "2026-10-06T16:58:54.000Z", "handled_by": { "id": null, "name": "AI", "role": "ai" }, "owner": null, "tth_seconds": null, "callback_at": null, "recording_available": false, "transcript_available": false, "started_by": { "type": "api", "api_key_id": "key_example" } } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # callback.booked Source: https://developers.callview.ai/reference/events/callback-booked/ > A day and time to call the lead back was booked. A day and time to call the lead back was booked. callback.at is UTC; callback.timezone is the lead's. **Sent when:** The AI booked it on the call; Nobody took an interested lead and it was filed as a callback; A person booked it. Besides the lead object's fields, it carries: | Field | Type | Notes | | --- | --- | --- | | `callback` | object | | ```json { "id": "evt_callbackbookedxxxxxxxxxx", "type": "callback.booked", "created": "2026-10-06T17:02:10Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": { "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-06T17:02:10.000Z", "status": "callback_scheduled", "call_now": true, "place_in_line": null, "estimated_wait_seconds": null, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "callback_at": "2026-10-07T18:30:00.000Z", "late": false, "attempts": 0, "last_outcome": null, "last_outcome_label": null, "next_dial_at": null, "calls": [], "livemode": true, "callback": { "at": "2026-10-07T18:30:00.000Z", "timezone": "America/New_York" } } } } ``` Every event comes in the same envelope. See [Events](https://developers.callview.ai/reference/events/) for the list, and [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/) for checking the signature. --- # How every recipe works Source: https://developers.callview.ai/recipes/ > The three moves behind every CRM hook-up. Send the new lead, receive call.completed, write the outcome back. Every CRM recipe here is the same three moves. Once you know them, any CRM or automation tool will do. ## 1. Send each new lead Make a key in **Settings > API** from the **CRM speed to lead** set, limited to the campaigns it should fill. It adds leads, starts their calls (Start calls), and reads outcomes and events. Tick Webhooks (read and write) too if your tool will set up its own webhook endpoint. See [Keys and authentication](https://developers.callview.ai/guides/authentication/#the-ready-made-sets). When a lead lands in your CRM, send it to `POST /leads`: | Setting | Value | | --- | --- | | Method and address | `POST https://v2-api.callview.ai/api/v1/external/leads` | | Login | HTTP Basic with your key ID and secret, or the header `Authorization: Bearer cs_live_...` | | `Idempotency-Key` header | Something from the CRM record and its data, like `crm--`, so a retry can't make two leads and a changed record gets a new key. The first answer to a key is kept for 24 hours, errors included: after fixing a refused lead, send it with a new key. See [Safe retries](https://developers.callview.ai/guides/idempotency/). | | Body | JSON with only the fields below. Unknown fields are refused, so don't send the CRM's whole record. | ```json { "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "", "phone": "", "name": "", "email": "", "fields": { "source": "" }, "consent": { "source": "web_form", "agreed_at": "", "url": "" }, "call_now": true } ``` `external_id` is what ties everything together: every call and event about this lead carries it back to you. ## 2. Receive `call.completed` Make a webhook endpoint that points at your tool's "receive a webhook" address: ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Content-Type: application/json' \ -d '{ "url": "https://hooks.example.com/your-tool-address", "events": ["call.completed", "lead.opted_out"], "campaign_ids": ["7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01"] }' ``` `campaign_ids` lists the campaigns the key is limited to. An endpoint without it covers every campaign, which a key limited to some campaigns isn't allowed to make (`403 permission_denied`). With a key for every campaign you can leave it out. Keep the `whsec_` secret from the reply. If your tool can run a little code, [check the signature](https://developers.callview.ai/guides/webhooks/#check-the-signature). If it can't, keep the address private: it's the only thing standing between a stranger and your CRM. ## 3. Write the outcome back From the event, the fields you'll want: | From the event | Put it in the CRM as | | --- | --- | | `data.object.lead.external_id` | Which record to update | | `data.object.outcome` | A dropdown with the [outcome words](https://developers.callview.ai/guides/outcomes/) | | `data.object.outcome_label` | The outcome as your team names it | | `data.object.note` | A note on the record | | `data.object.handled_by.name` | Who spoke to them | | `data.object.callback_at` | A task or a follow-up date | | `data.object.duration_seconds` | Call length | For the recording or the transcript, call `GET /calls/{id}/recording` or `GET /calls/{id}/transcript` (the paths are in `recording_path` and `transcript_path`). The key needs Recordings & transcripts (`recordings:read`) for these, which the CRM speed to lead set leaves out. A recording link works for 5 minutes, so fetch it when someone wants to listen. Don't save the link itself. `lead.opted_out` means the person asked not to be called. Mark them do-not-call in the CRM too. ## Build it with a test key first Use a test key and the [magic numbers](https://developers.callview.ai/guides/test-mode/) while you wire it up. `+15550100001` gives you an interested lead in about 4 minutes, and `+15550100002` a voicemail in about a minute. When it all works, change the key and the webhook endpoint to live ones. --- # HubSpot Source: https://developers.callview.ai/recipes/hubspot/ > Send new HubSpot contacts to CallView from a workflow, and write the call's outcome back to the contact. This follows the three moves in [How every recipe works](https://developers.callview.ai/recipes/). HubSpot menus differ a little between plans; the names below are the usual ones. You need a HubSpot plan with workflows that can run custom code or send webhooks. ## Send new contacts 1. In HubSpot, make a contact-based **workflow**. Trigger it the way your leads arrive, for example "Form submission" on your quote form. 2. Add a **Custom code** action (Node.js). Add your CallView secret as a secret named `CALLVIEW_SECRET`, and pass in the contact's `hs_object_id`, `firstname`, `lastname`, `email` and `phone`. 3. Paste this, with your campaign's ID: ```js exports.main = async (event, callback) => { const c = event.inputFields; const res = await fetch('https://v2-api.callview.ai/api/v1/external/leads', { method: 'POST', headers: { Authorization: `Bearer ${process.env.CALLVIEW_SECRET}`, 'Content-Type': 'application/json', 'Idempotency-Key': `hubspot-${c.hs_object_id}-create`, }, body: JSON.stringify({ campaign_id: '7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01', external_id: `hubspot-${c.hs_object_id}`, phone: c.phone, name: `${c.firstname ?? ''} ${c.lastname ?? ''}`.trim(), email: c.email, consent: { source: 'web_form', agreed_at: new Date().toISOString(), url: 'https://example.com/quote' }, call_now: true, }), }); const body = await res.json(); callback({ outputFields: { callview_status: body.data?.status ?? body.error?.code } }); }; ``` A `409 duplicate_lead` or `422 on_dnc_list` is an answer, not a fault: the contact is already with CallView, or asked not to be called. Let the workflow carry on. ## Write the outcome back Point a webhook endpoint at whatever receives events for you: - **A HubSpot workflow that starts from a webhook**, if your plan has one. Use `data.object.lead.external_id` (minus the `hubspot-` prefix) to find the contact, then set your properties. - **Zapier or Make** in between, if not. See [Zapier](https://developers.callview.ai/recipes/zapier/) or [Make](https://developers.callview.ai/recipes/make/), and use their HubSpot "update contact" step. - **A small receiver of your own** (see [Webhooks](https://developers.callview.ai/guides/webhooks/)) that calls HubSpot's API. Make contact properties for the outcome (a dropdown with the [outcome words](https://developers.callview.ai/guides/outcomes/)), the note, and who took the call, and fill them from the event. --- # GoHighLevel Source: https://developers.callview.ai/recipes/gohighlevel/ > Send new GoHighLevel contacts to CallView from a workflow, and update the contact when the call is over. This follows the three moves in [How every recipe works](https://developers.callview.ai/recipes/). ## Send new contacts 1. In GoHighLevel, open **Automation > Workflows** and make a workflow. Trigger it with "Contact Created", or "Form Submitted" for your quote form. 2. Add a **Custom Webhook** action, set like this, with the body below: | Setting | Value | | --- | --- | | Method | `POST` | | URL | `https://v2-api.callview.ai/api/v1/external/leads` | | Headers | `Authorization` = `Bearer cs_live_...` (your secret), `Content-Type` = `application/json`, `Idempotency-Key` = `ghl-{{contact.id}}-create` | | Body | Raw JSON, with your campaign's ID | ```json { "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "ghl-{{contact.id}}", "phone": "{{contact.phone}}", "name": "{{contact.name}}", "email": "{{contact.email}}", "consent": { "source": "web_form", "agreed_at": "{{right_now.iso}}", "url": "https://example.com/quote" }, "call_now": true } ``` Check the merge fields against your account: GoHighLevel's names for them can differ. Use a date merge field that gives a full date and time, or a fixed date when you know it. ## Update the contact when the call is over 1. Make a second workflow with the **Inbound Webhook** trigger. Copy the address it gives you. 2. Point a CallView webhook endpoint at that address, with `"events": ["call.completed", "lead.opted_out"]`. 3. Send a sample with `POST /webhook_endpoints/{id}/test` and `{ "type": "call.completed" }`, so GoHighLevel can see the fields. 4. Find the contact by `data.object.lead.external_id` (minus `ghl-`), then update it: put `data.object.outcome` in a custom field, add `data.object.note` as a note, and add a tag such as `callview-interested` so your other workflows can act on it. GoHighLevel can't check our signature, so keep the inbound webhook address private. --- # Follow Up Boss Source: https://developers.callview.ai/recipes/follow-up-boss/ > Send new Follow Up Boss people to CallView, and log the call's outcome back on the person. This follows the three moves in [How every recipe works](https://developers.callview.ai/recipes/). Follow Up Boss works best with a small receiver of your own in the middle, because its own automations don't send custom HTTP requests. Zapier or Make can stand in if you'd rather not run code. ## Send new people 1. In Follow Up Boss, register a webhook for the `peopleCreated` event (through its API). It sends the new person's ID to your receiver. 2. Your receiver fetches the person from Follow Up Boss's API, then sends the lead to CallView: ```js // In your receiver, after you've fetched the person from Follow Up Boss: await fetch('https://v2-api.callview.ai/api/v1/external/leads', { method: 'POST', headers: { Authorization: `Bearer ${process.env.CALLVIEW_SECRET}`, 'Content-Type': 'application/json', 'Idempotency-Key': `fub-${person.id}-create`, }, body: JSON.stringify({ campaign_id: '7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01', external_id: `fub-${person.id}`, phone: person.phones?.[0]?.value, name: person.name, email: person.emails?.[0]?.value, fields: { source: person.source ?? '' }, consent: { source: 'crm', agreed_at: person.created, text: 'Opted in on the lead form' }, call_now: true, }), }); ``` Change the consent to match how your leads really agree to be called. ## Log the outcome 1. Point a CallView webhook endpoint at your receiver, with `"events": ["call.completed", "lead.opted_out"]`. [Check the signature](https://developers.callview.ai/guides/webhooks/#check-the-signature) on every delivery. 2. On `call.completed`, take the person's ID from `data.object.lead.external_id` (minus `fub-`) and use Follow Up Boss's API to: - add a note with `data.object.note` and who took the call (`data.object.handled_by.name`), - set a stage or a tag from `data.object.outcome` (for example `interested` moves them to "Hot"), - create a task for `data.object.callback_at` when the outcome is `callback`. 3. On `lead.opted_out`, mark the person do-not-call in Follow Up Boss as well. --- # Zapier Source: https://developers.callview.ai/recipes/zapier/ > Connect almost any CRM to CallView with two Zaps. One sends new leads, one writes outcomes back. This follows the three moves in [How every recipe works](https://developers.callview.ai/recipes/). Zapier is a good middle layer when your CRM can't send or receive webhooks itself. ## Zap 1: send new leads Start the Zap with your CRM's "New contact" (or "New lead") trigger. Then add **Webhooks by Zapier > Custom Request**: | Setting | Value | | --- | --- | | Method | `POST` | | URL | `https://v2-api.callview.ai/api/v1/external/leads` | | Data | The JSON below, with your CRM's fields mapped in | | Headers | `Authorization` = `Bearer cs_live_...`, `Content-Type` = `application/json`, `Idempotency-Key` = `zap-` plus the contact's ID | ```json { "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "", "phone": "", "name": "", "email": "", "consent": { "source": "web_form", "agreed_at": "", "url": "https://example.com/quote" }, "call_now": true } ``` Use Custom Request rather than the simpler POST action: it sends your JSON exactly as written, and CallView refuses fields it doesn't know. ## Zap 2: write outcomes back 1. Start with **Webhooks by Zapier > Catch Raw Hook**, and copy the address it gives you. 2. Point a CallView webhook endpoint at it, with `"events": ["call.completed"]`. Then send a sample with `POST /webhook_endpoints/{id}/test` so Zapier has data to map. 3. We recommend a **Code by Zapier** step next, to check the signature with the [Node or Python code](https://developers.callview.ai/guides/webhooks/#check-the-signature). Give it the raw body and the `CallView-Signature` header from the trigger, and stop the Zap if they don't match. 4. If your CRM words outcomes differently, a **Formatter** step can translate `outcome`. 5. Finish with your CRM's "Find contact" by `data.object.lead.external_id`, then "Update contact" with `data.object.outcome`, `data.object.note` and `data.object.handled_by.name`. Zapier may retry a step that times out, and we may send an event twice. If double notes would bother you, add a Filter step that skips an event `id` you've already stored. --- # Make Source: https://developers.callview.ai/recipes/make/ > Two Make scenarios. One sends new leads to CallView, one writes call outcomes back to your CRM. This follows the three moves in [How every recipe works](https://developers.callview.ai/recipes/). ## Scenario 1: send new leads Start with your CRM's "Watch new contacts" module, then add **HTTP > Make a request**: | Setting | Value | | --- | --- | | URL | `https://v2-api.callview.ai/api/v1/external/leads` | | Method | `POST` | | Headers | `Authorization` = `Bearer cs_live_...`, `Idempotency-Key` = `make-` plus the contact's ID | | Body type | Raw, with content type JSON (application/json) | | Request content | The JSON from [How every recipe works](https://developers.callview.ai/recipes/#1-send-each-new-lead), with your fields mapped in | | Parse response | Yes | Add an error handler for the HTTP module. A `409` (already sent) or `422` (on the Do Not Call list, say) is an answer: ignore it. A `429` or `5xx` can be retried: use Make's Break directive so it tries again later. ## Scenario 2: write outcomes back 1. Start with **Webhooks > Custom webhook**, and copy the address it gives you. 2. Point a CallView webhook endpoint at it, with `"events": ["call.completed", "lead.opted_out"]`. Send a sample with `POST /webhook_endpoints/{id}/test` so Make learns the fields. 3. Add a Router with one route for `type` = `call.completed` and one for `lead.opted_out`. 4. On the `call.completed` route, use your CRM's "Search contacts" by `data.object.lead.external_id`, then "Update a contact" with `data.object.outcome`, `data.object.note` and `data.object.handled_by.name`. 5. On the `lead.opted_out` route, mark the contact do-not-call. To check the signature in Make, turn on "Get request headers" and "JSON pass-through" in the webhook's advanced settings, so you have the raw body and the `CallView-Signature` header. Then compare `v1` with `sha256(t + "." + body; "hex"; your whsec_ secret)` and stop the scenario when they differ, or when `t` is more than 5 minutes old. If that's more than you want to build, keep the webhook address private. --- # Your own CRM Source: https://developers.callview.ai/recipes/your-own-crm/ > For a CRM you built yourself. Start AI calls from it and get the outcome, the note and the transcript back, with working Node and Python code. This is for a team that built its own CRM and wants it to start CallView's AI calls and get the results back. It's the three moves in [How every recipe works](https://developers.callview.ai/recipes/), with the code written out: 1. Your CRM sends each new lead to `POST /leads`, and the AI calls it within seconds. 2. When someone in the CRM wants a lead called again, the CRM sends `POST /calls`. 3. When a call is over, CallView sends `call.completed` to a small receiver in your CRM. It checks the signature, writes the outcome back to the record and, if you want it, fetches the transcript. The code below is complete. It needs Node 20 or later with no packages, or Python 3.8 or later with `requests` (and Flask for the receiver). ## 1. Make a key In CallView, open **Settings > API** and click **+ Create API key**, then fill it in like this: | Setting | What to pick | | --- | --- | | Test or Live | Test, while you build. A test key doesn't dial anyone and costs nothing. | | What it can do | The **CRM speed to lead** set: Leads (read and write), Start calls, Calls (read) and Events (read). Then tick Webhooks (read and write), so the CRM can set up its own webhook endpoint (step 5), and Calls: write if the CRM will call leads again (step 4). | | Recordings & transcripts | Tick it only if your CRM stores transcripts or recordings. Outcomes and notes don't need it. | | Which campaigns | Only the ones the CRM should fill. The key can't see or add leads anywhere else. | | Allowed IP addresses | Optional. Your CRM server's outgoing addresses, if they're fixed. Requests from other addresses are refused. | | Calls per day, Daily spend cap | Optional. Limits for this key alone, on top of your organization's spend cap. Set them a little above your busiest real day, so a CRM bug that sends the same leads over and over can't run up a bill. See [Money guards](https://developers.callview.ai/guides/money-guards/#limits-for-one-key). | The secret is shown once. Keep it on the CRM's server, out of web pages, and pass it in through the environment: ```bash export CALLVIEW_KEY_ID=ck_test_paste_yours_here export CALLVIEW_SECRET=cs_test_paste_yours_here export CALLVIEW_CAMPAIGN_ID=paste_the_campaign_id_here ``` `GET /campaigns` lists the campaign IDs the key can use. [Keys and authentication](https://developers.callview.ai/guides/authentication/#the-permissions) explains each permission. ## 2. Talk to CallView One small module handles the CRM's side: it adds leads, calls them again, and fetches transcripts. Each write carries an `Idempotency-Key`. We keep the first answer to a key for 24 hours, errors such as `403` and `409` included (`5xx` and `429` answers aren't kept). The same key again gets that kept answer back, and the same key with a different body gets `409 idempotency_mismatch`. So the module builds the key from three things: the record's ID, a send number, and a short hash of the data it sends. A retry of the same send is answered from the kept reply instead of making a second lead. A changed record gets a new key. When someone sends a record again on purpose (after fixing the key, say), the CRM passes the next send number. See [Safe retries](https://developers.callview.ai/guides/idempotency/). The module retries network errors, `5xx` answers and short `429` waits, with the same key each time. It doesn't wait out a long `Retry-After` (for `429 call_limit_reached` that can be hours). It hands the answer back with `retryAfter`, in seconds, so the CRM can try again then. See [Rate limits](https://developers.callview.ai/guides/rate-limits/). ```js title="callview.mjs" // callview.mjs: your CRM's side of CallView (Node 20 or later, no packages). // The key comes from the environment: CALLVIEW_KEY_ID and CALLVIEW_SECRET. import crypto from 'node:crypto'; const HOST = 'https://v2-api.callview.ai'; const BASE = `${HOST}/api/v1/external`; const AUTH = `Basic ${Buffer.from(`${process.env.CALLVIEW_KEY_ID}:${process.env.CALLVIEW_SECRET}`).toString('base64')}`; // Answers worth waiting for and sending again, with the same Idempotency-Key. const RETRY_CODES = new Set(['rate_limited', 'too_many_concurrent_requests', 'lead_rate_limited', 'idempotency_in_progress', 'test_flows_busy']); const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); // One request, tried up to 5 times. Answers { status, body, retryAfter, requestId }. export async function callview(method, path, { body, idempotencyKey } = {}) { const url = path.startsWith('/api/') ? HOST + path : BASE + path; for (let attempt = 1; attempt <= 5; attempt++) { let res; try { res = await fetch(url, { method, headers: { Authorization: AUTH, ...(body === undefined ? {} : { 'Content-Type': 'application/json' }), ...(idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : {}), }, body: body === undefined ? undefined : JSON.stringify(body), signal: AbortSignal.timeout(30_000), }); } catch (err) { if (attempt === 5) throw err; await sleep(500 * 2 ** attempt); continue; } const isJson = (res.headers.get('content-type') ?? '').includes('application/json'); const data = isJson ? await res.json() : await res.text(); const code = isJson ? data.error?.code : undefined; const retryAfter = Number(res.headers.get('retry-after') ?? 0) || 0; const worthRetrying = res.status >= 500 || (RETRY_CODES.has(code) && retryAfter <= 60); if (!worthRetrying || attempt === 5) return { status: res.status, body: data, retryAfter, requestId: res.headers.get('request-id') }; await sleep(Math.max(retryAfter * 1000, 500 * 2 ** attempt)); } } // What the CRM gets back: { ok: true, ...the reply } or { ok: false, status, error, retryAfter }. // retryAfter is in seconds, 0 when there's none: after queue_full or call_limit_reached, try again then. function answer(r, okStatuses) { if (okStatuses.includes(r.status)) return { ok: true, ...r.body.data }; const error = r.body && typeof r.body === 'object' && r.body.error ? r.body.error : { message: String(r.body) }; return { ok: false, status: r.status, error, retryAfter: r.retryAfter, requestId: r.requestId }; } // Send one CRM record to CallView, to be called now. `record` is your CRM's own lead. // `sendNo` is 1 the first time. Pass 2, 3 and so on when someone sends the record // again on purpose, so it isn't answered with an earlier send's kept reply. export async function sendLead(record, sendNo = 1) { const lead = { campaign_id: process.env.CALLVIEW_CAMPAIGN_ID, external_id: `crm-${record.id}`, // comes back on every call and event about this lead phone: record.phone, // +1 and 10 digits name: record.name, ...(record.email ? { email: record.email } : {}), // leave it out rather than send null // Your own fields, as text. The campaign's script can use them. fields: { product: record.product ?? '', budget: String(record.budget ?? '') }, consent: { source: 'web_form', agreed_at: record.consentAt, url: record.consentUrl }, call_now: true, }; // The same send of the same data reuses its key; changed data gets a new one. const version = crypto.createHash('sha256').update(JSON.stringify(lead)).digest('hex').slice(0, 16); const r = await callview('POST', '/leads', { body: lead, idempotencyKey: `crm-${record.id}-send${sendNo}-${version}` }); return answer(r, [200, 201]); } // Call a lead that's already in CallView, now. `clickId` is new for each click in // the CRM, so each click is its own call and a retry of the same click isn't. export async function callAgain(record, clickId) { const r = await callview('POST', '/calls', { idempotencyKey: `crm-${record.id}-call-${clickId}`, body: { external_id: `crm-${record.id}` }, }); return answer(r, [202]); } // The transcript as plain text, one "Name: text" line a turn. `transcriptPath` // is call.completed's transcript_path. Needs Recordings & transcripts on the key. export async function fetchTranscript(transcriptPath) { const r = await callview('GET', `${transcriptPath}?format=text`); if (r.status === 200) return r.body; if (r.status === 403) return null; // the key hasn't got recordings:read throw new Error(`CallView ${r.status} ${r.body?.error?.code ?? ''} (request ${r.requestId})`); } ``` ```python title="callview.py" # callview.py: your CRM's side of CallView (Python 3.8 or later). pip install requests # The key comes from the environment: CALLVIEW_KEY_ID and CALLVIEW_SECRET. import hashlib import json import os import time import requests HOST = "https://v2-api.callview.ai" BASE = HOST + "/api/v1/external" AUTH = (os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]) # Answers worth waiting for and sending again, with the same Idempotency-Key. RETRY_CODES = {"rate_limited", "too_many_concurrent_requests", "lead_rate_limited", "idempotency_in_progress", "test_flows_busy"} def callview(method, path, body=None, idempotency_key=None): """One request, tried up to 5 times. Answers (status, body, retry_after, request_id).""" url = HOST + path if path.startswith("/api/") else BASE + path headers = {"Idempotency-Key": idempotency_key} if idempotency_key else {} for attempt in range(1, 6): try: res = requests.request(method, url, auth=AUTH, headers=headers, json=body, timeout=30) except requests.RequestException: if attempt == 5: raise time.sleep(0.5 * 2 ** attempt) continue is_json = "application/json" in res.headers.get("Content-Type", "") data = res.json() if is_json else res.text code = (data.get("error") or {}).get("code") if is_json else None retry_after = int(res.headers.get("Retry-After") or 0) worth_retrying = res.status_code >= 500 or (code in RETRY_CODES and retry_after <= 60) if not worth_retrying or attempt == 5: return res.status_code, data, retry_after, res.headers.get("Request-Id") time.sleep(max(retry_after, 0.5 * 2 ** attempt)) def _answer(status, data, retry_after, request_id, ok_statuses): """What the CRM gets back: {"ok": True, ...the reply} or {"ok": False, "status", "error", "retry_after"}. retry_after is in seconds, 0 when there's none: after queue_full or call_limit_reached, try again then.""" if status in ok_statuses: return {"ok": True, **data["data"]} error = data.get("error", {}) if isinstance(data, dict) else {"message": str(data)} return {"ok": False, "status": status, "error": error, "retry_after": retry_after, "request_id": request_id} def send_lead(record, send_no=1): """Send one CRM record to CallView, to be called now. `record` is your CRM's own lead. `send_no` is 1 the first time. Pass 2, 3 and so on when someone sends the record again on purpose, so it isn't answered with an earlier send's kept reply.""" lead = { "campaign_id": os.environ["CALLVIEW_CAMPAIGN_ID"], "external_id": f"crm-{record['id']}", # comes back on every call and event about this lead "phone": record["phone"], # +1 and 10 digits "name": record["name"], # Your own fields, as text. The campaign's script can use them. "fields": {"product": record.get("product") or "", "budget": str(record.get("budget") or "")}, "consent": {"source": "web_form", "agreed_at": record["consent_at"], "url": record["consent_url"]}, "call_now": True, } if record.get("email"): lead["email"] = record["email"] # leave it out rather than send None # The same send of the same data reuses its key; changed data gets a new one. version = hashlib.sha256(json.dumps(lead, sort_keys=True).encode("utf-8")).hexdigest()[:16] key = f"crm-{record['id']}-send{send_no}-{version}" return _answer(*callview("POST", "/leads", body=lead, idempotency_key=key), (200, 201)) def call_again(record, click_id): """Call a lead that's already in CallView, now. `click_id` is new for each click in the CRM, so each click is its own call and a retry of it isn't.""" key = f"crm-{record['id']}-call-{click_id}" return _answer(*callview("POST", "/calls", body={"external_id": f"crm-{record['id']}"}, idempotency_key=key), (202,)) def fetch_transcript(transcript_path): """The transcript as plain text, one "Name: text" line a turn. `transcript_path` is call.completed's transcript_path. Needs Recordings & transcripts on the key.""" status, data, _retry_after, request_id = callview("GET", transcript_path + "?format=text") if status == 200: return data if status == 403: return None # the key hasn't got recordings:read raise RuntimeError(f"CallView {status} (request {request_id})") ``` Change the consent to match how your leads really agree to be called. Only the fields in the [API reference](https://developers.callview.ai/reference/leads/) are taken: unknown ones are refused, so don't send the CRM's whole record. ## 3. Read the answer to POST /leads `sendLead` gives back the reply's `data`, or the error. Show it on the record: | You get | What it means | In the CRM | | --- | --- | --- | | `201`, `"status": "dialing"` | A line was free. The AI is calling now. | "Calling now" | | `201`, `"status": "queued"` | Waiting for a free line. `place_in_line` 1 is next. | "In line" | | `201`, `"status": "scheduled"` | Outside the lead's calling hours, or another of your campaigns called the number in the last 24 hours. `scheduled_for` says when. | "Calls at ..." | | `201`, `"status": "held"` | Kept, not dialing yet. `held_reason` says why (below). | "Waiting" | | `200`, `"requeued": true` | The lead was already there, from before the campaign's repeat window (30 days unless it's changed), and it's back in line. | As `queued` | | `409 duplicate_lead` | Already in the campaign. `error.lead_id` is the lead you have. | Use `callAgain` to call it now, or `PATCH /leads/{id}` to change its details | | `409 idempotency_mismatch` | Not a duplicate lead. The same `Idempotency-Key` came with a different body, so the key is being made wrong. The module above doesn't do this. | Fix how the key is made | | `422 on_dnc_list` | The number is on your Do Not Call list. | Mark it do-not-call | | `400 invalid_phone`, `422 consent_required` | The record needs fixing. `error.param` names the field. | Flag the record, then send it with the next send number | | `403 permission_denied` | The key is missing a permission, named in `error.missing_permission` (for example `dialing:write`). | Fix the key, then send with the next send number | | `429 queue_full` | The campaign has 5,000 API leads waiting. | Send it again after `retryAfter` seconds | The `held_reason` words: | `held_reason` | Why | It's called | | --- | --- | --- | | `campaign_paused` | The campaign is paused. | When someone resumes it | | `campaign_not_started` | The campaign hasn't been started. | When someone starts it | | `spend_cap_reached` | Your organization's daily or monthly API spend cap is reached. | When the cap lifts | | `key_limit_reached` | This key's own calls per day or daily spend cap is reached. | After midnight in your organization's time zone | A held lead isn't lost and you don't need to send it again. It's called in its turn once the hold lifts. [Speed to lead](https://developers.callview.ai/guides/speed-to-lead/) has the whole story of a lead after `POST /leads`. ## 4. Call a lead again For a lead that's already in CallView, a "Call now" button in the CRM can use `callAgain`. It answers `202` with the same `status` words as `POST /leads`, plus `calls_left_today`. The key needs Calls: write and Start calls for this, so tick Calls: write too if you use it. | You get | What it means | | --- | --- | | `409 lead_busy` | The lead is being dialed or is on a call right now. | | `429 call_limit_reached` | The lead was called through the API 3 times in 24 hours. `retryAfter` says how many seconds until you can again. | | `422 on_dnc_list` | The number is on your Do Not Call list. | | `404 not_found` | No lead with that `external_id` in the key's campaigns. Send it with `sendLead` first. | ## 5. Get the outcome back Point a webhook endpoint at your receiver. Do it once, with the CRM's key: ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Content-Type: application/json' \ -d '{ "url": "https://crm.example.com/callview", "events": ["call.completed", "lead.opted_out"], "campaign_ids": ["7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01"] }' ``` Put the key's campaigns in `campaign_ids`. An endpoint without it covers every campaign, and a key limited to some campaigns can't make one of those: it gets `403 permission_denied`. The reply has a `secret` that starts with `whsec_`. It's shown this once. Give it to the receiver as `CALLVIEW_WEBHOOK_SECRET`. The receiver below checks every delivery's `CallView-Signature` with the code from [Webhooks and signatures](https://developers.callview.ai/guides/webhooks/#check-the-signature). Save that page's `verify-signature.js` next to it as `verify-signature.mjs` (the `.mjs` name makes Node load it as a module), or `verify_signature.py` for Python. The check is an HMAC-SHA256 over the raw body with your `whsec_` secret, and anything older than 5 minutes is refused, so a stranger can't send your CRM fake outcomes or replay old ones. Then it: - refuses a body over 1 MB before checking it (events are a few KB); - answers `200` straight away (we wait at most 10 seconds) and does the slow part after; - skips an event `id` it has already handled, because the same event can arrive twice; - leaves out test sends (`"sample": true`) and test-mode events (`"livemode": false`), which carry example data and placeholders, unless you set `CALLVIEW_ACCEPT_TEST_EVENTS=1` on a test copy of your CRM; - writes `outcome`, `outcome_label`, `note`, `handled_by` and `callback_at` to the record found by `lead.external_id`, but only when that call's `revision` is newer than the one stored, checked and written in one step, because a corrected outcome arrives as a new `call.completed` for the same call; - saves the outcome first, then fetches the transcript, so a failed fetch doesn't lose the outcome; - marks the record do-not-call on `lead.opted_out`; - logs IDs and the outcome only, not the lead's details or the transcript. ```js title="receiver.mjs" // receiver.mjs: CallView's events into your CRM (Node 20 or later, no packages). // Save verify-signature.js (from the Webhooks and signatures page) next to it as verify-signature.mjs. import http from 'node:http'; import { verifyCallViewSignature } from './verify-signature.mjs'; import { fetchTranscript } from './callview.mjs'; const MAX_BODY = 1024 * 1024; // events are a few KB: refuse anything over 1 MB const ACCEPT_TEST_EVENTS = process.env.CALLVIEW_ACCEPT_TEST_EVENTS === '1'; // only on a test copy of your CRM const handled = new Set(); // event ids you've handled: use your database in real life // Your CRM. Replace these with your own database updates. const revisions = new Map(); // call id -> the revision written: stands in for your database // Writes the outcome only if it's newer than the one stored for this call, and says // whether it did. Check and write in one step. In SQL: INSERT INTO call_outcomes ... // ON CONFLICT (call_id) DO UPDATE SET ... WHERE call_outcomes.revision < EXCLUDED.revision async function saveOutcomeIfNewer(externalId, callId, revision, fields) { if ((revisions.get(callId) ?? 0) >= revision) return false; revisions.set(callId, revision); // nothing awaited between the check and the write console.log('outcome', externalId, callId, revision, fields.outcome); // IDs and the outcome only return true; } async function saveTranscript(externalId, callId, text) { console.log('transcript', externalId, callId, `${text.length} characters`); } async function markDoNotCall(externalId) { console.log('do not call', externalId); } async function handle(event) { const obj = event.data.object; if (event.type === 'call.completed') { const externalId = obj.lead?.external_id; if (!externalId) return; // a lead your CRM didn't send const saved = await saveOutcomeIfNewer(externalId, obj.id, obj.revision, { outcome: obj.outcome, // a fixed word: build your rules on this outcome_label: obj.outcome_label, // your team's name for it: show this note: obj.note, // what was said, in a sentence or two handled_by: obj.handled_by?.name, // "AI", or the person who took the call callback_at: obj.callback_at, // when outcome is "callback" duration_seconds: obj.duration_seconds, }); if (!saved || !obj.transcript_path) return; // an older version, or no transcript try { const text = await fetchTranscript(obj.transcript_path); if (text !== null) await saveTranscript(externalId, obj.id, text); } catch (err) { console.error(`transcript for call ${obj.id}: ${err.message}`); // the outcome is saved already } } else if (event.type === 'lead.opted_out' && obj.external_id) { await markDoNotCall(obj.external_id); } } http .createServer((req, res) => { if (req.method !== 'POST' || req.url !== '/callview') { res.writeHead(404).end(); return; } if (Number(req.headers['content-length'] ?? 0) > MAX_BODY) { res.writeHead(413).end(); return; } const chunks = []; let size = 0; req.on('data', (chunk) => { size += chunk.length; if (size > MAX_BODY) { res.writeHead(413).end(); req.destroy(); return; } chunks.push(chunk); }); req.on('end', () => { const raw = Buffer.concat(chunks); // the raw bytes: the signature is over these if (!verifyCallViewSignature(raw, req.headers['callview-signature'], process.env.CALLVIEW_WEBHOOK_SECRET)) { res.writeHead(400).end('bad signature'); return; } const event = JSON.parse(raw.toString('utf8')); res.writeHead(200).end(); // answer first: the slow part runs after if (event.sample || (!event.livemode && !ACCEPT_TEST_EVENTS)) return; // example data, not a real call if (handled.has(event.id)) return; // a repeat: already handled handled.add(event.id); handle(event).catch((err) => console.error(`event ${event.id}: ${err.message}`)); }); }) .listen(3000, () => console.log('Listening on http://localhost:3000/callview')); ``` ```python title="receiver.py" # receiver.py: CallView's events into your CRM. pip install flask requests # Save verify_signature.py (from the Webhooks and signatures page) next to it. import json import os import threading from flask import Flask, request from callview import fetch_transcript from verify_signature import verify_callview_signature app = Flask(__name__) app.config["MAX_CONTENT_LENGTH"] = 1024 * 1024 # events are a few KB: Flask refuses over 1 MB with 413 ACCEPT_TEST_EVENTS = os.environ.get("CALLVIEW_ACCEPT_TEST_EVENTS") == "1" # only on a test copy of your CRM handled = set() # event ids you've handled: use your database in real life handled_lock = threading.Lock() # Your CRM. Replace these with your own database updates. revisions = {} # call id -> the revision written: stands in for your database revisions_lock = threading.Lock() def save_outcome_if_newer(external_id, call_id, revision, fields): """Writes the outcome only if it's newer than the one stored for this call, and says whether it did. Check and write in one step. In SQL: INSERT INTO call_outcomes ... ON CONFLICT (call_id) DO UPDATE SET ... WHERE call_outcomes.revision < EXCLUDED.revision""" with revisions_lock: # two threads can't both pass the check if revisions.get(call_id, 0) >= revision: return False revisions[call_id] = revision print("outcome", external_id, call_id, revision, fields["outcome"]) # IDs and the outcome only return True def save_transcript(external_id, call_id, text): print("transcript", external_id, call_id, f"{len(text)} characters") def mark_do_not_call(external_id): print("do not call", external_id) def handle(event): obj = event["data"]["object"] if event["type"] == "call.completed": external_id = (obj.get("lead") or {}).get("external_id") if not external_id: return # a lead your CRM didn't send saved = save_outcome_if_newer(external_id, obj["id"], obj["revision"], { "outcome": obj["outcome"], # a fixed word: build your rules on this "outcome_label": obj["outcome_label"], # your team's name for it: show this "note": obj["note"], # what was said, in a sentence or two "handled_by": (obj.get("handled_by") or {}).get("name"), # "AI", or the person who took the call "callback_at": obj["callback_at"], # when outcome is "callback" "duration_seconds": obj["duration_seconds"], }) if not saved or not obj.get("transcript_path"): return # an older version, or no transcript try: text = fetch_transcript(obj["transcript_path"]) if text is not None: save_transcript(external_id, obj["id"], text) except Exception as err: # the outcome is saved already print(f"transcript for call {obj['id']}: {err}") elif event["type"] == "lead.opted_out" and obj.get("external_id"): mark_do_not_call(obj["external_id"]) @app.post("/callview") def callview_events(): raw = request.get_data() # the raw bytes: the signature is over these header = request.headers.get("CallView-Signature", "") if not verify_callview_signature(raw, header, os.environ["CALLVIEW_WEBHOOK_SECRET"]): return "bad signature", 400 event = json.loads(raw) if event.get("sample") or (not event["livemode"] and not ACCEPT_TEST_EVENTS): return "", 200 # example data, not a real call with handled_lock: if event["id"] in handled: return "", 200 # a repeat: already handled handled.add(event["id"]) # Answer first: the slow part runs after. threading.Thread(target=handle, args=(event,), daemon=True).start() return "", 200 if __name__ == "__main__": app.run(port=3000) ``` In real life, save each event to a table or a queue before you answer, and work through it from there. If your server was down or a write failed, `GET /events?type=call.completed&created[gte]=...` lists what you missed (we keep events for 30 days). The [outcome words](https://developers.callview.ai/guides/outcomes/) page says what each `outcome` means. ## 6. The transcript `call.completed` carries `transcript_path` and `recording_path` when there is one, not the text or the audio itself. `fetchTranscript` asks for `?format=text`, one "Name: text" line a turn. Leave that off for JSON, with each line's speaker (`ai`, `lead` or `agent`), name and time. Both need Calls: read and Recordings & transcripts (`recordings:read`) on the key. Without it you get `403 permission_denied` with `"missing_permission": "recordings:read"`, and `fetchTranscript` returns nothing. The receiver saves the outcome before it asks, so a missing permission or a failed fetch costs only the transcript. For the recording, `GET /calls/{id}/recording` gives a link that works for 5 minutes, so fetch it when someone presses play, and don't store the link. ## 7. Test, then go live Run the receiver against a test copy of your CRM with `CALLVIEW_ACCEPT_TEST_EVENTS=1`, so it writes test-mode events. With the test key, send leads with the [magic numbers](https://developers.callview.ai/guides/test-mode/) as the phone. `+15550100001` plays an interested lead whom someone on your team takes over, with `call.completed` about 4 minutes later. `+15550100002` leaves a voicemail and `+15550100005` asks not to be called again, which sends `lead.opted_out`. Test events have placeholders like `LEAD_NAME` and `AI_NOTE` instead of real data, and the transcript lines read `AI_LINE_1`, `LEAD_LINE_1` and so on. To send your receiver a signed sample at any time, use `POST /webhook_endpoints/{id}/test` with `{ "type": "call.completed" }`. It's marked `"sample": true`, so the receiver checks its signature and answers `200` but doesn't write it to a record. When it all works: 1. Make a live key with the same settings, and put its ID and secret in the environment instead of the test ones. 2. Make the webhook endpoint again with the live key and the same `campaign_ids` (an endpoint made with a test key only ever gets test events), and give the receiver its new `whsec_` secret. On the real CRM, leave `CALLVIEW_ACCEPT_TEST_EVENTS` unset. 3. Send one real lead you can answer yourself, and watch the outcome land on the record. The campaign ID stays the same: a test key sees your real campaigns. --- # API reference Source: https://developers.callview.ai/reference/ > Every endpoint of the CallView API, with examples in curl, Node, Python and PHP. Base address: `https://v2-api.callview.ai/api/v1/external` This reference is made from the same description the API itself is checked against, so it says what the API does today. - [Leads](https://developers.callview.ai/reference/leads/): Add leads to a campaign (speed to lead), look them up, change them, opt them out. - [Calls](https://developers.callview.ai/reference/calls/): Calls, their outcomes, recordings and transcripts. Call a lead now. - [Campaigns](https://developers.callview.ai/reference/campaigns/): Your campaigns. Start and pause them. - [DNC](https://developers.callview.ai/reference/dnc/): Your organization's Do Not Call list. - [Events (GET /events)](https://developers.callview.ai/reference/events-api/): Every event we sent, or would have sent, for the last 30 days. - [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/): Where we send events, and how each delivery went. - [Usage](https://developers.callview.ai/reference/usage/): Requests, leads, calls, minutes and cost for a month. - [Exports](https://developers.callview.ai/reference/exports/): Download your leads and calls as a file. - [Objects](https://developers.callview.ai/reference/objects/): the lead, the call, the event and the rest, field by field. - [Events](https://developers.callview.ai/reference/events/): every event we send, with an example. - [Error codes](https://developers.callview.ai/reference/errors/): every code, and what it means. Download the description: [openapi.json](https://developers.callview.ai/openapi.json), [openapi.yaml](https://developers.callview.ai/openapi.yaml), or the [Postman collection](https://developers.callview.ai/callview.postman_collection.json). --- # Leads Source: https://developers.callview.ai/reference/leads/ > Add leads to a campaign (speed to lead), look them up, change them, opt them out. Add leads to a campaign (speed to lead), look them up, change them, opt them out. | Endpoint | What it does | | --- | --- | | [`POST /leads`](https://developers.callview.ai/reference/leads/add-a-lead/) | Add a lead (speed to lead) | | [`POST /leads/batch`](https://developers.callview.ai/reference/leads/add-up-to-60-leads/) | Add up to 60 leads | | [`GET /leads/{id}`](https://developers.callview.ai/reference/leads/get-a-lead/) | Get a lead - where it is and its calls | | [`GET /leads`](https://developers.callview.ai/reference/leads/find-or-list-leads/) | Find a lead by external_id, or list leads | | [`PATCH /leads/{id}`](https://developers.callview.ai/reference/leads/update-a-lead/) | Update a lead | | [`POST /leads/{id}/opt_out`](https://developers.callview.ai/reference/leads/opt-a-lead-out/) | Opt a lead out - stop calling, add to Do Not Call | | [`GET /campaigns/{campaignId}/leads`](https://developers.callview.ai/reference/leads/list-a-campaigns-leads-older-list/) | List a campaign's leads (older list) | | [`POST /campaigns/{campaignId}/leads`](https://developers.callview.ai/reference/leads/add-a-lead-older-address/) | Add a lead (older address) | | [`POST /campaigns/{campaignId}/leads/batch`](https://developers.callview.ai/reference/leads/add-up-to-60-leads-older-address/) | Add up to 60 leads (older address) | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # Add a lead (speed to lead) Source: https://developers.callview.ai/reference/leads/add-a-lead/ > Add a lead (speed to lead): POST /leads. **POST** `/leads` Checks the lead first: a valid +1 number, your Do Not Call list, the campaign's retired numbers, duplicates (by external_id or phone), consent if the campaign asks for it, number rules (no premium or international numbers) and the 5,000 waiting-lead limit. If it passes, the lead goes straight into the campaign's dial queue. A call_now lead is dialed before the campaign's other leads, oldest first, as the campaign's lines free up. Outside the lead's calling hours it is scheduled for the next window. A paused or not-started campaign holds the lead and dials it when the campaign runs, and so does a reached spend cap. A refused lead isn't saved. place_in_line and estimated_wait_seconds are estimates. With dry_run true every check runs and the lead isn't saved. Needs leads:write and dialing:write (Start calls). ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `campaign_id` | string (uuid) | yes | | | `external_id` | string | | Your own ID for the lead. The same external_id twice in a campaign is a duplicate. At most 200 characters. | | `phone` | string | yes | US or Canadian number. +1 and 10 digits is best; (212) 555-7812 is fine too. Numbers in the 555-0100 to 555-0199 range are refused as made up (test mode takes its magic numbers). At most 32 characters. | | `name` | string | | At most 200 characters. | | `email` | string | | At most 254 characters. | | `address` | string | | At most 500 characters. | | `fields` | object | | Your custom fields, at most 50. The campaign's script can use them. | | `consent` | Consent | | | | `call_now` | boolean | | Dial ahead of the campaign's other leads. Defaults to the campaign's setting. | | `dry_run` | boolean | | Run every check and answer, without saving the lead. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/leads' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: crm-10442-postLeads' \ -H 'Content-Type: application/json' \ -d '{ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "email": "dana@example.com", "fields": { "roof_age": "12" }, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" }, "call_now": true }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "email": "dana@example.com", "fields": { "roof_age": "12" }, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" }, "call_now": true }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/leads", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "email": "dana@example.com", "fields": { "roof_age": "12", }, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote", }, "call_now": True, }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "email": "dana@example.com", "fields": { "roof_age": "12" }, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" }, "call_now": true } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** A dry run (not saved), or a lead that already existed and was put back in the queue (requeued true) ```json { "data": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } } ``` **201** Accepted. status says what happens next. ```json { "data": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } } ``` ## Errors | Status | Codes | | --- | --- | | 400 | [`invalid_request`](https://developers.callview.ai/reference/errors/#invalid_request), [`invalid_phone`](https://developers.callview.ai/reference/errors/#invalid_phone) | | 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 | [`duplicate_lead`](https://developers.callview.ai/reference/errors/#duplicate_lead), [`campaign_closed`](https://developers.callview.ai/reference/errors/#campaign_closed), [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 422 | [`on_dnc_list`](https://developers.callview.ai/reference/errors/#on_dnc_list), [`number_retired`](https://developers.callview.ai/reference/errors/#number_retired), [`consent_required`](https://developers.callview.ai/reference/errors/#consent_required), [`number_not_allowed`](https://developers.callview.ai/reference/errors/#number_not_allowed) | | 429 | [`queue_full`](https://developers.callview.ai/reference/errors/#queue_full), [`lead_rate_limited`](https://developers.callview.ai/reference/errors/#lead_rate_limited), [`call_limit_reached`](https://developers.callview.ai/reference/errors/#call_limit_reached), [`test_flows_busy`](https://developers.callview.ai/reference/errors/#test_flows_busy), [`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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | 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/)). --- # Add up to 60 leads Source: https://developers.callview.ai/reference/leads/add-up-to-60-leads/ > Add up to 60 leads: POST /leads/batch. **POST** `/leads/batch` Each lead gets the same checks as POST /leads and its own result, in the order you sent them. A lead that fails doesn't stop the others. campaign_id may be on each lead or once for the batch. Each lead counts toward the key's new leads a minute. Needs leads:write and dialing:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `campaign_id` | string (uuid) | | | | `dry_run` | boolean | | | | `leads` | array of object | yes | At most 60 items. | | `leads[].campaign_id` | string (uuid) | | | | `leads[].external_id` | string | | At most 200 characters. | | `leads[].phone` | string | yes | At most 32 characters. | | `leads[].name` | string | | At most 200 characters. | | `leads[].email` | string | | At most 254 characters. | | `leads[].address` | string | | At most 500 characters. | | `leads[].fields` | object | | | | `leads[].consent` | Consent | | | | `leads[].call_now` | boolean | | | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/leads/batch' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postLeadsBatch-0001' \ -H 'Content-Type: application/json' \ -d '{ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "name": "Lee Park", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } }, { "external_id": "crm-10444", "phone": "+15550100003", "name": "Sam Ortiz", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } } ] }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/batch', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "name": "Lee Park", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } }, { "external_id": "crm-10444", "phone": "+15550100003", "name": "Sam Ortiz", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } } ] }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/leads/batch", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "name": "Lee Park", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote", }, }, { "external_id": "crm-10444", "phone": "+15550100003", "name": "Sam Ortiz", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote", }, }, ], }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "name": "Lee Park", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } }, { "external_id": "crm-10444", "phone": "+15550100003", "name": "Sam Ortiz", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } } ] } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** A result per lead: { index, ok: true, lead } or { index, ok: false, error: { code, message, param, lead_id } } ```json { "data": { "succeeded": 1, "failed": 1, "dry_run": true, "results": [ { "index": 1, "ok": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } } ], "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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 429 | [`lead_rate_limited`](https://developers.callview.ai/reference/errors/#lead_rate_limited), [`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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | 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/)). --- # Get a lead - where it is and its calls Source: https://developers.callview.ai/reference/leads/get-a-lead/ > Get a lead - where it is and its calls: GET /leads/{id}. **GET** `/leads/{id}` The lead object: id, external_id, campaign_id, livemode, name, phone, email, address, fields, consent, lead_source, owner ({ id, name } of the SDR its latest call was dialed for, or null), created, updated, status, call_now, place_in_line and estimated_wait_seconds (while queued; estimates), scheduled_for, scheduled_reason, held_reason, callback_at, late, attempts, last_outcome (a stable word, the same as the call object's outcome) and last_outcome_label (your organization's name for it), next_dial_at, and calls (the last 10, newest first: { id, started, outcome, outcome_label, duration_seconds }). status: new (not yet queued), queued (due now), scheduled (waits for scheduled_for: calling hours, a cooldown, a retry), held (held_reason: campaign_paused, campaign_not_started, spend_cap_reached, key_limit_reached), dialing, on_call, callback_scheduled (callback_at), done (finished, not coming back), out_of_queue (taken out, opted out or on the Do Not Call list). A lead in a campaign outside the key's, in another organization, or removed is 404 not_found. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/leads/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10' \ -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/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10', { 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/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", 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 '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** The lead ```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) | | 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/)). --- # Find a lead by external_id, or list leads Source: https://developers.callview.ai/reference/leads/find-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 '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/)). --- # Update a lead Source: https://developers.callview.ai/reference/leads/update-a-lead/ > Update a lead: PATCH /leads/{id}. **PATCH** `/leads/{id}` name, email, address (null or "" clears one), fields (merged: a key sent as "" is removed; other keys are kept), consent (replaced), external_id (only while the lead has none), call_now: false (drops the speed-to-lead priority). The phone can't be changed (phone_cannot_change): add a new lead instead. Answers the updated lead. Idempotency-Key is honoured. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `name` | string or null | | At most 200 characters. | | `email` | string or null | | At most 254 characters. | | `address` | string or null | | At most 500 characters. | | `fields` | object | | Merged: a key sent as "" is removed, other keys are kept. | | `consent` | Consent | | | | `external_id` | string | | Only while the lead has none. At most 200 characters. | | `call_now` | boolean | | false drops the speed-to-lead priority. One of `false`. | | `phone` | string | | Can't be changed (phone_cannot_change). Add a new lead instead. | ## Example request ### curl ```bash curl -X PATCH 'https://v2-api.callview.ai/api/v1/external/leads/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: patchLeadsId-0001' \ -H 'Content-Type: application/json' \ -d '{ "name": "Dana Smith-Lee", "fields": { "roof_age": "13", "old_field": "" } }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10', { method: 'PATCH', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "name": "Dana Smith-Lee", "fields": { "roof_age": "13", "old_field": "" } }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "PATCH", "https://v2-api.callview.ai/api/v1/external/leads/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "name": "Dana Smith-Lee", "fields": { "roof_age": "13", "old_field": "", }, }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'PATCH', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "name": "Dana Smith-Lee", "fields": { "roof_age": "13", "old_field": "" } } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** The updated lead ```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 | [`duplicate_lead`](https://developers.callview.ai/reference/errors/#duplicate_lead), [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 422 | [`phone_cannot_change`](https://developers.callview.ai/reference/errors/#phone_cannot_change) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | 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/)). --- # Opt a lead out - stop calling, add to Do Not Call Source: https://developers.callview.ai/reference/leads/opt-a-lead-out/ > Opt a lead out - stop calling, add to Do Not Call: POST /leads/{id}/opt_out. **POST** `/leads/{id}/opt_out` The number goes on the organization's Do Not Call list (source "API"), so no campaign of the organization dials it again; the lead leaves the queue with the DNC outcome and its open callbacks are closed. A call in progress is NOT cut: the reply says call_in_progress true, and nothing dials the number again. Idempotent: a second opt_out answers the same, with no second Do Not Call entry. Answers the updated lead plus call_in_progress. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `reason` | string | | Why (kept in the audit log and on closed callbacks) At most 500 characters. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/leads/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10/opt_out' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postLeadsIdOptOut-0001' \ -H 'Content-Type: application/json' \ -d '{ "reason": "Asked to stop on our web chat" }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10/opt_out', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "reason": "Asked to stop on our web chat" }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/leads/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10/opt_out", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "reason": "Asked to stop on our web chat", }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "reason": "Asked to stop on our web chat" } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** The lead, plus call_in_progress ```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, "call_in_progress": 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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | 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/)). --- # List a campaign's leads (older list) Source: https://developers.callview.ai/reference/leads/list-a-campaigns-leads-older-list/ > List a campaign's leads (older list): GET /campaigns/{campaignId}/leads. **GET** `/campaigns/{campaignId}/leads` A campaign's leads, page by page (cursor = the next_cursor you were given). A live key gets the older lead shape here; GET /leads with campaign_id gives the lead object and is the one to use for new work. Needs leads:read. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `campaignId` | path | string (uuid) | yes | | | `cursor` | query | string | | | | `limit` | query | integer | | Default `50`. 1 to 100. | | `search` | query | string | | Part of a name, phone or email. At most 200 characters. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/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 '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** A page of leads ```json { "data": [ { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "livemode": true } ], "meta": { "next_cursor": null, "has_more": false } } ``` ## 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) | | 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/)). --- # Add a lead (older address) Source: https://developers.callview.ai/reference/leads/add-a-lead-older-address/ > Add a lead (older address): POST /campaigns/{campaignId}/leads. **POST** `/campaigns/{campaignId}/leads` The same checks, queue and reply as POST /leads, with the campaign in the path. customFields is still accepted (it is merged into fields). Use POST /leads for new work. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `campaignId` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `phone` | string | yes | At most 32 characters. | | `external_id` | string | | At most 200 characters. | | `name` | string | | At most 200 characters. | | `email` | string | | At most 254 characters. | | `address` | string | | At most 500 characters. | | `fields` | object | | | | `customFields` | object | | | | `consent` | Consent | | | | `call_now` | boolean | | | | `dry_run` | boolean | | | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/leads' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: crm-10442-postCampaignsCampaignIdLeads' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "call_now": true, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/leads', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "call_now": true, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/leads", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "call_now": True, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote", }, }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "external_id": "crm-10442", "phone": "+15550100001", "name": "Dana Smith", "call_now": true, "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** A dry run, or a re-queued lead ```json { "data": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } } ``` **201** Accepted (see POST /leads) ```json { "data": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } } ``` ## Errors | Status | Codes | | --- | --- | | 400 | [`invalid_request`](https://developers.callview.ai/reference/errors/#invalid_request), [`invalid_phone`](https://developers.callview.ai/reference/errors/#invalid_phone) | | 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 | [`duplicate_lead`](https://developers.callview.ai/reference/errors/#duplicate_lead), [`campaign_closed`](https://developers.callview.ai/reference/errors/#campaign_closed), [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 422 | [`on_dnc_list`](https://developers.callview.ai/reference/errors/#on_dnc_list), [`number_retired`](https://developers.callview.ai/reference/errors/#number_retired), [`consent_required`](https://developers.callview.ai/reference/errors/#consent_required), [`number_not_allowed`](https://developers.callview.ai/reference/errors/#number_not_allowed) | | 429 | [`queue_full`](https://developers.callview.ai/reference/errors/#queue_full), [`lead_rate_limited`](https://developers.callview.ai/reference/errors/#lead_rate_limited), [`test_flows_busy`](https://developers.callview.ai/reference/errors/#test_flows_busy), [`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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | 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/)). --- # Add up to 60 leads (older address) Source: https://developers.callview.ai/reference/leads/add-up-to-60-leads-older-address/ > Add up to 60 leads (older address): POST /campaigns/{campaignId}/leads/batch. **POST** `/campaigns/{campaignId}/leads/batch` The same as POST /leads/batch, with the campaign in the path. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `campaignId` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `dry_run` | boolean | | | | `leads` | array of object | yes | At most 60 items. | | `leads[].phone` | string | yes | | | `leads[].external_id` | string | | | | `leads[].name` | string | | | | `leads[].email` | string | | | | `leads[].address` | string | | | | `leads[].fields` | object | | | | `leads[].customFields` | object | | | | `leads[].consent` | Consent | | | | `leads[].call_now` | boolean | | | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/leads/batch' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postCampaignsCampaignIdLeadsBatch-0001' \ -H 'Content-Type: application/json' \ -d '{ "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } } ] }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/leads/batch', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } } ] }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/leads/batch", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote", }, }, ], }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "leads": [ { "external_id": "crm-10443", "phone": "+15550100002", "consent": { "source": "web_form", "agreed_at": "2026-10-06T16:58:02Z", "url": "https://example.com/quote" } } ] } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** A result per lead (see POST /leads/batch) ```json { "data": { "succeeded": 1, "failed": 1, "dry_run": true, "results": [ { "index": 1, "ok": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } } ], "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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 429 | [`lead_rate_limited`](https://developers.callview.ai/reference/errors/#lead_rate_limited), [`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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | 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/)). --- # Calls Source: https://developers.callview.ai/reference/calls/ > Calls, their outcomes, recordings and transcripts. Call a lead now. Calls, their outcomes, recordings and transcripts. Call a lead now. | Endpoint | What it does | | --- | --- | | [`GET /calls`](https://developers.callview.ai/reference/calls/list-calls/) | List calls | | [`GET /calls/{id}`](https://developers.callview.ai/reference/calls/get-a-call/) | Get a call | | [`GET /calls/{id}/recording`](https://developers.callview.ai/reference/calls/get-the-recording/) | A link to the call's recording, valid for 5 minutes | | [`GET /calls/{id}/transcript`](https://developers.callview.ai/reference/calls/get-the-transcript/) | The call's transcript | | [`POST /calls`](https://developers.callview.ai/reference/calls/call-this-lead-now/) | Call this lead now | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # List calls Source: https://developers.callview.ai/reference/calls/list-calls/ > List calls: GET /calls. **GET** `/calls` Newest first. Cursor-paged: pass the last call's id as starting_after for the next page. Needs calls:read; a key limited to some campaigns sees only their calls. Deprecated for one release: offset and status (and a limit over 100) still answer the old list shape, with a Deprecation header. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `limit` | query | integer | | Default `50`. 1 to 100. | | `starting_after` | query | string (uuid) | | | | `campaign_id` | query | string (uuid) | | | | `lead_id` | query | string (uuid) | | | | `external_id` | query | string | | The lead's ID in your system. | | `outcome` | query | string | | One of `interested` / `not_interested` / `callback` / `voicemail` / `no_answer` / `busy` / `failed` / `dnc` / `wrong_number` / `hung_up` / `screened` / `language_barrier` / `not_qualified` / `undetermined` / `other`. | | `created[gte]` | query | string | | | | `created[lte]` | query | string | | | | `offset` | query | integer | | | | `status` | query | string | | | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/calls' \ -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/calls', { 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/calls", 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 '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** A page of calls, newest first ```json { "data": [ { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "ended", "outcome": "interested", "outcome_label": "Interested", "note": "Wants a quote for a 6 kW system; home owner, roof replaced 2019.", "duration_seconds": 412, "started": "2026-10-06T16:58:06.000Z", "answered": "2026-10-06T16:58:14.000Z", "ended": "2026-10-06T17:04:58.000Z", "updated": "2026-10-06T17:05:20.000Z", "handled_by": { "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "name": "SDR_NAME", "role": "sdr" }, "owner": null, "tth_seconds": 9.3, "callback_at": null, "recording_available": true, "transcript_available": true, "started_by": { "type": "api", "api_key_id": "key_example" } } ], "meta": { "next_cursor": null, "has_more": false } } ``` ## 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) | | 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 [Calls](https://developers.callview.ai/reference/calls/). 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/)). --- # Get a call Source: https://developers.callview.ai/reference/calls/get-a-call/ > Get a call: GET /calls/{id}. **GET** `/calls/{id}` Needs calls:read. A call in another organization, or in a campaign outside the key's, is 404. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b' \ -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/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b', { 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/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", 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 '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** The call ```json { "data": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "ended", "outcome": "interested", "outcome_label": "Interested", "note": "Wants a quote for a 6 kW system; home owner, roof replaced 2019.", "duration_seconds": 412, "started": "2026-10-06T16:58:06.000Z", "answered": "2026-10-06T16:58:14.000Z", "ended": "2026-10-06T17:04:58.000Z", "updated": "2026-10-06T17:05:20.000Z", "handled_by": { "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "name": "SDR_NAME", "role": "sdr" }, "owner": null, "tth_seconds": 9.3, "callback_at": null, "recording_available": true, "transcript_available": true, "started_by": { "type": "api", "api_key_id": "key_example" } } } ``` ## 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) | | 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 [Calls](https://developers.callview.ai/reference/calls/). 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/)). --- # A link to the call's recording, valid for 5 minutes Source: https://developers.callview.ai/reference/calls/get-the-recording/ > A link to the call's recording, valid for 5 minutes: GET /calls/{id}/recording. **GET** `/calls/{id}/recording` Made on request and never stored: fetch a fresh one each time. The link is a signed storage URL that stops working at expires_at. 404 recording_not_available when there is none (recording is off for your organization, or it is past retention). Needs calls:read and recordings:read. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/recording' \ -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/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/recording', { 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/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/recording", 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 '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** A link that works for 5 minutes ```json { "data": { "url": "https://storage.example.com/recordings/e4d3c2b1.mp3?X-Signature=example", "expires_at": "2026-10-06T17:10:20.000Z", "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), [`recording_not_available`](https://developers.callview.ai/reference/errors/#recording_not_available) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Calls](https://developers.callview.ai/reference/calls/). 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/)). --- # The call's transcript Source: https://developers.callview.ai/reference/calls/get-the-transcript/ > The call's transcript: GET /calls/{id}/transcript. **GET** `/calls/{id}/transcript` The lines in order: speaker ai, lead or agent (the person who took the call), with a name and a time. ?format=text answers plain text, one "Name: text" line per turn. Needs calls:read and recordings:read. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `format` | query | string | | One of `json` / `text`. Default `"json"`. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/transcript' \ -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/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/transcript', { 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/calls/e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b/transcript", 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 '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** The transcript, or plain text with ?format=text ```json { "data": { "call_id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "lines": [ { "speaker": "ai", "name": "AI", "text": "Hi, is this Dana? This is Alex from Example Solar.", "at": "2026-10-06T16:58:15.000Z" }, { "speaker": "lead", "name": "LEAD_NAME", "text": "Yes, I'd like to hear what it would cost for my house.", "at": "2026-10-06T16:59:02.000Z" }, { "speaker": "agent", "name": "SDR_NAME", "text": "Hi Dana, I can help with that.", "at": "2026-10-06T16:59:12.000Z" } ], "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) | | 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 [Calls](https://developers.callview.ai/reference/calls/). 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/)). --- # Call this lead now Source: https://developers.callview.ai/reference/calls/call-this-lead-now/ > Call this lead now: POST /calls. **POST** `/calls` Puts an existing lead at the front of its campaign's dial queue (the same queue as POST /leads with call_now): it is dialed next, never above the campaign's lines. The same checks and the same reply as POST /leads: dialing, queued (with the place in line), scheduled (outside the lead's calling hours) or held (a paused campaign). Do Not Call, calling hours and the other dialing rules always apply. At most 3 API-started calls per lead in 24 hours. Needs calls:write and dialing:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `lead_id` | string (uuid) | | | | `external_id` | string | | Your ID for the lead (send campaign_id too if it is in more than one campaign) | | `campaign_id` | string (uuid) | | | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/calls' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: crm-10442-postCalls' \ -H 'Content-Type: application/json' \ -d '{ "external_id": "crm-10442" }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/calls', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "external_id": "crm-10442" }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/calls", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "external_id": "crm-10442", }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "external_id": "crm-10442" } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **202** Accepted. status says what happens next. ```json { "data": { "lead_id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "status": "dialing", "place_in_line": 1, "estimated_wait_seconds": 1, "scheduled_for": "2026-10-06T17:05:20Z", "scheduled_reason": "outside_calling_hours", "held_reason": "campaign_paused", "calls_left_today": 1, "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 | [`lead_busy`](https://developers.callview.ai/reference/errors/#lead_busy), [`lead_taken_out_of_queue`](https://developers.callview.ai/reference/errors/#lead_taken_out_of_queue), [`campaign_closed`](https://developers.callview.ai/reference/errors/#campaign_closed), [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 422 | [`on_dnc_list`](https://developers.callview.ai/reference/errors/#on_dnc_list), [`number_retired`](https://developers.callview.ai/reference/errors/#number_retired), [`number_not_allowed`](https://developers.callview.ai/reference/errors/#number_not_allowed) | | 429 | [`call_limit_reached`](https://developers.callview.ai/reference/errors/#call_limit_reached), [`test_flows_busy`](https://developers.callview.ai/reference/errors/#test_flows_busy), [`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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Calls](https://developers.callview.ai/reference/calls/). 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/)). --- # Campaigns Source: https://developers.callview.ai/reference/campaigns/ > Your campaigns. Start and pause them. Your campaigns. Start and pause them. | Endpoint | What it does | | --- | --- | | [`GET /campaigns`](https://developers.callview.ai/reference/campaigns/list-campaigns/) | List campaigns | | [`GET /campaigns/{id}`](https://developers.callview.ai/reference/campaigns/get-a-campaign/) | Get a campaign | | [`POST /campaigns/{id}/activate`](https://developers.callview.ai/reference/campaigns/start-a-campaign/) | Start a campaign | | [`POST /campaigns/{id}/pause`](https://developers.callview.ai/reference/campaigns/pause-a-campaign/) | Pause a campaign | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # List campaigns Source: https://developers.callview.ai/reference/campaigns/list-campaigns/ > List campaigns: GET /campaigns. **GET** `/campaigns` The campaigns this key can use, page by page (cursor = the next_cursor you were given). Needs campaigns:read. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `cursor` | query | string | | | | `limit` | query | integer | | Default `50`. 1 to 100. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/campaigns' \ -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/campaigns', { 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/campaigns", 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 '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** A page of campaigns ```json { "data": [ { "id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "name": "Roofing leads", "status": "active", "livemode": true } ], "meta": { "next_cursor": null, "has_more": false } } ``` ## 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) | | 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 [Campaigns](https://developers.callview.ai/reference/campaigns/). 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/)). --- # Get a campaign Source: https://developers.callview.ai/reference/campaigns/get-a-campaign/ > Get a campaign: GET /campaigns/{id}. **GET** `/campaigns/{id}` Needs campaigns:read. A test key sees the id and name only. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01' \ -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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01', { 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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", 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 '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** The campaign ```json { "data": { "id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "name": "Roofing leads", "status": "active", "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) | | 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 [Campaigns](https://developers.callview.ai/reference/campaigns/). 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/)). --- # Start a campaign Source: https://developers.callview.ai/reference/campaigns/start-a-campaign/ > Start a campaign: POST /campaigns/{id}/activate. **POST** `/campaigns/{id}/activate` Starts (or restarts) dialing. The campaign needs an SDR and must be a draft or paused. A test key changes nothing and answers what the status would be. Needs campaigns:write and dialing:write (Start calls). ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/activate' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postCampaignsIdActivate-0001' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/activate', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Idempotency-Key': randomUUID() }, }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/activate", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** Started ```json { "data": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Campaigns](https://developers.callview.ai/reference/campaigns/). 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/)). --- # Pause a campaign Source: https://developers.callview.ai/reference/campaigns/pause-a-campaign/ > Pause a campaign: POST /campaigns/{id}/pause. **POST** `/campaigns/{id}/pause` Stops new calls. Calls already up carry on. Leads you add while it is paused are kept (status held) and dialed when it starts again. A test key changes nothing. Needs campaigns:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/pause' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postCampaignsIdPause-0001' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/pause', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Idempotency-Key': randomUUID() }, }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/campaigns/7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01/pause", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** Paused ```json { "data": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Campaigns](https://developers.callview.ai/reference/campaigns/). 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/)). --- # DNC Source: https://developers.callview.ai/reference/dnc/ > Your organization's Do Not Call list. Your organization's Do Not Call list. | Endpoint | What it does | | --- | --- | | [`GET /dnc/check`](https://developers.callview.ai/reference/dnc/is-this-number-on-the-list/) | Is this number on the list? | | [`POST /dnc`](https://developers.callview.ai/reference/dnc/add-a-number-to-the-list/) | Add a number to the list | | [`POST /dnc/batch`](https://developers.callview.ai/reference/dnc/add-up-to-100-numbers-to-the-list/) | Add up to 100 numbers to the list | | [`GET /dnc`](https://developers.callview.ai/reference/dnc/list-the-do-not-call-list/) | List your Do Not Call list | | [`DELETE /dnc/{id}`](https://developers.callview.ai/reference/dnc/take-a-number-off-the-list/) | Take a number off the list | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # Is this number on the list? Source: https://developers.callview.ai/reference/dnc/is-this-number-on-the-list/ > Is this number on the list?: GET /dnc/check. **GET** `/dnc/check` Needs dnc:read. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `phone` | query | string | yes | The number to check, in any common format. URL-encode a leading plus (%2B); an unencoded one arrives as a space and is read as a plus. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/dnc/check?phone=%2B12125557812' \ -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/dnc/check?phone=%2B12125557812', { 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/dnc/check?phone=%2B12125557812", 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 '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** The answer. normalizedPhone is the number in E.164 form, as the list stores it; null when the number couldn't be read (the value as sent was then matched exactly, so onDncList false does not mean it is safe to call). ```json { "data": { "phone": "+15550100001", "normalizedPhone": "string", "onDncList": true, "livemode": true } } ``` ## Errors | Status | Codes | | --- | --- | | 400 | [`invalid_request`](https://developers.callview.ai/reference/errors/#invalid_request), [`invalid_phone`](https://developers.callview.ai/reference/errors/#invalid_phone) | | 401 | [`authentication_failed`](https://developers.callview.ai/reference/errors/#authentication_failed) | | 403 | [`permission_denied`](https://developers.callview.ai/reference/errors/#permission_denied) | | 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 [DNC](https://developers.callview.ai/reference/dnc/). 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/)). --- # Add a number to the list Source: https://developers.callview.ai/reference/dnc/add-a-number-to-the-list/ > Add a number to the list: POST /dnc. **POST** `/dnc` No campaign of your organization dials it again. Your leads with this number get a lead.opted_out event. Needs dnc:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `phone` | string | yes | | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/dnc' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postDnc-0001' \ -H 'Content-Type: application/json' \ -d '{ "phone": "+12125557812" }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/dnc', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "phone": "+12125557812" }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/dnc", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "phone": "+12125557812", }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "phone": "+12125557812" } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **201** Added ```json { "data": { "id": "9c8b7a6f-5e4d-4c3b-8a29-1f0e9d8c7b6a", "phone": "+12125557812", "source": "api", "createdAt": "2026-10-06T16:58:04.000Z", "livemode": true } } ``` ## Errors | Status | Codes | | --- | --- | | 400 | [`invalid_request`](https://developers.callview.ai/reference/errors/#invalid_request), [`invalid_phone`](https://developers.callview.ai/reference/errors/#invalid_phone) | | 401 | [`authentication_failed`](https://developers.callview.ai/reference/errors/#authentication_failed) | | 403 | [`permission_denied`](https://developers.callview.ai/reference/errors/#permission_denied) | | 409 | [`duplicate_dnc_entry`](https://developers.callview.ai/reference/errors/#duplicate_dnc_entry), [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [DNC](https://developers.callview.ai/reference/dnc/). 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/)). --- # Add up to 100 numbers to the list Source: https://developers.callview.ai/reference/dnc/add-up-to-100-numbers-to-the-list/ > Add up to 100 numbers to the list: POST /dnc/batch. **POST** `/dnc/batch` Each number is added on its own; errors lists the ones that weren't (bad or already there). Needs dnc:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `phones` | array of string | yes | At most 100 items. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/dnc/batch' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postDncBatch-0001' \ -H 'Content-Type: application/json' \ -d '{ "phones": [ "+12125557812", "+13105557845" ] }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/dnc/batch', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "phones": [ "+12125557812", "+13105557845" ] }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/dnc/batch", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "phones": [ "+12125557812", "+13105557845", ], }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "phones": [ "+12125557812", "+13105557845" ] } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** How many were added ```json { "data": { "succeeded": 1, "failed": 1, "errors": [ "string" ], "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) | | 409 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [DNC](https://developers.callview.ai/reference/dnc/). 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/)). --- # List your Do Not Call list Source: https://developers.callview.ai/reference/dnc/list-the-do-not-call-list/ > List your Do Not Call list: GET /dnc. **GET** `/dnc` Page by page (cursor = the next_cursor you were given). Needs dnc:read. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `cursor` | query | string | | | | `limit` | query | integer | | Default `50`. 1 to 100. | | `search` | query | string | | Part of a phone number. At most 200 characters. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/dnc' \ -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/dnc', { 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/dnc", 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 '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** A page of entries ```json { "data": [ { "id": "9c8b7a6f-5e4d-4c3b-8a29-1f0e9d8c7b6a", "phone": "+12125557812", "source": "api", "createdAt": "2026-10-06T16:58:04.000Z", "livemode": true } ], "meta": { "next_cursor": null, "has_more": false } } ``` ## 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) | | 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 [DNC](https://developers.callview.ai/reference/dnc/). 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/)). --- # Take a number off the list Source: https://developers.callview.ai/reference/dnc/take-a-number-off-the-list/ > Take a number off the list: DELETE /dnc/{id}. **DELETE** `/dnc/{id}` Needs dnc:write. Be sure the person asked for it; we can call the number again after this. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X DELETE 'https://v2-api.callview.ai/api/v1/external/dnc/9c8b7a6f-5e4d-4c3b-8a29-1f0e9d8c7b6a' \ -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/dnc/9c8b7a6f-5e4d-4c3b-8a29-1f0e9d8c7b6a', { method: 'DELETE', 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( "DELETE", "https://v2-api.callview.ai/api/v1/external/dnc/9c8b7a6f-5e4d-4c3b-8a29-1f0e9d8c7b6a", 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 'DELETE', 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** The entry that was removed ```json { "data": { "id": "9c8b7a6f-5e4d-4c3b-8a29-1f0e9d8c7b6a", "phone": "+12125557812", "source": "api", "createdAt": "2026-10-06T16:58:04.000Z", "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) | | 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 [DNC](https://developers.callview.ai/reference/dnc/). 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/)). --- # Webhook endpoints Source: https://developers.callview.ai/reference/webhook-endpoints/ > Where we send events, and how each delivery went. Where we send events, and how each delivery went. | Endpoint | What it does | | --- | --- | | [`POST /webhook_endpoints`](https://developers.callview.ai/reference/webhook-endpoints/create-a-webhook-endpoint/) | Create a webhook endpoint | | [`GET /webhook_endpoints`](https://developers.callview.ai/reference/webhook-endpoints/list-webhook-endpoints/) | List webhook endpoints | | [`GET /webhook_endpoints/{id}`](https://developers.callview.ai/reference/webhook-endpoints/get-a-webhook-endpoint/) | Get a webhook endpoint | | [`PATCH /webhook_endpoints/{id}`](https://developers.callview.ai/reference/webhook-endpoints/change-a-webhook-endpoint/) | Change a webhook endpoint | | [`DELETE /webhook_endpoints/{id}`](https://developers.callview.ai/reference/webhook-endpoints/delete-a-webhook-endpoint/) | Delete a webhook endpoint | | [`POST /webhook_endpoints/{id}/test`](https://developers.callview.ai/reference/webhook-endpoints/send-a-test-event/) | Send a test event | | [`GET /webhook_endpoints/{id}/deliveries`](https://developers.callview.ai/reference/webhook-endpoints/an-endpoints-deliveries/) | An endpoint's deliveries | | [`POST /webhook_endpoints/{id}/deliveries/{delivery_id}/resend`](https://developers.callview.ai/reference/webhook-endpoints/send-a-delivery-again/) | Send a delivery again | | [`POST /webhook_endpoints/{id}/roll_secret`](https://developers.callview.ai/reference/webhook-endpoints/roll-the-signing-secret/) | Roll the signing secret | | [`POST /webhook_endpoints/{id}/resume`](https://developers.callview.ai/reference/webhook-endpoints/resume-a-paused-endpoint/) | Resume a paused endpoint | | [`GET /webhooks`](https://developers.callview.ai/reference/webhook-endpoints/list-webhooks-old/) | List webhooks (old). Old: still works, use the newer one. | | [`POST /webhooks`](https://developers.callview.ai/reference/webhook-endpoints/create-a-webhook-old/) | Create a webhook (old). Old: still works, use the newer one. | | [`DELETE /webhooks/{id}`](https://developers.callview.ai/reference/webhook-endpoints/delete-a-webhook-old/) | Delete a webhook (old). Old: still works, use the newer one. | | [`GET /webhooks/{id}/deliveries`](https://developers.callview.ai/reference/webhook-endpoints/a-webhooks-deliveries-old/) | A webhook's deliveries (old). Old: still works, use the newer one. | | [`GET /webhooks/events`](https://developers.callview.ai/reference/webhook-endpoints/the-event-catalog-old/) | The event catalog (old). Old: still works, use the newer one. | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # Create a webhook endpoint Source: https://developers.callview.ai/reference/webhook-endpoints/create-a-webhook-endpoint/ > Create a webhook endpoint: POST /webhook_endpoints. **POST** `/webhook_endpoints` Where we send events. HTTPS only, and the address must be on the public internet. The endpoint's mode is the key's: a test key's endpoint gets test events only. The secret (whsec_...) is in this reply only. Every delivery is signed with it in the CallView-Signature header (see the Webhooks guide). At most 10 endpoints per organization. Needs webhooks:write, plus the read permission of every event's data: leads:read for lead.created, lead.queued, lead.opted_out, lead.late and callback.booked; calls:read for call.*, lead.interested, handover.accepted and voicemail.left (403 permission_denied names the one missing). ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `url` | string | yes | At most 2048 characters. | | `events` | array of string | yes | At most 50 items. | | `campaign_ids` | array of string (uuid) or null | | Only these campaigns. null or left out = every campaign (needs a key for every campaign). | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postWebhookEndpoints-0001' \ -H 'Content-Type: application/json' \ -d '{ "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ] }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/webhook_endpoints', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ] }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/webhook_endpoints", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested", ], }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ] } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **201** Created. Keep the secret; it is not shown again. ```json { "data": { "id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "object": "webhook_endpoint", "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ], "campaign_ids": null, "mode": "live", "livemode": true, "status": "active", "failing_since": null, "paused_at": null, "last_success_at": "2026-10-06T17:05:21.000Z", "previous_secret_expires_at": null, "created": "2026-10-01T09:00:00.000Z", "updated": "2026-10-01T09:00:00.000Z", "secret": "whsec_DO_NOT_USE_this_is_an_example_value" } } ``` ## 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), [`limit_reached`](https://developers.callview.ai/reference/errors/#limit_reached) | | 404 | [`not_found`](https://developers.callview.ai/reference/errors/#not_found) | | 409 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # List webhook endpoints Source: https://developers.callview.ai/reference/webhook-endpoints/list-webhook-endpoints/ > List webhook endpoints: GET /webhook_endpoints. **GET** `/webhook_endpoints` The endpoints for the key's mode (test or live) within its campaigns. Needs webhooks:read. ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints' \ -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/webhook_endpoints', { 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/webhook_endpoints", 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 '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** Your endpoints ```json { "data": [ { "id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "object": "webhook_endpoint", "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ], "campaign_ids": null, "mode": "live", "livemode": true, "status": "active", "failing_since": null, "paused_at": null, "last_success_at": "2026-10-06T17:05:21.000Z", "previous_secret_expires_at": null, "created": "2026-10-01T09:00:00.000Z", "updated": "2026-10-01T09:00:00.000Z" } ], "meta": { "next_cursor": null, "has_more": false } } ``` ## 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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Get a webhook endpoint Source: https://developers.callview.ai/reference/webhook-endpoints/get-a-webhook-endpoint/ > Get a webhook endpoint: GET /webhook_endpoints/{id}. **GET** `/webhook_endpoints/{id}` Needs webhooks:read. Another organization's endpoint, or one of the other mode, is 404. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b' \ -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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b', { 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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", 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 '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** The endpoint (never its secret) ```json { "data": { "id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "object": "webhook_endpoint", "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ], "campaign_ids": null, "mode": "live", "livemode": true, "status": "active", "failing_since": null, "paused_at": null, "last_success_at": "2026-10-06T17:05:21.000Z", "previous_secret_expires_at": null, "created": "2026-10-01T09:00:00.000Z", "updated": "2026-10-01T09:00:00.000Z" } } ``` ## 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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Change a webhook endpoint Source: https://developers.callview.ai/reference/webhook-endpoints/change-a-webhook-endpoint/ > Change a webhook endpoint: PATCH /webhook_endpoints/{id}. **PATCH** `/webhook_endpoints/{id}` url, events, campaign_ids (null = every campaign) or status (active or paused). A new address is checked like a new endpoint's. Needs webhooks:write; changing url, events or campaign_ids also needs the read permission of every event the endpoint takes (as at creation). ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `url` | string | | At most 2048 characters. | | `events` | array of string | | At most 50 items. | | `campaign_ids` | array of string (uuid) or null | | | | `status` | string | | One of `active` / `paused`. | ## Example request ### curl ```bash curl -X PATCH 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: patchWebhookEndpointsId-0001' \ -H 'Content-Type: application/json' \ -d '{ "events": [ "call.completed", "lead.interested", "lead.opted_out" ] }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b', { method: 'PATCH', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "events": [ "call.completed", "lead.interested", "lead.opted_out" ] }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "PATCH", "https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "events": [ "call.completed", "lead.interested", "lead.opted_out", ], }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'PATCH', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "events": [ "call.completed", "lead.interested", "lead.opted_out" ] } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** The changed endpoint ```json { "data": { "id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "object": "webhook_endpoint", "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ], "campaign_ids": null, "mode": "live", "livemode": true, "status": "active", "failing_since": null, "paused_at": null, "last_success_at": "2026-10-06T17:05:21.000Z", "previous_secret_expires_at": null, "created": "2026-10-01T09:00:00.000Z", "updated": "2026-10-01T09:00:00.000Z" } } ``` ## 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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Delete a webhook endpoint Source: https://developers.callview.ai/reference/webhook-endpoints/delete-a-webhook-endpoint/ > Delete a webhook endpoint: DELETE /webhook_endpoints/{id}. **DELETE** `/webhook_endpoints/{id}` The endpoint and its delivery history go. Events stay in GET /events. Needs webhooks:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X DELETE 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b' \ -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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b', { method: 'DELETE', 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( "DELETE", "https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", 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 'DELETE', 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** Deleted ```json { "data": { "id": "string", "object": "string", "deleted": true, "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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Send a test event Source: https://developers.callview.ai/reference/webhook-endpoints/send-a-test-event/ > Send a test event: POST /webhook_endpoints/{id}/test. **POST** `/webhook_endpoints/{id}/test` Sends one sample of any event type to this endpoint, so you can check your receiver. It is the event's example in a real envelope with a new evt_ id, livemode false and "sample": true, signed with this endpoint's secret just like a real delivery, and retried like one. It shows in the endpoint's deliveries. It is not an event, so GET /events doesn't list it. A paused endpoint has to be resumed first. Needs webhooks:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `type` | string | yes | An event type, for example call.completed. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/test' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postWebhookEndpointsIdTest-0001' \ -H 'Content-Type: application/json' \ -d '{ "type": "call.completed" }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/test', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "type": "call.completed" }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/test", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "type": "call.completed", }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "type": "call.completed" } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **202** Queued. It goes out within a second or two. ```json { "data": { "id": "5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a", "object": "webhook_delivery", "endpoint_id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "event_id": "evt_callcompletedxxxxxxxxxxx", "event_type": "call.completed", "status": "sent", "attempts": 1, "next_attempt_at": null, "last_attempt_at": "2026-10-06T17:05:21.000Z", "response_status": 200, "response_body": "ok", "duration_ms": 182, "resent_from": null, "created": "2026-10-06T17:05:20.000Z", "livemode": true, "event": { "id": "string", "type": "lead.created", "created": "2026-10-06T17:05:20Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": {} }, "sample": 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 | [`endpoint_paused`](https://developers.callview.ai/reference/errors/#endpoint_paused), [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # An endpoint's deliveries Source: https://developers.callview.ai/reference/webhook-endpoints/an-endpoints-deliveries/ > An endpoint's deliveries: GET /webhook_endpoints/{id}/deliveries. **GET** `/webhook_endpoints/{id}/deliveries` Each delivery is one event sent (or waiting to be sent) to this endpoint: its status, how many tries (7 at most, over 24 hours), your last answer (the first 4 KB) and the times. Newest first, page by page (starting_after = the next_cursor you were given). Needs webhooks:read. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `limit` | query | integer | | Default `25`. 1 to 100. | | `starting_after` | query | string (uuid) | | | | `status` | query | string | | One of `pending` / `sent` / `failed` / `gave_up` / `skipped_paused`. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries' \ -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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries', { 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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries", 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 '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** A page of deliveries ```json { "data": [ { "id": "5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a", "object": "webhook_delivery", "endpoint_id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "event_id": "evt_callcompletedxxxxxxxxxxx", "event_type": "call.completed", "status": "sent", "attempts": 1, "next_attempt_at": null, "last_attempt_at": "2026-10-06T17:05:21.000Z", "response_status": 200, "response_body": "ok", "duration_ms": 182, "resent_from": null, "created": "2026-10-06T17:05:20.000Z", "livemode": true } ], "meta": { "next_cursor": null, "has_more": false } } ``` ## 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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Send a delivery again Source: https://developers.callview.ai/reference/webhook-endpoints/send-a-delivery-again/ > Send a delivery again: POST /webhook_endpoints/{id}/deliveries/{delivery_id}/resend. **POST** `/webhook_endpoints/{id}/deliveries/{delivery_id}/resend` A new delivery with the same event id (so your side can skip it if it already has it) and a fresh signature. A paused endpoint has to be resumed first. Needs webhooks:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `delivery_id` | path | string | yes | | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries/5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a/resend' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postWebhookEndpointsIdDeliveriesDeliveryIdResend-0001' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries/5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a/resend', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Idempotency-Key': randomUUID() }, }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries/5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a/resend", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **202** Queued. It goes out within a second or two. ```json { "data": { "id": "5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a", "object": "webhook_delivery", "endpoint_id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "event_id": "evt_callcompletedxxxxxxxxxxx", "event_type": "call.completed", "status": "sent", "attempts": 1, "next_attempt_at": null, "last_attempt_at": "2026-10-06T17:05:21.000Z", "response_status": 200, "response_body": "ok", "duration_ms": 182, "resent_from": null, "created": "2026-10-06T17:05:20.000Z", "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 | [`endpoint_paused`](https://developers.callview.ai/reference/errors/#endpoint_paused), [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Roll the signing secret Source: https://developers.callview.ai/reference/webhook-endpoints/roll-the-signing-secret/ > Roll the signing secret: POST /webhook_endpoints/{id}/roll_secret. **POST** `/webhook_endpoints/{id}/roll_secret` A new secret, shown once. The old one keeps signing too (two v1 values in the header) for grace_hours, so you can switch over without missing anything. Needs webhooks:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `grace_hours` | integer | | Default `24`. 0 to 168. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/roll_secret' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postWebhookEndpointsIdRollSecret-0001' \ -H 'Content-Type: application/json' \ -d '{ "grace_hours": 24 }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/roll_secret', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "grace_hours": 24 }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/roll_secret", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "grace_hours": 24, }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "grace_hours": 24 } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** The endpoint and its new secret ```json { "data": { "id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "object": "webhook_endpoint", "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ], "campaign_ids": null, "mode": "live", "livemode": true, "status": "active", "failing_since": null, "paused_at": null, "last_success_at": "2026-10-06T17:05:21.000Z", "previous_secret_expires_at": null, "created": "2026-10-01T09:00:00.000Z", "updated": "2026-10-01T09:00:00.000Z", "secret": "whsec_DO_NOT_USE_this_is_an_example_value" } } ``` ## 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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Resume a paused endpoint Source: https://developers.callview.ai/reference/webhook-endpoints/resume-a-paused-endpoint/ > Resume a paused endpoint: POST /webhook_endpoints/{id}/resume. **POST** `/webhook_endpoints/{id}/resume` With resend_skipped true, the deliveries skipped while it was paused (up to 1,000, newest first) are sent again with their original event ids. Needs webhooks:write. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `resend_skipped` | boolean | | Default `false`. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/resume' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postWebhookEndpointsIdResume-0001' \ -H 'Content-Type: application/json' \ -d '{ "resend_skipped": true }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/resume', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "resend_skipped": true }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/webhook_endpoints/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/resume", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "resend_skipped": True, }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "resend_skipped": true } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** The endpoint, and how many deliveries were queued again ```json { "data": { "id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "object": "webhook_endpoint", "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ], "campaign_ids": null, "mode": "live", "livemode": true, "status": "active", "failing_since": null, "paused_at": null, "last_success_at": "2026-10-06T17:05:21.000Z", "previous_secret_expires_at": null, "created": "2026-10-01T09:00:00.000Z", "updated": "2026-10-01T09:00:00.000Z", "resent": 1 } } ``` ## 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 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # List webhooks (old) Source: https://developers.callview.ai/reference/webhook-endpoints/list-webhooks-old/ > List webhooks (old): GET /webhooks. **GET** `/webhooks` **Old: still works, use the newer one** Replaced by GET /webhook_endpoints. Still answers its old shape, with a Deprecation header. ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/webhooks' \ -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/webhooks', { 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/webhooks", 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 '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** The old list ```json {} ``` ## 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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Create a webhook (old) Source: https://developers.callview.ai/reference/webhook-endpoints/create-a-webhook-old/ > Create a webhook (old): POST /webhooks. **POST** `/webhooks` **Old: still works, use the newer one** Replaced by POST /webhook_endpoints. Still answers its old shape, with a Deprecation header. The secret is in this reply only. Needs the read permission of every event's data, as POST /webhook_endpoints does. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `url` | string | yes | | | `events` | array of string | yes | | | `campaignId` | string (uuid) or null | | | | `enabled` | boolean | | Default `true`. | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhooks' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postWebhooks-0001' \ -H 'Content-Type: application/json' \ -d '{ "url": "https://crm.example.com/callview", "events": [ "string" ], "campaignId": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "enabled": true }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/webhooks', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "url": "https://crm.example.com/callview", "events": [ "string" ], "campaignId": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "enabled": true }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/webhooks", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "url": "https://crm.example.com/callview", "events": [ "string", ], "campaignId": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "enabled": True, }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "url": "https://crm.example.com/callview", "events": [ "string" ], "campaignId": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "enabled": true } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **201** Created ```json {} ``` ## 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), [`limit_reached`](https://developers.callview.ai/reference/errors/#limit_reached) | | 409 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Delete a webhook (old) Source: https://developers.callview.ai/reference/webhook-endpoints/delete-a-webhook-old/ > Delete a webhook (old): DELETE /webhooks/{id}. **DELETE** `/webhooks/{id}` **Old: still works, use the newer one** Replaced by DELETE /webhook_endpoints/{id}. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | ## Example request ### curl ```bash curl -X DELETE 'https://v2-api.callview.ai/api/v1/external/webhooks/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b' \ -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/webhooks/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b', { method: 'DELETE', 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( "DELETE", "https://v2-api.callview.ai/api/v1/external/webhooks/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", 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 'DELETE', 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** Deleted ```json {} ``` ## 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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # A webhook's deliveries (old) Source: https://developers.callview.ai/reference/webhook-endpoints/a-webhooks-deliveries-old/ > A webhook's deliveries (old): GET /webhooks/{id}/deliveries. **GET** `/webhooks/{id}/deliveries` **Old: still works, use the newer one** Replaced by GET /webhook_endpoints/{id}/deliveries. A delivery's payload is left out unless the key can read that event's data (leads:read or calls:read, or events:read). ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string (uuid) | yes | | | `limit` | query | integer | | Default `25`. 1 to 100. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/webhooks/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries' \ -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/webhooks/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries', { 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/webhooks/3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b/deliveries", 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 '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** The deliveries ```json {} ``` ## 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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # The event catalog (old) Source: https://developers.callview.ai/reference/webhook-endpoints/the-event-catalog-old/ > The event catalog (old): GET /webhooks/events. **GET** `/webhooks/events` **Old: still works, use the newer one** Every event type with a description and an example. The guide's event reference has the same list. ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/webhooks/events' \ -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/webhooks/events', { 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/webhooks/events", 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 '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** The catalog ```json {} ``` ## 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) | | 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 [Webhook endpoints](https://developers.callview.ai/reference/webhook-endpoints/). 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/)). --- # Events (GET /events) Source: https://developers.callview.ai/reference/events-api/ > Every event we sent, or would have sent, for the last 30 days. Every event we sent, or would have sent, for the last 30 days. | Endpoint | What it does | | --- | --- | | [`GET /events`](https://developers.callview.ai/reference/events-api/list-events/) | List events | | [`GET /events/{id}`](https://developers.callview.ai/reference/events-api/get-one-event/) | Get one event | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # List events Source: https://developers.callview.ai/reference/events-api/list-events/ > List events: GET /events. **GET** `/events` Every event we sent or would have sent, newest first, kept 30 days. Keyset-paged: pass the last event's id as `starting_after` for the next page. A test key sees only test events (`livemode: false`), a live key only live ones. Needs the `events:read` permission; a key limited to some campaigns sees only their events. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `limit` | query | integer | | Default `50`. 1 to 100. | | `starting_after` | query | string | | The id of the last event on the previous page. | | `type` | query | string | | One event type, a comma-separated list, or the parameter repeated. | | `created[gte]` | query | string | | Created at or after (ISO 8601 or unix seconds). | | `created[lte]` | query | string | | Created at or before (ISO 8601 or unix seconds). | | `campaign_id` | query | string (uuid) | | | | `object_id` | query | string | | Only events about this call or lead. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/events' \ -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/events', { 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/events", 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 '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** A page of events, newest first ```json { "data": [ { "id": "string", "type": "lead.created", "created": "2026-10-06T17:05:20Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": {} }, "sample": true } ], "meta": { "next_cursor": null, "has_more": false } } ``` ## 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) | | 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 [Events (GET /events)](https://developers.callview.ai/reference/events-api/). 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/)). --- # Get one event Source: https://developers.callview.ai/reference/events-api/get-one-event/ > Get one event: GET /events/{id}. **GET** `/events/{id}` The same envelope a webhook carries. Needs `events:read`. Another organization's event, or one of the other mode (test/live), is 404. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `id` | path | string | yes | | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/events/evt_callcompletedxxxxxxxxxxx' \ -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/events/evt_callcompletedxxxxxxxxxxx', { 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/events/evt_callcompletedxxxxxxxxxxx", 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 '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** The event, in the same envelope a webhook carries ```json { "data": { "id": "string", "type": "lead.created", "created": "2026-10-06T17:05:20Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": {} }, "sample": 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) | | 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 [Events (GET /events)](https://developers.callview.ai/reference/events-api/). 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/)). --- # Usage Source: https://developers.callview.ai/reference/usage/ > Requests, leads, calls, minutes and cost for a month. Requests, leads, calls, minutes and cost for a month. | Endpoint | What it does | | --- | --- | | [`GET /usage`](https://developers.callview.ai/reference/usage/usage-for-a-month/) | Usage for a month | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # Usage for a month Source: https://developers.callview.ai/reference/usage/usage-for-a-month/ > Usage for a month: GET /usage. **GET** `/usage` API requests, leads added, calls, billable minutes and their cost for the month so far (or a past month), in your organization's time zone. Minutes are the bill's own rule (rounded up per call) and `cost_usd` is those minutes at your rate, so the month's total matches your bill. Updated every 5 minutes (`updated`). A test key sees its test counts (`livemode: false`, never billed). A key limited to some campaigns sees only their leads, calls and minutes, plus its own requests. Needs the `usage:read` permission. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `period` | query | string | | `current` (the month so far) or a month, YYYY-MM. Default `"current"`. | | `group_by` | query | string | | Split the totals by API key, campaign or day. One of `key` / `campaign` / `day`. | ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/usage' \ -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/usage', { 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/usage", 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 '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** The month's totals, and with group_by one group per key, campaign or day carrying the same counts plus its key_id / key_name, campaign_id / campaign_name, or day. ```json { "data": { "object": "usage", "period": "2026-10", "timezone": "America/New_York", "livemode": true, "totals": { "requests": 1840, "leads_added": 212, "calls": 260, "calls_connected": 141, "minutes": 388, "cost_usd": 58.2 }, "group_by": null, "groups": [], "updated": "2026-10-06T17:05:00.000Z" } } ``` ## 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) | | 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 [Usage](https://developers.callview.ai/reference/usage/). 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/)). --- # Exports Source: https://developers.callview.ai/reference/exports/ > Download your leads and calls as a file. Download your leads and calls as a file. | Endpoint | What it does | | --- | --- | | [`GET /exports`](https://developers.callview.ai/reference/exports/list-your-exports/) | List your exports | | [`POST /exports`](https://developers.callview.ai/reference/exports/make-an-export-file/) | Make an export file | 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/)). The base address is `https://v2-api.callview.ai/api/v1/external`. --- # List your exports Source: https://developers.callview.ai/reference/exports/list-your-exports/ > List your exports: GET /exports. **GET** `/exports` Needs leads:read and calls:read, on a key for every campaign. A test key has none. ## Example request ### curl ```bash curl -X GET 'https://v2-api.callview.ai/api/v1/external/exports' \ -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/exports', { 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/exports", 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 '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** Your exports ```json { "data": [ { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "exportType": "leads", "status": "string", "rowCount": 1, "createdAt": "2026-10-06T17:05:20Z", "expiresAt": "2026-10-06T17:05:20Z", "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) | | 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 [Exports](https://developers.callview.ai/reference/exports/). 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/)). --- # Make an export file Source: https://developers.callview.ai/reference/exports/make-an-export-file/ > Make an export file: POST /exports. **POST** `/exports` Leads, call history or analytics as a file, with a download link. Needs leads:read and calls:read, on a key for every campaign. A test key gets a sample file. ## Parameters | Name | In | Type | Required | Notes | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | | Any string you choose (1 to 255 visible characters), new for each new action. Send the same key again within 24 hours and you get the first answer back instead of a second lead or call. At most 255 characters. | ## Body | Field | Type | Required | Notes | | --- | --- | --- | --- | | `exportType` | string | yes | One of `leads` / `call_history` / `analytics`. | | `filters` | object | | | | `filters.campaignId` | string (uuid) | | | | `filters.startDate` | string | | YYYY-MM-DD | | `filters.endDate` | string | | YYYY-MM-DD | ## Example request ### curl ```bash curl -X POST 'https://v2-api.callview.ai/api/v1/external/exports' \ -u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \ -H 'Idempotency-Key: postExports-0001' \ -H 'Content-Type: application/json' \ -d '{ "exportType": "call_history", "filters": { "startDate": "2026-10-01", "endDate": "2026-10-06" } }' ``` ### Node ```js import { randomUUID } from 'node:crypto'; 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/exports', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() }, body: JSON.stringify({ "exportType": "call_history", "filters": { "startDate": "2026-10-01", "endDate": "2026-10-06" } }), }); console.log(res.status, res.headers.get('request-id')); console.log(await res.text()); ``` ### Python ```python import os, uuid import requests res = requests.request( "POST", "https://v2-api.callview.ai/api/v1/external/exports", auth=(os.environ["CALLVIEW_KEY_ID"], os.environ["CALLVIEW_SECRET"]), headers={"Idempotency-Key": str(uuid.uuid4())}, json={ "exportType": "call_history", "filters": { "startDate": "2026-10-01", "endDate": "2026-10-06", }, }, timeout=30, ) print(res.status_code, res.headers.get("Request-Id")) print(res.text) ``` ### PHP ```php 'POST', CURLOPT_USERPWD => getenv('CALLVIEW_KEY_ID') . ':' . getenv('CALLVIEW_SECRET'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16))], CURLOPT_POSTFIELDS => <<<'JSON' { "exportType": "call_history", "filters": { "startDate": "2026-10-01", "endDate": "2026-10-06" } } JSON, CURLOPT_HEADER => false, ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), "\n", $body, "\n"; ``` ## Response **200** The export and its download link ```json { "data": { "export": { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "exportType": "leads", "status": "string", "rowCount": 1, "createdAt": "2026-10-06T17:05:20Z", "expiresAt": "2026-10-06T17:05:20Z", "livemode": true }, "downloadUrl": "https://example.com", "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) | | 409 | [`idempotency_mismatch`](https://developers.callview.ai/reference/errors/#idempotency_mismatch), [`idempotency_in_progress`](https://developers.callview.ai/reference/errors/#idempotency_in_progress) | | 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) | | 503 | [`service_unavailable`](https://developers.callview.ai/reference/errors/#service_unavailable) | Part of [Exports](https://developers.callview.ai/reference/exports/). 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/)). --- # Objects Source: https://developers.callview.ai/reference/objects/ > The shapes the API answers with: lead, call, event, webhook endpoint, usage and the error. ## The lead object What every lead endpoint answers with, and what lead events carry. | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string (uuid) | yes | | | `external_id` | string or null | yes | Your own ID for the lead. | | `campaign_id` | string (uuid) | yes | | | `name` | string or null | yes | | | `phone` | string | yes | +1 and 10 digits. | | `email` | string or null | yes | | | `address` | string or null | yes | | | `fields` | object | yes | Your custom fields. | | `consent` | Consent or null | yes | | | `consent.source` | string | yes | Where the lead agreed, for example web_form, crm or purchased_list. At most 100 characters. | | `consent.agreed_at` | string (date-time) | yes | When the lead agreed. | | `consent.text` | string | | The words the lead agreed to. Send text or url. At most 5000 characters. | | `consent.url` | string (uri) | | The page the lead agreed on. Send text or url. | | `consent.ip` | string | | The lead's IP address when agreeing, if you have it. | | `lead_source` | string or null | yes | | | `owner` | object or null | yes | The SDR the latest call was dialed for, or null. | | `owner.id` | string | yes | | | `owner.name` | string | yes | | | `created` | string (date-time) | yes | | | `updated` | string (date-time) | yes | | | `status` | string | yes | Where the lead is now. See the Speed to lead guide for each word. One of `new` / `queued` / `scheduled` / `held` / `dialing` / `on_call` / `callback_scheduled` / `done` / `out_of_queue`. | | `call_now` | boolean | yes | | | `place_in_line` | integer or null | yes | 1 = next, 0 = being dialed now. Only on a single-lead read. | | `estimated_wait_seconds` | integer or null | yes | A guess, in seconds. | | `scheduled_for` | string (date-time) or null | yes | status scheduled: when the lead can be called. | | `scheduled_reason` | string or null | yes | One of `outside_calling_hours` / `recent_contact_cooldown` / `retry_after_outcome` / `next_dial_time`. | | `held_reason` | string or null | yes | status held: why. campaign_paused, campaign_not_started, spend_cap_reached (the organization's API spend cap) or key_limit_reached (the key's own calls per day or daily spend cap). One of `campaign_paused` / `campaign_not_started` / `spend_cap_reached` / `key_limit_reached`. | | `callback_at` | string (date-time) or null | yes | status callback_scheduled: the booked time (UTC). | | `late` | boolean | yes | A call_now lead that waited past the late limit (15 minutes by default). | | `attempts` | integer | yes | | | `last_outcome` | string or null | yes | A stable outcome word (see the Outcomes guide). null while there is no outcome yet. One of `interested` / `not_interested` / `callback` / `voicemail` / `no_answer` / `busy` / `failed` / `dnc` / `wrong_number` / `hung_up` / `screened` / `language_barrier` / `not_qualified` / `undetermined` / `other`. | | `last_outcome_label` | string or null | yes | | | `next_dial_at` | string (date-time) or null | yes | | | `calls` | array of LeadCallSummary | yes | The last 10 calls, newest first. | | `livemode` | boolean | | On every API reply. A lead inside a live event leaves it out. | ```json { "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 } ``` ## The call object What every call endpoint answers with, and what call events carry. | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string (uuid) | | | | `object` | string | | One of `call`. | | `livemode` | boolean | | | | `lead` | object or null | | | | `lead.id` | string (uuid) | | | | `lead.external_id` | string or null | | | | `lead.name` | string or null | | | | `lead.phone` | string or null | | E.164 (+1...) | | `campaign_id` | string (uuid) or null | | | | `direction` | string | | One of `outbound` / `inbound`. | | `status` | string | | One of `ringing` / `in_progress` / `ended`. | | `outcome` | string or null | | A stable word. null while the call has no outcome yet; other only for a label we don't know (see outcome_label). One of `interested` / `not_interested` / `callback` / `voicemail` / `no_answer` / `busy` / `failed` / `dnc` / `wrong_number` / `hung_up` / `screened` / `language_barrier` / `not_qualified` / `undetermined` / `other`. | | `outcome_label` | string or null | | Your organization's name for the outcome, e.g. Hung Up | | `note` | string or null | | The AI's after-call note, or what a person wrote | | `duration_seconds` | integer or null | | | | `started` | string (date-time) | | | | `answered` | string (date-time) or null | | | | `ended` | string (date-time) or null | | | | `updated` | string (date-time) | | | | `handled_by` | object | | | | `handled_by.id` | string or null | | The user's ID; null for the AI and for a closer | | `handled_by.name` | string | | | | `handled_by.role` | string | | One of `sdr` / `closer` / `ai`. | | `owner` | object or null | | | | `owner.id` | string | | | | `owner.name` | string | | | | `tth_seconds` | number or null | | Seconds from buying intent to a person on the call | | `callback_at` | string (date-time) or null | | | | `recording_available` | boolean | | | | `transcript_available` | boolean | | | | `started_by` | object | | | | `started_by.type` | string | | One of `dialer` / `api` / `person`. | | `started_by.api_key_id` | string or null | | | ```json { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "object": "call", "livemode": true, "lead": { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "name": "LEAD_NAME", "phone": "+15555550142" }, "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "direction": "outbound", "status": "ended", "outcome": "interested", "outcome_label": "Interested", "note": "Wants a quote for a 6 kW system; home owner, roof replaced 2019.", "duration_seconds": 412, "started": "2026-10-06T16:58:06.000Z", "answered": "2026-10-06T16:58:14.000Z", "ended": "2026-10-06T17:04:58.000Z", "updated": "2026-10-06T17:05:20.000Z", "handled_by": { "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "name": "SDR_NAME", "role": "sdr" }, "owner": null, "tth_seconds": 9.3, "callback_at": null, "recording_available": true, "transcript_available": true, "started_by": { "type": "api", "api_key_id": "key_example" } } ``` ## What POST /leads answers The reply to POST /leads (and each ok result in a batch). | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string (uuid) or null | yes | Our ID for the lead. null on a dry run. | | `external_id` | string or null | yes | | | `status` | string | yes | One of `dialing` / `queued` / `scheduled` / `held`. | | `call_now` | boolean | yes | | | `place_in_line` | integer or null | yes | 1 = next, 0 = being dialed now. | | `estimated_wait_seconds` | integer or null | yes | | | `scheduled_for` | string (date-time) or null | yes | | | `scheduled_reason` | string or null | yes | One of `outside_calling_hours` / `recent_contact_cooldown`. | | `held_reason` | string or null | yes | status held: why. campaign_paused, campaign_not_started, spend_cap_reached (the organization's API spend cap) or key_limit_reached (the key's own calls per day or daily spend cap). One of `campaign_paused` / `campaign_not_started` / `spend_cap_reached` / `key_limit_reached`. | | `dry_run` | boolean | yes | | | `requeued` | boolean | | Only when the lead already existed and was put back in the queue. Set to `true`. | | `livemode` | boolean | yes | false for a test key: sample data, never real. | ```json { "id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "external_id": "crm-10442", "status": "queued", "call_now": true, "place_in_line": 1, "estimated_wait_seconds": 20, "scheduled_for": null, "scheduled_reason": null, "held_reason": null, "dry_run": false, "livemode": true } ``` ## Consent What the lead agreed to, if you send it. Stored with the lead and returned. | Field | Type | Required | Notes | | --- | --- | --- | --- | | `source` | string | yes | Where the lead agreed, for example web_form, crm or purchased_list. At most 100 characters. | | `agreed_at` | string (date-time) | yes | When the lead agreed. | | `text` | string | | The words the lead agreed to. Send text or url. At most 5000 characters. | | `url` | string (uri) | | The page the lead agreed on. Send text or url. | | `ip` | string | | The lead's IP address when agreeing, if you have it. | ```json { "source": "string", "agreed_at": "2026-10-06T17:05:20Z", "text": "string", "url": "https://example.com", "ip": "string" } ``` ## The event envelope Every event, from GET /events or a webhook. | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | Unique. If you have seen this id before, skip it. | | `type` | string | yes | One of `lead.created` / `lead.queued` / `lead.interested` / `lead.opted_out` / `lead.late` / `call.started` / `call.answered` / `call.completed` / `handover.accepted` / `voicemail.left` / `callback.booked`. | | `created` | string (date-time) | yes | | | `livemode` | boolean | yes | false for a test key: sample data, never real. | | `api_version` | string | yes | | | `data` | object | yes | | | `data.object` | object | yes | The lead or the call, as GET /leads/{id} or GET /calls/{id} returns it, plus the event's own fields. | | `sample` | boolean | | Only on a "Send test event" sample. Set to `true`. | ```json { "id": "string", "type": "lead.created", "created": "2026-10-06T17:05:20Z", "livemode": true, "api_version": "2026-10-01", "data": { "object": {} }, "sample": true } ``` ## The webhook endpoint object Where events go. | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string (uuid) | yes | | | `object` | string | yes | Set to `"webhook_endpoint"`. | | `url` | string (uri) | yes | | | `events` | array of string | yes | | | `campaign_ids` | array of string (uuid) or null | yes | null = every campaign. | | `mode` | string | yes | One of `live` / `test`. | | `livemode` | boolean | yes | false for a test key: sample data, never real. | | `status` | string | yes | paused: by you, or by us after 24 hours of failures in a row. One of `active` / `paused`. | | `failing_since` | string (date-time) or null | yes | | | `paused_at` | string (date-time) or null | yes | | | `last_success_at` | string (date-time) or null | yes | | | `previous_secret_expires_at` | string (date-time) or null | yes | During a secret roll: when the old secret stops signing. | | `created` | string (date-time) | yes | | | `updated` | string (date-time) | yes | | ```json { "id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "object": "webhook_endpoint", "url": "https://crm.example.com/callview", "events": [ "call.completed", "lead.interested" ], "campaign_ids": null, "mode": "live", "livemode": true, "status": "active", "failing_since": null, "paused_at": null, "last_success_at": "2026-10-06T17:05:21.000Z", "previous_secret_expires_at": null, "created": "2026-10-01T09:00:00.000Z", "updated": "2026-10-01T09:00:00.000Z" } ``` ## The webhook delivery object One event sent (or waiting) to one endpoint. | Field | Type | Required | Notes | | --- | --- | --- | --- | | `id` | string | yes | | | `object` | string | yes | Set to `"webhook_delivery"`. | | `endpoint_id` | string (uuid) | yes | | | `event_id` | string or null | yes | | | `event_type` | string | yes | | | `status` | string | yes | One of `pending` / `sent` / `failed` / `gave_up` / `skipped_paused`. | | `attempts` | integer | yes | Tries so far (7 at most). | | `next_attempt_at` | string (date-time) or null | yes | | | `last_attempt_at` | string (date-time) or null | yes | | | `response_status` | integer or null | yes | | | `response_body` | string or null | yes | The first 4 KB of your answer. | | `duration_ms` | integer or null | yes | | | `resent_from` | string or null | yes | | | `created` | string (date-time) | yes | | | `livemode` | boolean | yes | false for a test key: sample data, never real. | ```json { "id": "5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a", "object": "webhook_delivery", "endpoint_id": "3f6a9c2e-1b7d-4e5f-8a90-1c2d3e4f5a6b", "event_id": "evt_callcompletedxxxxxxxxxxx", "event_type": "call.completed", "status": "sent", "attempts": 1, "next_attempt_at": null, "last_attempt_at": "2026-10-06T17:05:21.000Z", "response_status": 200, "response_body": "ok", "duration_ms": 182, "resent_from": null, "created": "2026-10-06T17:05:20.000Z", "livemode": true } ``` ## The usage object GET /usage. | Field | Type | Required | Notes | | --- | --- | --- | --- | | `object` | string | yes | Set to `"usage"`. | | `period` | string | yes | | | `timezone` | string | yes | Your organization's time zone. Months follow it. | | `livemode` | boolean | yes | false for a test key: sample data, never real. | | `totals` | UsageCounts | yes | | | `group_by` | string or null | yes | One of `key` / `campaign` / `day`. | | `groups` | array of UsageCounts + object | yes | | | `updated` | string (date-time) or null | yes | When the numbers were last counted (every 5 minutes). | ```json { "object": "usage", "period": "2026-10", "timezone": "America/New_York", "livemode": true, "totals": { "requests": 1840, "leads_added": 212, "calls": 260, "calls_connected": 141, "minutes": 388, "cost_usd": 58.2 }, "group_by": null, "groups": [], "updated": "2026-10-06T17:05:00.000Z" } ``` ## The error Every error, from every endpoint. See [Error codes](https://developers.callview.ai/reference/errors/). | Field | Type | Required | Notes | | --- | --- | --- | --- | | `error` | object | yes | | | `error.type` | string | yes | One of `invalid_request_error` / `authentication_error` / `permission_error` / `rate_limit_error` / `idempotency_error` / `api_error`. | | `error.code` | string | yes | A stable word. Branch on this, never on the message. One of `invalid_request` / `invalid_phone` / `on_dnc_list` / `outside_calling_hours` / `duplicate_lead` / `number_retired` / `consent_required` / `campaign_closed` / `queue_full` / `test_flows_busy` / `phone_cannot_change` / `ambiguous_external_id` / `duplicate_dnc_entry` / `not_found` / `authentication_failed` / `permission_denied` / `rate_limited` / `too_many_concurrent_requests` / `lead_rate_limited` / `idempotency_mismatch` / `idempotency_in_progress` / `limit_reached` / `endpoint_paused` / `service_unavailable` / `internal_error` / `lead_busy` / `lead_taken_out_of_queue` / `call_limit_reached` / `number_not_allowed` / `recording_not_available`. | | `error.message` | string | yes | For people. Phone numbers and emails in it are masked. | | `error.param` | string or null | yes | The field the error is about, when there is one. | | `error.request_id` | string or null | yes | The same as the Request-Id header. Quote it when you contact us. | | `error.reason` | string | | The specific cause when the code is a broader word (for example why authentication failed). | | `error.lead_id` | string (uuid) or null | | duplicate_lead only: the lead that already exists. | | `error.missing_permission` | string | | permission_denied only: the permission the key is missing, for example "calls:read" or "dialing:write". One of `leads:read` / `leads:write` / `calls:read` / `calls:write` / `dialing:write` / `recordings:read` / `campaigns:read` / `campaigns:write` / `callbacks:read` / `callbacks:write` / `dnc:read` / `dnc:write` / `webhooks:read` / `webhooks:write` / `events:read` / `usage:read`. | | `error.campaign_id` | string (uuid) or null | | permission_denied only: the campaign outside the key's scope (null when the endpoint needs a key for every campaign). | | `error.candidates` | array of object | | ambiguous_external_id only: the leads that match, so you can add campaign_id. | ```json { "error": { "type": "invalid_request_error", "code": "invalid_request", "message": "string", "param": "string", "request_id": "string", "reason": "string", "lead_id": "2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10", "missing_permission": "leads:read", "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01", "candidates": [ { "id": "e4d3c2b1-a09f-4e8d-9c7b-6a5f4e3d2c1b", "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01" } ] } } ``` --- # Error codes Source: https://developers.callview.ai/reference/errors/ > Every error code the API can answer with, what it means and what to do. Every error has the same shape. Branch on `code`. It is a fixed word, and we never rename one without at least 6 months' notice. `message` is written for people and can change. ```json { "error": { "type": "invalid_request_error", "code": "invalid_phone", "message": "phone: Phone number has too few digits (minimum 10)", "param": "phone", "request_id": "req_6f1c2a9b0d3e4f5a6b7c8d9e0f1a2b3c" } } ``` See [Errors and retries](https://developers.callview.ai/guides/errors/) for which ones to retry. ### invalid_request HTTP 400, type `invalid_request_error`. The request is malformed: a missing or unknown field, a bad value, a body over 1 MB, a batch over 60 leads, or over 100 numbers for Do Not Call. Any endpoint can send it. ### invalid_phone HTTP 400, type `invalid_request_error`. The phone number is not a valid number. Sent by: `POST /campaigns/{campaignId}/leads`, `POST /dnc`, `GET /dnc/check`, `POST /leads`. ### on_dnc_list HTTP 422, type `invalid_request_error`. The number is on the organization's Do Not Call list. Sent by: `POST /calls`, `POST /campaigns/{campaignId}/leads`, `POST /leads`. ### outside_calling_hours HTTP 422, type `invalid_request_error`. It is outside the lead's calling hours. Not sent today: a lead outside its calling hours is scheduled for the next window instead of refused. ### duplicate_lead HTTP 409, type `invalid_request_error`. A lead with this phone number (or external_id) already exists in this campaign. `lead_id` names it. Sent by: `POST /campaigns/{campaignId}/leads`, `POST /leads`, `PATCH /leads/{id}`. ### number_retired HTTP 422, type `invalid_request_error`. The number was retired in this campaign after repeated failed calls. Sent by: `POST /calls`, `POST /campaigns/{campaignId}/leads`, `POST /leads`. ### consent_required HTTP 422, type `invalid_request_error`. This campaign requires consent on every lead. Sent by: `POST /campaigns/{campaignId}/leads`, `POST /leads`. ### campaign_closed HTTP 409, type `invalid_request_error`. The campaign is completed and takes no new leads. Sent by: `POST /calls`, `POST /campaigns/{campaignId}/leads`, `POST /leads`. ### queue_full HTTP 429, type `rate_limit_error`. The campaign already has 5,000 API leads waiting to be called. Retry after Retry-After seconds. Sent by: `POST /campaigns/{campaignId}/leads`, `POST /leads`. ### test_flows_busy HTTP 429, type `rate_limit_error`. Test mode only: this test key already has 20 sample calls running. Retry after Retry-After seconds. Sent by: `POST /calls`, `POST /campaigns/{campaignId}/leads`, `POST /leads`. ### phone_cannot_change HTTP 422, type `invalid_request_error`. A lead's phone number can't be changed (Story 34-7). Add a new lead with the new number. Sent by: `PATCH /leads/{id}`. ### ambiguous_external_id HTTP 409, type `invalid_request_error`. This external_id matches leads in more than one campaign. `candidates` lists them; add campaign_id (Story 34-7). Sent by: `GET /leads`. ### duplicate_dnc_entry HTTP 409, type `invalid_request_error`. This number is already on the Do Not Call list. Sent by: `POST /dnc`. ### not_found HTTP 404, type `invalid_request_error`. No such object or endpoint (or it belongs to someone else). Any endpoint can send it. ### authentication_failed HTTP 401, type `authentication_error`. The key ID or secret is missing, wrong, revoked, expired or disabled. Any endpoint can send it. ### permission_denied HTTP 403, type `permission_error`. The key is not allowed to do this. Any endpoint can send it. ### rate_limited HTTP 429, type `rate_limit_error`. Too many requests a minute for this key or the organization's plan. Retry after Retry-After seconds. Any endpoint can send it. ### too_many_concurrent_requests HTTP 429, type `rate_limit_error`. Too many requests at the same time on this key. Retry after Retry-After seconds. Any endpoint can send it. ### lead_rate_limited HTTP 429, type `rate_limit_error`. Too many new leads a minute on this key. Retry after Retry-After seconds. Sent by: `POST /campaigns/{campaignId}/leads`, `POST /campaigns/{campaignId}/leads/batch`, `POST /leads`, `POST /leads/batch`. ### idempotency_mismatch HTTP 409, type `idempotency_error`. This Idempotency-Key was already used with a different request. Any endpoint can send it. ### idempotency_in_progress HTTP 409, type `idempotency_error`. A request with this Idempotency-Key is still running. Retry after Retry-After seconds. Any endpoint can send it. ### limit_reached HTTP 403, type `invalid_request_error`. A plan limit was reached (for example, webhook endpoints per organization). Sent by: `POST /webhook_endpoints`, `POST /webhooks`. ### endpoint_paused HTTP 409, type `invalid_request_error`. The webhook endpoint is paused. Resume it (POST /webhook_endpoints/{id}/resume), then re-send or send the test event. Sent by: `POST /webhook_endpoints/{id}/deliveries/{delivery_id}/resend`, `POST /webhook_endpoints/{id}/test`. ### service_unavailable HTTP 503, type `api_error`. A service we depend on is unavailable. Retry later. Any endpoint can send it. ### internal_error HTTP 500, type `api_error`. Something went wrong on our side. Any endpoint can send it. ### lead_busy HTTP 409, type `invalid_request_error`. The lead is being dialed or is on a call now. Sent by: `POST /calls`. ### lead_taken_out_of_queue HTTP 409, type `invalid_request_error`. A person took the lead out of the dialing queue in CallView; the API does not overrule a person. Sent by: `POST /calls`. ### call_limit_reached HTTP 429, type `rate_limit_error`. The lead has had 3 calls started by the API in the last 24 hours. Retry after Retry-After seconds. Sent by: `POST /calls`, `POST /leads`. ### number_not_allowed HTTP 422, type `invalid_request_error`. A premium-rate or international number (including +1 Caribbean numbers) is not dialed for this organization. `reason` says which: premium or international. Sent by: `POST /calls`, `POST /campaigns/{campaignId}/leads`, `POST /leads`. ### recording_not_available HTTP 404, type `invalid_request_error`. The call has no recording: recording is off for the organization, or it is past retention. Sent by: `GET /calls/{id}/recording`.