Add or remove members in bulk from a Facebook custom audience via CSV or smart lists
http
PUT https://services.leadconnectorhq.com/ad-publishing/facebook/custom-audience/{audienceId}/member/batchAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Path parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
audienceId | string | Yes | 23851234567890123 | Custom audience identifier |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
locationId | string | Yes | loc_abc123 | Account identifier |
csvPath | string | No | /uploads/audience.csv | CSV file path |
operationType | string | Yes | ADD | Batch operation type |
smartlistIds | string[] | No | Smartlist IDs array | |
dynamicAudience | string | No | true | Dynamic audience flag |
Responses
200 - Response
400 - Bad Request
json
{}422 - Unprocessable Entity
json
{}Example
curl -X PUT 'https://services.leadconnectorhq.com/ad-publishing/facebook/custom-audience/YOUR_audienceId/member/batch' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"locationId": "loc_abc123",
"csvPath": "/uploads/audience.csv",
"operationType": "ADD",
"smartlistIds": [
"list_1",
"list_2"
],
"dynamicAudience": "true"
}'const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/facebook/custom-audience/YOUR_audienceId/member/batch', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"locationId": "loc_abc123", "csvPath": "/uploads/audience.csv", "operationType": "ADD", "smartlistIds": ["list_1", "list_2"], "dynamicAudience": "true"}),
});
const data = await response.json();import os, requests
response = requests.request(
'PUT',
'https://services.leadconnectorhq.com/ad-publishing/facebook/custom-audience/YOUR_audienceId/member/batch',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"locationId": "loc_abc123", "csvPath": "/uploads/audience.csv", "operationType": "ADD", "smartlistIds": ["list_1", "list_2"], "dynamicAudience": "true"},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/ad-publishing/facebook/custom-audience/YOUR_audienceId/member/batch');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'locationId': 'loc_abc123', 'csvPath': '/uploads/audience.csv', 'operationType': 'ADD', 'smartlistIds': ['list_1', 'list_2'], 'dynamicAudience': 'true'}),
]);
$data = json_decode(curl_exec($ch), true);