Bulk add to Do-Not-Contact
curl --request PATCH \
--url https://app.tuco.ai/api/dnc \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "whatsapp-opt-out",
"entries": [
{
"phone": "+15550100001"
},
{
"phone": "(555) 010-0002"
},
{
"email": "jane@example.com"
}
]
}
'import requests
url = "https://app.tuco.ai/api/dnc"
payload = {
"reason": "whatsapp-opt-out",
"entries": [{ "phone": "+15550100001" }, { "phone": "(555) 010-0002" }, { "email": "jane@example.com" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
reason: 'whatsapp-opt-out',
entries: [
{phone: '+15550100001'},
{phone: '(555) 010-0002'},
{email: 'jane@example.com'}
]
})
};
fetch('https://app.tuco.ai/api/dnc', 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://app.tuco.ai/api/dnc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'whatsapp-opt-out',
'entries' => [
[
'phone' => '+15550100001'
],
[
'phone' => '(555) 010-0002'
],
[
'email' => 'jane@example.com'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.tuco.ai/api/dnc"
payload := strings.NewReader("{\n \"reason\": \"whatsapp-opt-out\",\n \"entries\": [\n {\n \"phone\": \"+15550100001\"\n },\n {\n \"phone\": \"(555) 010-0002\"\n },\n {\n \"email\": \"jane@example.com\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://app.tuco.ai/api/dnc")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"whatsapp-opt-out\",\n \"entries\": [\n {\n \"phone\": \"+15550100001\"\n },\n {\n \"phone\": \"(555) 010-0002\"\n },\n {\n \"email\": \"jane@example.com\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/dnc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"whatsapp-opt-out\",\n \"entries\": [\n {\n \"phone\": \"+15550100001\"\n },\n {\n \"phone\": \"(555) 010-0002\"\n },\n {\n \"email\": \"jane@example.com\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"added": 2,
"skipped": 1,
"invalid": 0,
"failed": 0
}{
"ok": false,
"added": 1,
"skipped": 0,
"invalid": 0,
"failed": 1
}{
"error": "entries array is required"
}{
"error": "Unauthorized"
}{
"error": "Rate limit exceeded"
}Do Not Contact
Bulk Add to Do-Not-Contact
Add up to 10,000 phone numbers and emails to your workspace’s Do-Not-Contact list in one request. Idempotent. REST endpoint in the Tuco AI iMessage API — bearer-token auth.
PATCH
/
api
/
dnc
Bulk add to Do-Not-Contact
curl --request PATCH \
--url https://app.tuco.ai/api/dnc \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "whatsapp-opt-out",
"entries": [
{
"phone": "+15550100001"
},
{
"phone": "(555) 010-0002"
},
{
"email": "jane@example.com"
}
]
}
'import requests
url = "https://app.tuco.ai/api/dnc"
payload = {
"reason": "whatsapp-opt-out",
"entries": [{ "phone": "+15550100001" }, { "phone": "(555) 010-0002" }, { "email": "jane@example.com" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
reason: 'whatsapp-opt-out',
entries: [
{phone: '+15550100001'},
{phone: '(555) 010-0002'},
{email: 'jane@example.com'}
]
})
};
fetch('https://app.tuco.ai/api/dnc', 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://app.tuco.ai/api/dnc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'whatsapp-opt-out',
'entries' => [
[
'phone' => '+15550100001'
],
[
'phone' => '(555) 010-0002'
],
[
'email' => 'jane@example.com'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.tuco.ai/api/dnc"
payload := strings.NewReader("{\n \"reason\": \"whatsapp-opt-out\",\n \"entries\": [\n {\n \"phone\": \"+15550100001\"\n },\n {\n \"phone\": \"(555) 010-0002\"\n },\n {\n \"email\": \"jane@example.com\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://app.tuco.ai/api/dnc")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"whatsapp-opt-out\",\n \"entries\": [\n {\n \"phone\": \"+15550100001\"\n },\n {\n \"phone\": \"(555) 010-0002\"\n },\n {\n \"email\": \"jane@example.com\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/dnc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"whatsapp-opt-out\",\n \"entries\": [\n {\n \"phone\": \"+15550100001\"\n },\n {\n \"phone\": \"(555) 010-0002\"\n },\n {\n \"email\": \"jane@example.com\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"added": 2,
"skipped": 1,
"invalid": 0,
"failed": 0
}{
"ok": false,
"added": 1,
"skipped": 0,
"invalid": 0,
"failed": 1
}{
"error": "entries array is required"
}{
"error": "Unauthorized"
}{
"error": "Rate limit exceeded"
}Use this to load an existing opt-out list, or to sync opt-outs from your other channels in batches. Contacts already on the list are counted as
skipped, not errors, so it is safe to resend a whole batch after a timeout.Bulk adds do not fire the dnc.added webhook (you already know about these contacts). For one-at-a-time adds that should notify your webhooks, use POST /api/dnc.Authentication
Authorization: Bearer tuco_xxxxxxxxxxxxx
(904) 555-1234 → +19045551234). Emails are stored lower case.
Example
curl -X PATCH "https://app.tuco.ai/api/dnc" \
-H "Authorization: Bearer tuco_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"reason": "whatsapp-opt-out",
"entries": [
{ "phone": "+15550100001" },
{ "phone": "(555) 010-0002" },
{ "email": "jane@example.com" }
]
}'
Success response (200)
{ "ok": true, "added": 2, "skipped": 1, "invalid": 0, "failed": 0 }
source: "api-bulk" in GET /api/dnc.
Errors
| Status | Body | When |
|---|---|---|
207 | { "ok": false, …, "failed": n } | Some entries could not be saved — resend |
400 | { "error": "entries array is required" } | Missing, empty or non-array entries |
400 | { "error": "Maximum 10,000 entries per request" } | More than 10,000 items |
401 | { "error": "Unauthorized" } | Missing or invalid API key |
429 | { "error": "Rate limit exceeded" } | Rate limit exceeded (120/min per workspace) |
Authorizations
Workspace API key: Authorization: Bearer tuco_xxxxxxxxxxxxx
Body
application/json