Create an opt-out
curl --request POST \
--url https://api.wavix.com/v3/messages/opt-outs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"opt_out": {
"number": "16419252149",
"sender_id": "15072429497"
}
}
'import requests
url = "https://api.wavix.com/v3/messages/opt-outs"
payload = { "opt_out": {
"number": "16419252149",
"sender_id": "15072429497"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({opt_out: {number: '16419252149', sender_id: '15072429497'}})
};
fetch('https://api.wavix.com/v3/messages/opt-outs', 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.wavix.com/v3/messages/opt-outs",
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([
'opt_out' => [
'number' => '16419252149',
'sender_id' => '15072429497'
]
]),
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://api.wavix.com/v3/messages/opt-outs"
payload := strings.NewReader("{\n \"opt_out\": {\n \"number\": \"16419252149\",\n \"sender_id\": \"15072429497\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.wavix.com/v3/messages/opt-outs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"opt_out\": {\n \"number\": \"16419252149\",\n \"sender_id\": \"15072429497\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wavix.com/v3/messages/opt-outs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"opt_out\": {\n \"number\": \"16419252149\",\n \"sender_id\": \"15072429497\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"message": "Missing or invalid parameter <param_name>"
}{
"success": false,
"message": "The service is not provisioned for your account."
}{
"success": false,
"message": "Record not found"
}{
"success": false,
"message": "Missing or invalid parameter <param_name>"
}SMS and MMS
Create an opt-out
Opts a phone number out of receiving messages from a Sender ID, a 10DLC campaign, or all outbound messages.
POST
/
v3
/
messages
/
opt-outs
Create an opt-out
curl --request POST \
--url https://api.wavix.com/v3/messages/opt-outs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"opt_out": {
"number": "16419252149",
"sender_id": "15072429497"
}
}
'import requests
url = "https://api.wavix.com/v3/messages/opt-outs"
payload = { "opt_out": {
"number": "16419252149",
"sender_id": "15072429497"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({opt_out: {number: '16419252149', sender_id: '15072429497'}})
};
fetch('https://api.wavix.com/v3/messages/opt-outs', 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.wavix.com/v3/messages/opt-outs",
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([
'opt_out' => [
'number' => '16419252149',
'sender_id' => '15072429497'
]
]),
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://api.wavix.com/v3/messages/opt-outs"
payload := strings.NewReader("{\n \"opt_out\": {\n \"number\": \"16419252149\",\n \"sender_id\": \"15072429497\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.wavix.com/v3/messages/opt-outs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"opt_out\": {\n \"number\": \"16419252149\",\n \"sender_id\": \"15072429497\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wavix.com/v3/messages/opt-outs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"opt_out\": {\n \"number\": \"16419252149\",\n \"sender_id\": \"15072429497\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"message": "Missing or invalid parameter <param_name>"
}{
"success": false,
"message": "The service is not provisioned for your account."
}{
"success": false,
"message": "Record not found"
}{
"success": false,
"message": "Missing or invalid parameter <param_name>"
}Authorizations
Wavix API key. Pass as Authorization: Bearer <api_key>. Keys support per-resource scopes (none / read / write). See Restricted keys and scopes.
Body
application/json
Attributes for the new opt-out.
Show child attributes
Show child attributes
Example:
{
"number": "16419252149",
"sender_id": "15072429497"
}
Response
Returns a success confirmation. The opt-out is created.
Indicates whether the request was successful.
Example:
true
Was this page helpful?
⌘I