Create an opt-out
curl --request POST \
--url https://web-api.clerk.chat/public/v1/opt-outs \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"identifier": "+14155550100",
"inboxId": "00000000-0000-0000-0000-000000000000",
"reason": "Customer requested via support"
}
'import requests
url = "https://web-api.clerk.chat/public/v1/opt-outs"
payload = {
"identifier": "+14155550100",
"inboxId": "00000000-0000-0000-0000-000000000000",
"reason": "Customer requested via support"
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
identifier: '+14155550100',
inboxId: '00000000-0000-0000-0000-000000000000',
reason: 'Customer requested via support'
})
};
fetch('https://web-api.clerk.chat/public/v1/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://web-api.clerk.chat/public/v1/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([
'identifier' => '+14155550100',
'inboxId' => '00000000-0000-0000-0000-000000000000',
'reason' => 'Customer requested via support'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <api-key>"
],
]);
$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://web-api.clerk.chat/public/v1/opt-outs"
payload := strings.NewReader("{\n \"identifier\": \"+14155550100\",\n \"inboxId\": \"00000000-0000-0000-0000-000000000000\",\n \"reason\": \"Customer requested via support\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://web-api.clerk.chat/public/v1/opt-outs")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"identifier\": \"+14155550100\",\n \"inboxId\": \"00000000-0000-0000-0000-000000000000\",\n \"reason\": \"Customer requested via support\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/v1/opt-outs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"identifier\": \"+14155550100\",\n \"inboxId\": \"00000000-0000-0000-0000-000000000000\",\n \"reason\": \"Customer requested via support\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"identifier": "+14155550100",
"inboxId": "00000000-0000-0000-0000-000000000000",
"reason": "Customer requested via support",
"channel": "sms",
"createdAt": "2021-01-01T00:00:00.000Z"
}
}Opt-outs
Create an opt-out
Creates an opt-out for a phone number on the active team. Repeated requests for the same identifier and scope are idempotent and return the existing opt-out.
POST
/
public
/
v1
/
opt-outs
Create an opt-out
curl --request POST \
--url https://web-api.clerk.chat/public/v1/opt-outs \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"identifier": "+14155550100",
"inboxId": "00000000-0000-0000-0000-000000000000",
"reason": "Customer requested via support"
}
'import requests
url = "https://web-api.clerk.chat/public/v1/opt-outs"
payload = {
"identifier": "+14155550100",
"inboxId": "00000000-0000-0000-0000-000000000000",
"reason": "Customer requested via support"
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
identifier: '+14155550100',
inboxId: '00000000-0000-0000-0000-000000000000',
reason: 'Customer requested via support'
})
};
fetch('https://web-api.clerk.chat/public/v1/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://web-api.clerk.chat/public/v1/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([
'identifier' => '+14155550100',
'inboxId' => '00000000-0000-0000-0000-000000000000',
'reason' => 'Customer requested via support'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <api-key>"
],
]);
$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://web-api.clerk.chat/public/v1/opt-outs"
payload := strings.NewReader("{\n \"identifier\": \"+14155550100\",\n \"inboxId\": \"00000000-0000-0000-0000-000000000000\",\n \"reason\": \"Customer requested via support\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://web-api.clerk.chat/public/v1/opt-outs")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"identifier\": \"+14155550100\",\n \"inboxId\": \"00000000-0000-0000-0000-000000000000\",\n \"reason\": \"Customer requested via support\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/v1/opt-outs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"identifier\": \"+14155550100\",\n \"inboxId\": \"00000000-0000-0000-0000-000000000000\",\n \"reason\": \"Customer requested via support\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"identifier": "+14155550100",
"inboxId": "00000000-0000-0000-0000-000000000000",
"reason": "Customer requested via support",
"channel": "sms",
"createdAt": "2021-01-01T00:00:00.000Z"
}
}Authorizations
Body
application/json
Phone number to opt out, in E.164 format
Example:
"+14155550100"
Optional inbox ID for an inbox-scoped opt-out. When omitted, a team-wide opt-out is created. Requires the InboxOptOuts feature.
Example:
"00000000-0000-0000-0000-000000000000"
Optional reason for the opt-out
Example:
"Customer requested via support"
Response
The created or existing opt-out
Show child attributes
Show child attributes
⌘I