Skip to main content
POST
/
public
/
v1
/
programs
/
{programId}
/
leads
/
batch
Enroll leads into a program
curl --request POST \
  --url https://web-api.clerk.chat/public/v1/programs/{programId}/leads/batch \
  --header 'Content-Type: application/json' \
  --header 'apiKey: <api-key>' \
  --data '
{
  "source": "spring-promo-landing",
  "leads": [
    {
      "phone": "+14155550100",
      "name": "John Doe",
      "email": "jdoe@example.com",
      "externalId": "crm-10472",
      "source": "summer-promo-landing",
      "sourceCampaign": "summer-promo",
      "sourceUrl": "https://example.com/get-a-quote",
      "occurredAt": "2026-06-26T14:30:00.000Z",
      "fields": {
        "state": "TX",
        "zip": "78701",
        "propertyValue": 450000,
        "utm_source": "google"
      },
      "consent": [
        {
          "channel": "messaging",
          "scope": "promotional",
          "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/programs/{programId}/leads/batch"

payload = {
"source": "spring-promo-landing",
"leads": [
{
"phone": "+14155550100",
"name": "John Doe",
"email": "jdoe@example.com",
"externalId": "crm-10472",
"source": "summer-promo-landing",
"sourceCampaign": "summer-promo",
"sourceUrl": "https://example.com/get-a-quote",
"occurredAt": "2026-06-26T14:30:00.000Z",
"fields": {
"state": "TX",
"zip": "78701",
"propertyValue": 450000,
"utm_source": "google"
},
"consent": [
{
"channel": "messaging",
"scope": "promotional",
"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({
source: 'spring-promo-landing',
leads: [
{
phone: '+14155550100',
name: 'John Doe',
email: 'jdoe@example.com',
externalId: 'crm-10472',
source: 'summer-promo-landing',
sourceCampaign: 'summer-promo',
sourceUrl: 'https://example.com/get-a-quote',
occurredAt: '2026-06-26T14:30:00.000Z',
fields: {state: 'TX', zip: '78701', propertyValue: 450000, utm_source: 'google'},
consent: [
{
channel: 'messaging',
scope: 'promotional',
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/programs/{programId}/leads/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/programs/{programId}/leads/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([
'source' => 'spring-promo-landing',
'leads' => [
[
'phone' => '+14155550100',
'name' => 'John Doe',
'email' => 'jdoe@example.com',
'externalId' => 'crm-10472',
'source' => 'summer-promo-landing',
'sourceCampaign' => 'summer-promo',
'sourceUrl' => 'https://example.com/get-a-quote',
'occurredAt' => '2026-06-26T14:30:00.000Z',
'fields' => [
'state' => 'TX',
'zip' => '78701',
'propertyValue' => 450000,
'utm_source' => 'google'
],
'consent' => [
[
'channel' => 'messaging',
'scope' => 'promotional',
'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/programs/{programId}/leads/batch"

payload := strings.NewReader("{\n \"source\": \"spring-promo-landing\",\n \"leads\": [\n {\n \"phone\": \"+14155550100\",\n \"name\": \"John Doe\",\n \"email\": \"jdoe@example.com\",\n \"externalId\": \"crm-10472\",\n \"source\": \"summer-promo-landing\",\n \"sourceCampaign\": \"summer-promo\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"occurredAt\": \"2026-06-26T14:30:00.000Z\",\n \"fields\": {\n \"state\": \"TX\",\n \"zip\": \"78701\",\n \"propertyValue\": 450000,\n \"utm_source\": \"google\"\n },\n \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\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 }\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/programs/{programId}/leads/batch")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"spring-promo-landing\",\n \"leads\": [\n {\n \"phone\": \"+14155550100\",\n \"name\": \"John Doe\",\n \"email\": \"jdoe@example.com\",\n \"externalId\": \"crm-10472\",\n \"source\": \"summer-promo-landing\",\n \"sourceCampaign\": \"summer-promo\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"occurredAt\": \"2026-06-26T14:30:00.000Z\",\n \"fields\": {\n \"state\": \"TX\",\n \"zip\": \"78701\",\n \"propertyValue\": 450000,\n \"utm_source\": \"google\"\n },\n \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\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 }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://web-api.clerk.chat/public/v1/programs/{programId}/leads/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 \"source\": \"spring-promo-landing\",\n \"leads\": [\n {\n \"phone\": \"+14155550100\",\n \"name\": \"John Doe\",\n \"email\": \"jdoe@example.com\",\n \"externalId\": \"crm-10472\",\n \"source\": \"summer-promo-landing\",\n \"sourceCampaign\": \"summer-promo\",\n \"sourceUrl\": \"https://example.com/get-a-quote\",\n \"occurredAt\": \"2026-06-26T14:30:00.000Z\",\n \"fields\": {\n \"state\": \"TX\",\n \"zip\": \"78701\",\n \"propertyValue\": 450000,\n \"utm_source\": \"google\"\n },\n \"consent\": [\n {\n \"channel\": \"messaging\",\n \"scope\": \"promotional\",\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 }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "results": [
      {
        "index": 0,
        "status": "enrolled",
        "externalId": "crm-10472",
        "leadId": "00000000-0000-0000-0000-000000000000",
        "enrollmentId": "00000000-0000-0000-0000-000000000000",
        "reason": "opted_out"
      }
    ],
    "summary": {
      "total": 3,
      "enrolled": 2,
      "skipped": 0,
      "suppressed": 0,
      "rejected": 1
    }
  }
}

Authorizations

apiKey
string
header
required

Path Parameters

programId
string
required

Body

application/json
source
string
required

Where the leads in this batch came from. Applied to every lead that does not set its own source.

Example:

"spring-promo-landing"

leads
object[]
required

The leads to enroll. Up to 50 per request.

Response

Per-lead enrollment result

data
object
required