Manage Custom Audience (create / update / delete)
adsap_manage_custom_audienceCreate, update, or delete a RULE-BASED custom audience: Website (pixel/site visitors), Engagement (Instagram/Facebook engagers), Lookalike (people similar to an existing audience), or App (mobile app users). Completes the pair with adsap_list_custom_audiences (read). For create, pick an audience_type and pass a rule (or lookalike fields). dry_run defaults TRUE: call once to preview, then again with dry_run:false to apply. Delete is PERMANENT and auto-pauses any ad sets using the audience — the dry_run preview lists them first. NOTE: this covers rule-based audiences only; uploading a customer list (hashed emails/phones) is NOT supported here. The account must accept Meta's Custom Audience Terms of Service once before any audience can be created (Meta returns an accept URL if not).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>",
"ad_account_id": "<ad_account_id>"
},
"name": "adsap_manage_custom_audience"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Required for action=create. The audience name shown in Ads Manager. | |
| rule | No | Required for create when audience_type is website/engagement/app (NOT lookalike). A JSON-ENCODED STRING (not an object). Structure: {"inclusions":{"operator":"or","rules":[<rule>]}} (optional top-level "exclusions" with the same shape). Each <rule>: {"event_sources":[{"type":"<TYPE>","id":"<ID>"}],"retention_seconds":<n>,"filter":{"operator":"and","filters":[...]},"template":"<TEMPLATE>"}. WEBSITE: type "pixel" (id from adsap_list_meta_assets pixels). All visitors → template "ALL_VISITORS" + filter {"field":"url","operator":"i_contains","value":""}. Specific pages → template "VISITORS_BY_URL" + filter {"field":"url","operator":"i_contains","value":"<keyword>"}. Standard events → template "VISITORS_BY_URL" + filter {"field":"event","operator":"eq","value":"Purchase"/"AddToCart"/"Lead"/...}. ENGAGEMENT (Instagram): type "ig_business" (id = Instagram account id from adsap_list_meta_assets), filter {"field":"event","operator":"=","value":"ig_business_profile_all"} (all engagers). APP: type "app" (app id), template "MACA_APP_LAUNCHED_USERS" + filter {"field":"event","operator":"=","value":"fb_mobile_activate_app"}. retention_seconds = how long to keep members (max 15552000 = 180 days; 2592000 = 30 days). | |
| ratio | No | Lookalike only. Share of the population to match, 0.01 (1%, closest/smallest) to 0.20 (20%, broadest/largest). Defaults to 0.01. | |
| action | Yes | What to do: "create" a new rule-based audience, "update" an existing one's name/description/rule, or "delete" one permanently. | |
| dry_run | No | TRUE (default) = preview only, nothing is written. For delete, the preview also lists which ad sets would be auto-paused. Set false to actually create/update/delete. | |
| prefill | No | Optional (website/engagement/app create). TRUE backfills the audience with historical data. Defaults to Meta's default (true). | |
| description | No | Optional description for the audience (create or update). | |
| ad_account_id | Yes | act_<digits>. The ad account that owns (or will own) the custom audience. Used for ownership, workspace resolution, and Meta API budget. | |
| audience_type | No | Required for action=create. "website" = pixel/site visitors (WCA), "engagement" = people who engaged with your Instagram/Facebook (ECA), "lookalike" = people similar to an existing audience (LAL), "app" = mobile app users (MACA). | |
| lookalike_country | No | Lookalike only. ISO country code (e.g. "US", "FR", "GB"). NO LONGER USED: Meta v27.0 rejects a country on lookalike creation, so Adsap accepts this field for backward compatibility and does not send it. A lookalike has no location of its own; delivery locations come from the ad sets that use the audience, so set location targeting on those ad sets. | |
| custom_audience_id | No | Required for action=update and action=delete. The numeric id of the existing custom audience. Get it from adsap_list_custom_audiences. | |
| origin_audience_id | No | Required for create when audience_type=lookalike. The numeric id of the SEED audience to model on (a WEBSITE/ENGAGEMENT/APP/CUSTOM audience — NOT another lookalike). Get it from adsap_list_custom_audiences. |