Skip to content

API reference

Opt a lead out - stop calling, add to Do Not Call

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.

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
reason string Why (kept in the audit log and on closed callbacks) At most 500 characters.
Terminal window
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"
}'

200 The lead, plus call_in_progress

{
"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
}
}
Status Codes
400 invalid_request
401 authentication_failed
403 permission_denied
404 not_found
409 idempotency_mismatch, idempotency_in_progress
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).