Custom Audiences
Build custom and lookalike audiences
Custom Audiences
Create a Lookalike Audience:
const audience = await zernio.adaudiences.createAdAudience({
body: {
accountId: 'acc_metaads_123',
adAccountId: 'act_1234567890',
type: 'lookalike',
name: 'LAL 1% of US customers',
sourceAudienceId: '6123456789',
country: 'US',
ratio: 0.01,
},
});audience = client.ad_audiences.create_ad_audience(
account_id="acc_metaads_123",
ad_account_id="act_1234567890",
type="lookalike",
name="LAL 1% of US customers",
source_audience_id="6123456789",
country="US",
ratio=0.01,
)curl -X POST "https://zernio.com/api/v1/ads/audiences" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "acc_metaads_123",
"adAccountId": "act_1234567890",
"type": "lookalike",
"name": "LAL 1% of US customers",
"sourceAudienceId": "6123456789",
"country": "US",
"ratio": 0.01
}'Add users to a customer list (SHA-256 hashed automatically):
await zernio.adaudiences.addUsersToAdAudience({
path: { audienceId: 'AUDIENCE_ID' },
body: {
users: [
{ email: 'user@example.com' },
{ phone: '+14155551234' },
],
},
});client.ad_audiences.add_users_to_ad_audience(
audience_id="AUDIENCE_ID",
users=[
{"email": "user@example.com"},
{"phone": "+14155551234"},
],
)curl -X POST "https://zernio.com/api/v1/ads/audiences/AUDIENCE_ID/users" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"users": [
{ "email": "user@example.com" },
{ "phone": "+14155551234" }
]
}'