curl --request POST \
--url https://api.trysela.com/api/leads/dnc-phone-number/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>",
"call_dnc": true,
"sms_dnc": true
}
'import requests
url = "https://api.trysela.com/api/leads/dnc-phone-number/"
payload = {
"phone_number": "<string>",
"call_dnc": True,
"sms_dnc": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone_number: '<string>', call_dnc: true, sms_dnc: true})
};
fetch('https://api.trysela.com/api/leads/dnc-phone-number/', 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.trysela.com/api/leads/dnc-phone-number/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number' => '<string>',
'call_dnc' => true,
'sms_dnc' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trysela.com/api/leads/dnc-phone-number/"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\",\n \"call_dnc\": true,\n \"sms_dnc\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.trysela.com/api/leads/dnc-phone-number/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\",\n \"call_dnc\": true,\n \"sms_dnc\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trysela.com/api/leads/dnc-phone-number/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"<string>\",\n \"call_dnc\": true,\n \"sms_dnc\": true\n}"
response = http.request(request)
puts response.read_body{
"phone_number": "<string>",
"call_dnc": true,
"sms_dnc": true,
"created": true
}{
"phone_number": "<string>",
"call_dnc": true,
"sms_dnc": true,
"created": true
}{
"non_field_errors": [
"<string>"
],
"phone_number": [
"<string>"
],
"email": [
"<string>"
],
"detail": "<string>",
"leads": [
"<string>"
]
}DNC a Phone Number
Marks a phone number as do not contact for the authenticated API user’s account. If neither call_dnc nor sms_dnc is provided, both default to true (DNC both channels). If either flag is provided, the other must also be provided, and at least one of the two must be true. This endpoint only adds DNC: passing false for a channel does not un-DNC an existing record.
curl --request POST \
--url https://api.trysela.com/api/leads/dnc-phone-number/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>",
"call_dnc": true,
"sms_dnc": true
}
'import requests
url = "https://api.trysela.com/api/leads/dnc-phone-number/"
payload = {
"phone_number": "<string>",
"call_dnc": True,
"sms_dnc": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone_number: '<string>', call_dnc: true, sms_dnc: true})
};
fetch('https://api.trysela.com/api/leads/dnc-phone-number/', 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.trysela.com/api/leads/dnc-phone-number/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number' => '<string>',
'call_dnc' => true,
'sms_dnc' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trysela.com/api/leads/dnc-phone-number/"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\",\n \"call_dnc\": true,\n \"sms_dnc\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.trysela.com/api/leads/dnc-phone-number/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\",\n \"call_dnc\": true,\n \"sms_dnc\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trysela.com/api/leads/dnc-phone-number/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"<string>\",\n \"call_dnc\": true,\n \"sms_dnc\": true\n}"
response = http.request(request)
puts response.read_body{
"phone_number": "<string>",
"call_dnc": true,
"sms_dnc": true,
"created": true
}{
"phone_number": "<string>",
"call_dnc": true,
"sms_dnc": true,
"created": true
}{
"non_field_errors": [
"<string>"
],
"phone_number": [
"<string>"
],
"email": [
"<string>"
],
"detail": "<string>",
"leads": [
"<string>"
]
}Authorizations
Token-based authentication with required prefix "Token"
Body
The phone number to mark as do not contact for your account.
1If true, mark the phone number as DNC for outbound calls. Required when sms_dnc is provided. If neither flag is provided, both default to true.
If true, mark the phone number as DNC for outbound SMS. Required when call_dnc is provided. If neither flag is provided, both default to true.