Record supplied consent
curl --request POST \
--url https://web-api.clerk.chat/public/v1/consent/batch \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"consent": [
{
"channel": "messaging",
"scope": "promotional",
"phoneNumber": "+14155550100",
"basis": "pewc",
"capturedAt": "2026-06-15T12:00:00.000Z",
"expiresAt": "2027-06-15T12:00:00.000Z",
"sourceUrl": "https://example.com/get-a-quote",
"ipAddress": "198.51.100.7",
"certProvider": "trustedform",
"certToken": "https://cert.trustedform.com/0a1b2c3d"
}
]
}
'import requests
url = "https://web-api.clerk.chat/public/v1/consent/batch"
payload = { "consent": [
{
"channel": "messaging",
"scope": "promotional",
"phoneNumber": "+14155550100",
"basis": "pewc",
"capturedAt": "2026-06-15T12:00:00.000Z",
"expiresAt": "2027-06-15T12:00:00.000Z",
"sourceUrl": "https://example.com/get-a-quote",
"ipAddress": "198.51.100.7",
"certProvider": "trustedform",
"certToken": "https://cert.trustedform.com/0a1b2c3d"
}
] }
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({
consent: [
{
channel: 'messaging',
scope: 'promotional',
phoneNumber: '+14155550100',
basis: 'pewc',
capturedAt: '2026-06-15T12:00:00.000Z',
expiresAt: '2027-06-15T12:00:00.000Z',
sourceUrl: 'https://example.com/get-a-quote',
ipAddress: '198.51.100.7',
certProvider: 'trustedform',
certToken: 'https://cert.trustedform.com/0a1b2c3d'
}
]
})
};
fetch('https://web-api.clerk.chat/public/v1/consent/batch', 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/consent/batch",
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([
'consent' => [
[
'channel' => 'messaging',
'scope' => 'promotional',
'phoneNumber' => '+14155550100',
'basis' => 'pewc',
'capturedAt' => '2026-06-15T12:00:00.000Z',
'expiresAt' => '2027-06-15T12:00:00.000Z',
'sourceUrl' => 'https://example.com/get-a-quote',
'ipAddress' => '198.51.100.7',
'certProvider' => 'trustedform',
'certToken' => 'https://cert.trustedform.com/0a1b2c3d'
]
]
]),
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/consent/batch"
payload := strings.NewReader("{\n \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\n \"phoneNumber\": \"+14155550100\",\n \"basis\": \"pewc\",\n \"capturedAt\": \"2026-06-15T12:00:00.000Z\",\n \"expiresAt\": \"2027-06-15T12:00:00.000Z\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"ipAddress\": \"198.51.100.7\",\n \"certProvider\": \"trustedform\",\n \"certToken\": \"https://cert.trustedform.com/0a1b2c3d\"\n }\n ]\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/consent/batch")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\n \"phoneNumber\": \"+14155550100\",\n \"basis\": \"pewc\",\n \"capturedAt\": \"2026-06-15T12:00:00.000Z\",\n \"expiresAt\": \"2027-06-15T12:00:00.000Z\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"ipAddress\": \"198.51.100.7\",\n \"certProvider\": \"trustedform\",\n \"certToken\": \"https://cert.trustedform.com/0a1b2c3d\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/v1/consent/batch")
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 \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\n \"phoneNumber\": \"+14155550100\",\n \"basis\": \"pewc\",\n \"capturedAt\": \"2026-06-15T12:00:00.000Z\",\n \"expiresAt\": \"2027-06-15T12:00:00.000Z\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"ipAddress\": \"198.51.100.7\",\n \"certProvider\": \"trustedform\",\n \"certToken\": \"https://cert.trustedform.com/0a1b2c3d\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"results": [
{
"index": 0,
"phoneNumber": "+14155550100",
"status": "recorded",
"reason": "invalid_phone"
}
]
}
}Programs
Record supplied consent
Stores supplied consent for a batch of phone numbers. The contact is found or created by phone. Each record is processed independently and re-recording an existing consent refreshes it.
POST
/
public
/
v1
/
consent
/
batch
Record supplied consent
curl --request POST \
--url https://web-api.clerk.chat/public/v1/consent/batch \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"consent": [
{
"channel": "messaging",
"scope": "promotional",
"phoneNumber": "+14155550100",
"basis": "pewc",
"capturedAt": "2026-06-15T12:00:00.000Z",
"expiresAt": "2027-06-15T12:00:00.000Z",
"sourceUrl": "https://example.com/get-a-quote",
"ipAddress": "198.51.100.7",
"certProvider": "trustedform",
"certToken": "https://cert.trustedform.com/0a1b2c3d"
}
]
}
'import requests
url = "https://web-api.clerk.chat/public/v1/consent/batch"
payload = { "consent": [
{
"channel": "messaging",
"scope": "promotional",
"phoneNumber": "+14155550100",
"basis": "pewc",
"capturedAt": "2026-06-15T12:00:00.000Z",
"expiresAt": "2027-06-15T12:00:00.000Z",
"sourceUrl": "https://example.com/get-a-quote",
"ipAddress": "198.51.100.7",
"certProvider": "trustedform",
"certToken": "https://cert.trustedform.com/0a1b2c3d"
}
] }
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({
consent: [
{
channel: 'messaging',
scope: 'promotional',
phoneNumber: '+14155550100',
basis: 'pewc',
capturedAt: '2026-06-15T12:00:00.000Z',
expiresAt: '2027-06-15T12:00:00.000Z',
sourceUrl: 'https://example.com/get-a-quote',
ipAddress: '198.51.100.7',
certProvider: 'trustedform',
certToken: 'https://cert.trustedform.com/0a1b2c3d'
}
]
})
};
fetch('https://web-api.clerk.chat/public/v1/consent/batch', 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/consent/batch",
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([
'consent' => [
[
'channel' => 'messaging',
'scope' => 'promotional',
'phoneNumber' => '+14155550100',
'basis' => 'pewc',
'capturedAt' => '2026-06-15T12:00:00.000Z',
'expiresAt' => '2027-06-15T12:00:00.000Z',
'sourceUrl' => 'https://example.com/get-a-quote',
'ipAddress' => '198.51.100.7',
'certProvider' => 'trustedform',
'certToken' => 'https://cert.trustedform.com/0a1b2c3d'
]
]
]),
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/consent/batch"
payload := strings.NewReader("{\n \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\n \"phoneNumber\": \"+14155550100\",\n \"basis\": \"pewc\",\n \"capturedAt\": \"2026-06-15T12:00:00.000Z\",\n \"expiresAt\": \"2027-06-15T12:00:00.000Z\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"ipAddress\": \"198.51.100.7\",\n \"certProvider\": \"trustedform\",\n \"certToken\": \"https://cert.trustedform.com/0a1b2c3d\"\n }\n ]\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/consent/batch")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\n \"phoneNumber\": \"+14155550100\",\n \"basis\": \"pewc\",\n \"capturedAt\": \"2026-06-15T12:00:00.000Z\",\n \"expiresAt\": \"2027-06-15T12:00:00.000Z\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"ipAddress\": \"198.51.100.7\",\n \"certProvider\": \"trustedform\",\n \"certToken\": \"https://cert.trustedform.com/0a1b2c3d\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/v1/consent/batch")
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 \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\n \"phoneNumber\": \"+14155550100\",\n \"basis\": \"pewc\",\n \"capturedAt\": \"2026-06-15T12:00:00.000Z\",\n \"expiresAt\": \"2027-06-15T12:00:00.000Z\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"ipAddress\": \"198.51.100.7\",\n \"certProvider\": \"trustedform\",\n \"certToken\": \"https://cert.trustedform.com/0a1b2c3d\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"results": [
{
"index": 0,
"phoneNumber": "+14155550100",
"status": "recorded",
"reason": "invalid_phone"
}
]
}
}⌘I