curl --request POST \
--url https://ugatext.com/api/v1/opt-outs/add \
--header 'Client-ID: <api-key>' \
--header 'Client-Secret: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "+256700000000",
"phoneNumber": "+256700000000",
"phone_number": "+256700000000",
"notes": "Customer requested opt-out",
"reason": "Customer requested opt-out",
"campaignId": "cmp_1760425200000_a1b2c3",
"campaignName": "October Promo",
"sender_id": "UGATEXT",
"senderId": "UGATEXT"
}
'import requests
url = "https://ugatext.com/api/v1/opt-outs/add"
payload = {
"phone": "+256700000000",
"phoneNumber": "+256700000000",
"phone_number": "+256700000000",
"notes": "Customer requested opt-out",
"reason": "Customer requested opt-out",
"campaignId": "cmp_1760425200000_a1b2c3",
"campaignName": "October Promo",
"sender_id": "UGATEXT",
"senderId": "UGATEXT"
}
headers = {
"Client-ID": "<api-key>",
"Client-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Client-ID': '<api-key>',
'Client-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone: '+256700000000',
phoneNumber: '+256700000000',
phone_number: '+256700000000',
notes: 'Customer requested opt-out',
reason: 'Customer requested opt-out',
campaignId: 'cmp_1760425200000_a1b2c3',
campaignName: 'October Promo',
sender_id: 'UGATEXT',
senderId: 'UGATEXT'
})
};
fetch('https://ugatext.com/api/v1/opt-outs/add', 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://ugatext.com/api/v1/opt-outs/add",
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' => '+256700000000',
'phoneNumber' => '+256700000000',
'phone_number' => '+256700000000',
'notes' => 'Customer requested opt-out',
'reason' => 'Customer requested opt-out',
'campaignId' => 'cmp_1760425200000_a1b2c3',
'campaignName' => 'October Promo',
'sender_id' => 'UGATEXT',
'senderId' => 'UGATEXT'
]),
CURLOPT_HTTPHEADER => [
"Client-ID: <api-key>",
"Client-Secret: <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://ugatext.com/api/v1/opt-outs/add"
payload := strings.NewReader("{\n \"phone\": \"+256700000000\",\n \"phoneNumber\": \"+256700000000\",\n \"phone_number\": \"+256700000000\",\n \"notes\": \"Customer requested opt-out\",\n \"reason\": \"Customer requested opt-out\",\n \"campaignId\": \"cmp_1760425200000_a1b2c3\",\n \"campaignName\": \"October Promo\",\n \"sender_id\": \"UGATEXT\",\n \"senderId\": \"UGATEXT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Client-ID", "<api-key>")
req.Header.Add("Client-Secret", "<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://ugatext.com/api/v1/opt-outs/add")
.header("Client-ID", "<api-key>")
.header("Client-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"+256700000000\",\n \"phoneNumber\": \"+256700000000\",\n \"phone_number\": \"+256700000000\",\n \"notes\": \"Customer requested opt-out\",\n \"reason\": \"Customer requested opt-out\",\n \"campaignId\": \"cmp_1760425200000_a1b2c3\",\n \"campaignName\": \"October Promo\",\n \"sender_id\": \"UGATEXT\",\n \"senderId\": \"UGATEXT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ugatext.com/api/v1/opt-outs/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Client-ID"] = '<api-key>'
request["Client-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"+256700000000\",\n \"phoneNumber\": \"+256700000000\",\n \"phone_number\": \"+256700000000\",\n \"notes\": \"Customer requested opt-out\",\n \"reason\": \"Customer requested opt-out\",\n \"campaignId\": \"cmp_1760425200000_a1b2c3\",\n \"campaignName\": \"October Promo\",\n \"sender_id\": \"UGATEXT\",\n \"senderId\": \"UGATEXT\"\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Authentication failed. Provide a valid 'Client-ID' and 'Client-Secret' in the request headers.",
"retry_after_seconds": 60
},
"retry_after_seconds": 60
}{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Authentication failed. Provide a valid 'Client-ID' and 'Client-Secret' in the request headers.",
"retry_after_seconds": 60
},
"retry_after_seconds": 60
}{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Authentication failed. Provide a valid 'Client-ID' and 'Client-Secret' in the request headers.",
"retry_after_seconds": 60
},
"retry_after_seconds": 60
}Add a Phone Number to the Opt-Out Suppression List (Alias for POST /opt-outs)
curl --request POST \
--url https://ugatext.com/api/v1/opt-outs/add \
--header 'Client-ID: <api-key>' \
--header 'Client-Secret: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "+256700000000",
"phoneNumber": "+256700000000",
"phone_number": "+256700000000",
"notes": "Customer requested opt-out",
"reason": "Customer requested opt-out",
"campaignId": "cmp_1760425200000_a1b2c3",
"campaignName": "October Promo",
"sender_id": "UGATEXT",
"senderId": "UGATEXT"
}
'import requests
url = "https://ugatext.com/api/v1/opt-outs/add"
payload = {
"phone": "+256700000000",
"phoneNumber": "+256700000000",
"phone_number": "+256700000000",
"notes": "Customer requested opt-out",
"reason": "Customer requested opt-out",
"campaignId": "cmp_1760425200000_a1b2c3",
"campaignName": "October Promo",
"sender_id": "UGATEXT",
"senderId": "UGATEXT"
}
headers = {
"Client-ID": "<api-key>",
"Client-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Client-ID': '<api-key>',
'Client-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone: '+256700000000',
phoneNumber: '+256700000000',
phone_number: '+256700000000',
notes: 'Customer requested opt-out',
reason: 'Customer requested opt-out',
campaignId: 'cmp_1760425200000_a1b2c3',
campaignName: 'October Promo',
sender_id: 'UGATEXT',
senderId: 'UGATEXT'
})
};
fetch('https://ugatext.com/api/v1/opt-outs/add', 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://ugatext.com/api/v1/opt-outs/add",
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' => '+256700000000',
'phoneNumber' => '+256700000000',
'phone_number' => '+256700000000',
'notes' => 'Customer requested opt-out',
'reason' => 'Customer requested opt-out',
'campaignId' => 'cmp_1760425200000_a1b2c3',
'campaignName' => 'October Promo',
'sender_id' => 'UGATEXT',
'senderId' => 'UGATEXT'
]),
CURLOPT_HTTPHEADER => [
"Client-ID: <api-key>",
"Client-Secret: <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://ugatext.com/api/v1/opt-outs/add"
payload := strings.NewReader("{\n \"phone\": \"+256700000000\",\n \"phoneNumber\": \"+256700000000\",\n \"phone_number\": \"+256700000000\",\n \"notes\": \"Customer requested opt-out\",\n \"reason\": \"Customer requested opt-out\",\n \"campaignId\": \"cmp_1760425200000_a1b2c3\",\n \"campaignName\": \"October Promo\",\n \"sender_id\": \"UGATEXT\",\n \"senderId\": \"UGATEXT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Client-ID", "<api-key>")
req.Header.Add("Client-Secret", "<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://ugatext.com/api/v1/opt-outs/add")
.header("Client-ID", "<api-key>")
.header("Client-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"+256700000000\",\n \"phoneNumber\": \"+256700000000\",\n \"phone_number\": \"+256700000000\",\n \"notes\": \"Customer requested opt-out\",\n \"reason\": \"Customer requested opt-out\",\n \"campaignId\": \"cmp_1760425200000_a1b2c3\",\n \"campaignName\": \"October Promo\",\n \"sender_id\": \"UGATEXT\",\n \"senderId\": \"UGATEXT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ugatext.com/api/v1/opt-outs/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Client-ID"] = '<api-key>'
request["Client-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"+256700000000\",\n \"phoneNumber\": \"+256700000000\",\n \"phone_number\": \"+256700000000\",\n \"notes\": \"Customer requested opt-out\",\n \"reason\": \"Customer requested opt-out\",\n \"campaignId\": \"cmp_1760425200000_a1b2c3\",\n \"campaignName\": \"October Promo\",\n \"sender_id\": \"UGATEXT\",\n \"senderId\": \"UGATEXT\"\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Authentication failed. Provide a valid 'Client-ID' and 'Client-Secret' in the request headers.",
"retry_after_seconds": 60
},
"retry_after_seconds": 60
}{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Authentication failed. Provide a valid 'Client-ID' and 'Client-Secret' in the request headers.",
"retry_after_seconds": 60
},
"retry_after_seconds": 60
}{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Authentication failed. Provide a valid 'Client-ID' and 'Client-Secret' in the request headers.",
"retry_after_seconds": 60
},
"retry_after_seconds": 60
}Authorizations
Your UgaText Client-ID (e.g. uga_...). Accepted header aliases: X-Client-ID, or combined in Authorization: Bearer : / X-API-Key: :.
Your UgaText Client-Secret (e.g. sk_live_...). Accepted header alias: X-Client-Secret.
Body
Phone number to add to the opt-out list (accepted aliases: "phoneNumber", "phone_number", "recipient").
"+256700000000"
Alias for phone.
"+256700000000"
Alias for phone.
"+256700000000"
Optional note or reason for the opt-out (accepted alias: "reason").
"Customer requested opt-out"
Alias for notes.
"Customer requested opt-out"
Optional associated campaign ID (accepted alias: "campaign_id").
"cmp_1760425200000_a1b2c3"
Optional associated campaign name (accepted alias: "campaign_name").
"October Promo"
Optional Sender ID associated with the opt-out (accepted alias: "senderId").
"UGATEXT"
Alias for sender_id.
"UGATEXT"
Response
Phone number added to opt-out suppression list

