Opt-outs
Check an opt-out
Tells you whether a phone number is on your opt-out list for a channel. Call it before a send to skip a blocked contact instead of handling a 422 from POST /messages.
GET
/
opt-outs
/
{phoneNumber}
cURL
curl --request GET \
--url https://api.vobiz.ai/api/v1/sms/opt-outs/{phoneNumber} \
--header 'X-Auth-ID: <api-key>' \
--header 'X-Auth-Token: <api-key>'from vobiz import Vobiz
client = Vobiz(api_key="MA_XXXXXXXX", auth_token="YOUR_AUTH_TOKEN")
client.sms.opt_outs.check_opt_out(
phone_number="+14155550123",
channel="sms",
)
const options = {
method: 'GET',
headers: {'X-Auth-ID': '<api-key>', 'X-Auth-Token': '<api-key>'}
};
fetch('https://api.vobiz.ai/api/v1/sms/opt-outs/{phoneNumber}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"optedOut": true
}{
"error": "missing or invalid credentials"
}{
"error": "internal error"
}Authorizations
Your Vobiz account Auth ID (MA_XXXXXXXX).
Your Vobiz account Auth Token.
Path Parameters
The number in E.164 format, for example +14155550123. In raw HTTP requests, URL-encode the + as %2B (/opt-outs/%2B14155550123); the SDKs encode it for you.
Query Parameters
Channel to check: sms, mms or rcs. Defaults to sms.
Response
The opt-out state.
Whether a phone number is on your opt-out list for the channel you asked about.
true when the number is blocked on the requested channel, so sends to it return 422. false when you can message it.
Example:
true
Was this page helpful?
⌘I
cURL
curl --request GET \
--url https://api.vobiz.ai/api/v1/sms/opt-outs/{phoneNumber} \
--header 'X-Auth-ID: <api-key>' \
--header 'X-Auth-Token: <api-key>'from vobiz import Vobiz
client = Vobiz(api_key="MA_XXXXXXXX", auth_token="YOUR_AUTH_TOKEN")
client.sms.opt_outs.check_opt_out(
phone_number="+14155550123",
channel="sms",
)
const options = {
method: 'GET',
headers: {'X-Auth-ID': '<api-key>', 'X-Auth-Token': '<api-key>'}
};
fetch('https://api.vobiz.ai/api/v1/sms/opt-outs/{phoneNumber}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"optedOut": true
}{
"error": "missing or invalid credentials"
}{
"error": "internal error"
}