API reference
Update a lead
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
Section titled “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. |
| 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
Section titled “Example request”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": "" }}'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());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$ch = curl_init('https://v2-api.callview.ai/api/v1/external/leads/2b8e4c1d-9f3a-4b7e-8c21-6a5d4e3f2b10');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => '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
Section titled “Response”200 The updated lead
{ "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
Section titled “Errors”| Status | Codes |
|---|---|
| 400 | invalid_request |
| 401 | authentication_failed |
| 403 | permission_denied |
| 404 | not_found |
| 409 | duplicate_lead, idempotency_mismatch, idempotency_in_progress |
| 422 | phone_cannot_change |
| 429 | rate_limited, too_many_concurrent_requests |
| 500 | internal_error |
| 503 | service_unavailable |
Part of Leads. Every example sends your key ID and secret as CALLVIEW_KEY_ID and CALLVIEW_SECRET (see Keys and authentication).