Exclude contact
curl --request DELETE \
--url https://api.goyappr.com/campaigns/{id}/leads/{lead_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.goyappr.com/campaigns/{id}/leads/{lead_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.goyappr.com/campaigns/{id}/leads/{lead_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/campaigns/{id}/leads/{lead_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/campaigns/{id}/leads/{lead_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.goyappr.com/campaigns/{id}/leads/{lead_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/campaigns/{id}/leads/{lead_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"campaign_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "excluded",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Contacts
Exclude a contact
Retires one contact for this campaign with status excluded. Terminal — the
contact is never dialed by this campaign again, and re-enrolling does not revive
it. The underlying lead is untouched. Required scope campaigns:manage.
DELETE
/
campaigns
/
{id}
/
leads
/
{lead_id}
Exclude contact
curl --request DELETE \
--url https://api.goyappr.com/campaigns/{id}/leads/{lead_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.goyappr.com/campaigns/{id}/leads/{lead_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.goyappr.com/campaigns/{id}/leads/{lead_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/campaigns/{id}/leads/{lead_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/campaigns/{id}/leads/{lead_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.goyappr.com/campaigns/{id}/leads/{lead_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/campaigns/{id}/leads/{lead_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"campaign_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "excluded",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Removes one contact from a campaign. The enrollment moves to
There is no request body.
Excluding a contact that is already excluded returns the same 200 response — the operation is idempotent.
excluded with stop_hit: true and stop_reason: "manual", and this campaign never calls that person again.
Exclusion is terminal for this campaign. There is no un-exclude: re-enrolling the same lead through POST /campaigns/{id}/leads will not resurrect it, because the enrollment still exists in its excluded state. To call that person again, enroll them in a different campaign.
Required scope: campaigns:manage.
Path parameters
| Parameter | Type | Notes |
|---|---|---|
id | uuid | Campaign ID. Must belong to the API key’s workspace. |
lead_id | uuid | The lead ID, not the enrollment ID. This is lead_id from GET /campaigns/{id}/leads, and it is also the ID you get from GET /leads. |
What exclusion does and does not do
- Does stop this campaign calling the contact, from any state —
pending,scheduled, and mid-flight states alike. - Does not cancel a call already in progress. If the contact is
dialing, that call completes and gets categorized normally; the exclusion prevents any further attempt. - Does not delete the lead. The lead and its history remain in
GET /leads. - Does not add the number to the do-not-call list. Excluding is a scheduling decision about one campaign; suppressing a person everywhere is
POST /do-not-call, which blocks them across every campaign and every direct call. - Does not decrement
total_leads.GET /campaigns/{id}/statsreports the contact underexcludedso the campaign’s history stays complete.
POST /do-not-call instead when someone asks not to be contacted. A verbal opt-out during a call is added to that list automatically, workspace-wide, without you having to exclude anyone by hand.
Example request
curl -X DELETE "https://api.goyappr.com/campaigns/CAMPAIGN_ID/leads/LEAD_ID" \
-H "Authorization: Bearer $YAPPR_API_KEY"
Example response
{
"campaign_id": "b3f1c0d2-5a44-4f0e-9c11-7a2e8d3f0001",
"lead_id": "a1c3e5f7-0000-4b21-9c30-000000000021",
"status": "excluded",
"company_id": "fe493f11-0000-0000-0000-000000000001"
}
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | — | The lead ID is missing from the path (DELETE /campaigns/{id}/leads with no trailing ID). |
| 401 | INSUFFICIENT_SCOPE | API key lacks campaigns:manage. |
| 404 | — | No campaign with that ID in this workspace, or it has been archived. |
| 404 | — | That lead is not enrolled in this campaign. |
| 500 | — | The exclusion write failed. The enrollment is unchanged; safe to retry. |
Authorizations
Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys.
Path Parameters
Lead ID (not the CampaignContact.id).