Set contact restricted channels
curl --request PUT \
--url http://localhost:8080/contacts/{contact_id}/restricted-channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"restricted_channels": []
}
'import requests
url = "http://localhost:8080/contacts/{contact_id}/restricted-channels"
payload = { "restricted_channels": [] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({restricted_channels: []})
};
fetch('http://localhost:8080/contacts/{contact_id}/restricted-channels', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/contacts/{contact_id}/restricted-channels",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'restricted_channels' => [
]
]),
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 := "http://localhost:8080/contacts/{contact_id}/restricted-channels"
payload := strings.NewReader("{\n \"restricted_channels\": []\n}")
req, _ := http.NewRequest("PUT", 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.put("http://localhost:8080/contacts/{contact_id}/restricted-channels")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"restricted_channels\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/contacts/{contact_id}/restricted-channels")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"restricted_channels\": []\n}"
response = http.request(request)
puts response.read_body{
"contact_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"restricted_channels": [
"email"
]
}{
"statusCode": 404,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Contacts
Set contact restricted channels
Replace the channels a contact asked not to be contacted on. Use to honor a confidential communications request or a one-channel opt-out synced from your own system.
PUT
/
contacts
/
{contact_id}
/
restricted-channels
Set contact restricted channels
curl --request PUT \
--url http://localhost:8080/contacts/{contact_id}/restricted-channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"restricted_channels": []
}
'import requests
url = "http://localhost:8080/contacts/{contact_id}/restricted-channels"
payload = { "restricted_channels": [] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({restricted_channels: []})
};
fetch('http://localhost:8080/contacts/{contact_id}/restricted-channels', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/contacts/{contact_id}/restricted-channels",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'restricted_channels' => [
]
]),
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 := "http://localhost:8080/contacts/{contact_id}/restricted-channels"
payload := strings.NewReader("{\n \"restricted_channels\": []\n}")
req, _ := http.NewRequest("PUT", 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.put("http://localhost:8080/contacts/{contact_id}/restricted-channels")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"restricted_channels\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/contacts/{contact_id}/restricted-channels")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"restricted_channels\": []\n}"
response = http.request(request)
puts response.read_body{
"contact_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"restricted_channels": [
"email"
]
}{
"statusCode": 404,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Send the contact’s full list of restricted channels: it replaces the current one. Channels are any of
To add or lift a single channel, read
email, sms, whatsapp and phone_voice (phone calls). Duplicates are dropped and the response lists the channels sorted. Send an empty list to lift every restriction.
curl -X PUT "https://api.open.cx/contacts/3f6c1e2a-8b4d-4c7e-9a10-5d2b7e4f9c01/restricted-channels" \
-H "Authorization: Bearer $OPENCX_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "restricted_channels": ["sms", "phone_voice"] }'
{
"contact_id": "3f6c1e2a-8b4d-4c7e-9a10-5d2b7e4f9c01",
"restricted_channels": ["phone_voice", "sms"]
}
restricted_channels from Get contact first, then send the new full list.
- The API key needs the
contacts:writescope. - A contact ID that isn’t in your organization returns
404. - A change moves the contact’s
updated_atforward, so List contacts withupdated_afterpicks it up. Sending the list the contact already has changes and records nothing. - Every change is recorded in the audit log with the before and after lists, who made it and from where. See Audit Logs API.
- Changing restricted channels doesn’t fire the Contact Updated workflow trigger.
422 and error: "contact_channel_restricted"; see refused sends. Replies in a session the contact started on that channel are still delivered. Restricted channels explains what a restriction stops and what still goes through.Authorizations
Path Parameters
Body
application/json
Response
Default Response
Channels this contact asked not to be contacted on: any of email, sms, whatsapp, phone_voice. Nothing your team, workflows, sequences or the API start goes out to the contact on a listed channel; AI replies to the contact's messages and your team's replies in a session on that channel are still delivered. Empty when nothing is restricted.
Available options:
email, sms, whatsapp, phone_voice Was this page helpful?