const options = {
method: "POST",
headers: {
"x-api-key": "<your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
optOut: true,
scope: "PHONE",
}),
};
fetch(
"https://api-v2.getomni.ai/api/v1/leads/b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e/opt-out",
options,
)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
import requests
lead_id = "b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e"
url = f"https://api-v2.getomni.ai/api/v1/leads/{lead_id}/opt-out"
headers = {
"x-api-key": "<your-api-key>",
"Content-Type": "application/json",
}
payload = {
"optOut": True,
"scope": "PHONE",
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
curl --request POST \
--url 'https://api-v2.getomni.ai/api/v1/leads/b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e/opt-out' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"optOut": true,
"scope": "PHONE"
}'
{
"success": true
}
{
"error": "scope must be EMAIL or PHONE",
"success": false
}
{
"error": "Lead not found",
"success": false
}
Opt Outs
Opt Out Lead
Opt a lead’s email or phone number out of outreach, or remove that opt-out
POST
/
api
/
v1
/
leads
/
{leadId}
/
opt-out
const options = {
method: "POST",
headers: {
"x-api-key": "<your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
optOut: true,
scope: "PHONE",
}),
};
fetch(
"https://api-v2.getomni.ai/api/v1/leads/b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e/opt-out",
options,
)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
import requests
lead_id = "b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e"
url = f"https://api-v2.getomni.ai/api/v1/leads/{lead_id}/opt-out"
headers = {
"x-api-key": "<your-api-key>",
"Content-Type": "application/json",
}
payload = {
"optOut": True,
"scope": "PHONE",
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
curl --request POST \
--url 'https://api-v2.getomni.ai/api/v1/leads/b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e/opt-out' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"optOut": true,
"scope": "PHONE"
}'
{
"success": true
}
{
"error": "scope must be EMAIL or PHONE",
"success": false
}
{
"error": "Lead not found",
"success": false
}
This endpoint opts a lead’s email or phone number out of outreach. Agents and team members cannot contact the opted-out email or phone number, and any pending messages to it are cancelled. The other address is not affected.
Opt-outs are applied at the workspace level. If multiple leads share the same email or phone number, the opt-out applies to all of them. Removing the opt-out restores outreach to that email or phone number across all associated leads.
When all addresses for a lead are opted out, the lead’s status changes to
OPTED_OUT and didOptOut is true.
To opt a lead out of both email and phone outreach, make two requests: one with scope set to EMAIL and one with scope set to PHONE.
Authentication
Requires thex-api-key header with a valid workspace API key.
Path Parameters
Request Body
EMAIL or PHONE. The address to change. EMAIL covers email. PHONE
covers texts, calls, and WhatsApp.Response
const options = {
method: "POST",
headers: {
"x-api-key": "<your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
optOut: true,
scope: "PHONE",
}),
};
fetch(
"https://api-v2.getomni.ai/api/v1/leads/b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e/opt-out",
options,
)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
import requests
lead_id = "b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e"
url = f"https://api-v2.getomni.ai/api/v1/leads/{lead_id}/opt-out"
headers = {
"x-api-key": "<your-api-key>",
"Content-Type": "application/json",
}
payload = {
"optOut": True,
"scope": "PHONE",
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
curl --request POST \
--url 'https://api-v2.getomni.ai/api/v1/leads/b3f1c2d4-5e6a-7b8c-9d0e-1f2a3b4c5d6e/opt-out' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"optOut": true,
"scope": "PHONE"
}'
{
"success": true
}
{
"error": "scope must be EMAIL or PHONE",
"success": false
}
{
"error": "Lead not found",
"success": false
}
