Meta Ads Write
User wants to add a new ad set to an EXISTING campaign
POST https://api.adspirer.ai/api/v1/tools/add_meta_ad_set/execute
Authorization: Bearer sk_live_... — your Adspirer API key (required)Content-Type: application/json (required)Idempotency-Key: <uuid> — recommended for write operations to make retries safeAll tool arguments are wrapped in an arguments object.
| Field | Type | Description |
|---|---|---|
campaign_id | string required | The Meta Campaign ID to add the ad set to (required). Get this from a prior create_meta_*_campaign call or get_meta_campaign_details. |
ad_type | string required | Type of ad: 'image', 'video', or 'carousel' |
budget_daily | number optional | Daily budget for this ad set in the ad account's OWN CURRENCY as a decimal — NOT cents, and NOT converted to USD. For 20/day send 20, not 2000. Required for non-CBO campaigns. Do NOT set for CBO campaigns — budget is managed at campaign level. Use daily_min_spend_target/daily_spend_cap instead. |
campaign_budget_optimization | boolean optional | Set to true if the parent campaign uses Advantage Campaign Budget (CBO). When true, budget_daily is not required and bid_strategy is skipped on the ad set. default: false |
daily_min_spend_target | number optional | CBO only: minimum daily spend for this ad set in account currency. |
daily_spend_cap | number optional | CBO only: maximum daily spend cap for this ad set in account currency. |
image_url | string optional | Public URL of image to use (for image ad_type) |
existing_image_hash | string optional | Existing Meta image hash (for image ad_type) |
asset_bundle_id | string optional | Asset bundle ID (image ad_type) — only if validate_and_prepare_meta_assets returned a non-null one. For a single uploaded image it returns an image HASH; pass that via existing_image_hash instead. Never pass the literal "None". |
video_url | string optional | Public URL of video to upload (for video ad_type) |
existing_video_id | string optional | Existing Meta video ID (for video ad_type). An uploaded video asset ID, not a published Facebook Page post or Reel ID. |
placement_specific_videos | object optional | (video ad_type) Map of placement → video URL or existing Meta video ID, to build the ad with a different video per placement in ONE step (no throwaway starter ad). Keys: feed / stories_reels / right_column, aspect-ratio aliases feed_4x5 / square_1x1 / landscape_16x9 / vertical_9x16, and 'primary' (default video). A catch-all default rule is added automatically. Mutually exclusive with video_url / existing_video_id. |
thumbnail_url | string optional | Custom thumbnail URL for video |
cards | array optional | Carousel cards (2-10). Each: {image_url OR image_hash, headline, landing_page_url, description?, call_to_action?}. The per-card hash key is `image_hash` (the SAME Meta image-hash value validate_and_prepare_meta_assets / discover_meta_assets return — single-image tools call it `existing_image_hash`, carousel cards call it `image_hash`). |
primary_text | string optional | Primary ad text (max 2200 chars, recommended 125). **REQUIRED unless `primary_texts` is given.** Ask the user for it before calling. Supports emojis and line breaks. |
headline | string optional | Headline (max 255 chars, recommended 40) |
landing_page_url | string required | **REQUIRED.** Landing page URL (HTTPS). Ask the user for it before calling. |
call_to_action | string optional | CTA button: LEARN_MORE, SHOP_NOW, SIGN_UP, etc. default: "LEARN_MORE" |
description | string optional | Description (max 255 chars, recommended 30) |
primary_texts | array optional | List of primary text variations (2-5) for the ad created with this ad set. **USE THIS whenever the user gives you 2+ primary texts**: one ad, Meta tests the combinations (a Flexible ad, not Dynamic Creative, so more ads can be added to the ad set later). ad_type 'image' or 'video' only. Not supported for carousel, WhatsApp, placement_specific_videos or on-ad lead form ad sets. |
headlines | array optional | List of headline variations (2-5) for the ad created with this ad set. Same rules as primary_texts. |
descriptions | array optional | List of description variations (2-5) for the ad created with this ad set. Same rules as primary_texts. |
display_link | string optional | Optional display URL (caption) shown in the ad instead of the full landing page URL (e.g. 'brand.com'). Must match or redirect to the landing_page_url domain. NOT supported for ad_type='video'. |
advantage_audience | boolean optional | Advantage+ Audience on/off. When True, interests/behaviors/custom_audiences are treated as suggestions and Meta expands delivery beyond them. When False/None, strict filter behavior. Incompatible with special ad categories. |
advantage_plus_creative | boolean optional | Meta's Advantage+ creative enhancements. True applies only to plain website ads (Traffic objective, website destination, link and button, no special ad category), single image or single video: it requests from Meta Visual touch-ups, Add overlays, Text improvements and Adjust brightness and contrast for an image, Text improvements for a video, and Meta decides which it applies. These can crop or AI-extend the image and rearrange or overlay the ad's own text; they never write new text. Features listed in disabled_creative_features are sent as off. True leaves every other ad unchanged. False sends off for every enhancement setting this tool manages. Unset copies the settings the account's newest ad turned off; anything not sent follows Meta's own setting, which for ads created through the API is usually off. |
disabled_creative_features | array optional | List of granular Advantage+ Creative features to opt OUT of individually (image_auto_crop, enhance_cta, text_optimizations, etc.). 'standard_enhancements' rejected — Meta deprecated it in v22 and it breaks duplicate_campaign (error_subcode 3858504). |
locations | array optional | Location targeting. Country codes (['US']) or location objects from search_meta_targeting ([{'key': '2421836', 'type': 'city', 'radius': 25, 'distance_unit': 'mile'}]). ALWAYS include the 'type' field (city/region/zip/place) on each object — a key with no type is treated as a country code and rejected by Meta. For ~dozens of cities each with a radius, pass one object per city. Default: ['US'] |
location_types | array optional | DEPRECATED — do not set. Meta removed the location-targeting reach-mode ('people living in' / 'recently in' / 'travelling in'); all ad sets now reach 'people living in or recently in' the selected locations, and sending any location_types value now makes Meta reject the ad set. Leave this unset; any value you pass is ignored. |
age_min | integer optional | — default: 18 |
age_max | integer optional | — default: 65 |
genders | array optional | — |
interests | array optional | — |
behaviors | array optional | — |
custom_audiences | array optional | — |
excluded_custom_audiences | array optional | — |
lead_form_id | string optional | Lead form ID for OUTCOME_LEADS campaigns. If not provided, auto-fetched from existing campaign ads. |
pixel_id | string optional | Meta Pixel ID for conversion tracking |
pixel_event_name | string optional | Meta Pixel Standard Event to optimize for. Options: PURCHASE, LEAD, COMPLETE_REGISTRATION, ADD_TO_CART, INITIATED_CHECKOUT, ADD_PAYMENT_INFO, SEARCH, CONTENT_VIEW, OTHER. Use OTHER with custom_conversion_id for custom-conversion rules, or with custom_event_str for arbitrary pixel events. NOTE: LANDING_PAGE_VIEWS / LINK_CLICKS / IMPRESSIONS / REACH are `optimization_goal` values, not pixel events — do not set those here. |
custom_conversion_id | string optional | Custom conversion ID for optimizing towards a specific custom conversion. When provided, pixel_event_name is ignored — Meta infers the event type from the custom conversion. |
instagram_account_id | string optional | Instagram account ID |
facebook_page_id | string optional | Facebook Page ID. Auto-detected when the ad account has exactly ONE promotable Page. If the account has 2+ Pages, the tool will list them and ask you to pass this — Meta has no default Page, so pick the right one for this ad. Call list_meta_pages to see the options. |
ad_set_name | string optional | Custom name for the ad set |
ad_name | string optional | Custom name for the ad created inside the ad set |
ad_account_id | string optional | Meta ad account ID |
multi_share_optimized | boolean optional | For carousel: optimize card order default: true |
budget_lifetime | number optional | Lifetime budget for this ad set in the ad account's OWN CURRENCY as a decimal (NOT cents, NOT USD; minimum 1). Mutually exclusive with budget_daily. Requires end_time to be set. Cannot be used with CBO campaigns. |
end_time | string optional | End date/time for this ad set in ISO format (e.g., 2026-04-30T23:59:59). Required when using budget_lifetime. Optional with budget_daily. |
multi_advertiser | boolean optional | Set to false to opt out of Meta's multi-advertiser ad format at the creative level. When false, sets contextual_multi_ads.enroll_status=OPT_OUT on the ad creative. Default (None) = Meta's default behavior (enrolled). |
url_tags | string optional | URL parameters (e.g. 'utm_source=meta&utm_medium=cpc&utm_campaign=brand-launch') appended to the landing-page URL on every click. Use for UTM tracking. Leading '?' is stripped automatically. |
publisher_platforms | array optional | Which platforms to run on: ['facebook', 'instagram', 'audience_network', 'messenger']. Only listed platforms are included. Default: automatic (all). |
facebook_positions | array optional | Facebook placements: feed, right_hand_column, story, facebook_reels, marketplace, search, etc. Only listed positions are included. |
instagram_positions | array optional | Instagram placements: stream (feed), story, reels, explore, explore_home, ig_search, profile_feed. Only listed positions are included. |
app_id | string optional | Facebook App ID (numeric). Required when adding an ad set to an OUTCOME_APP_PROMOTION campaign. NOT the iOS bundle ID or Android package name. |
app_store_url | string optional | App Store / Play Store URL. Required when adding an ad set to an OUTCOME_APP_PROMOTION campaign. The ad set's OS targeting is set from this URL automatically (override with user_os). |
user_os | string optional | Operating system to target: 'iOS' or 'Android'. Usually OMIT — derived from app_store_url. Meta REJECTS an ad set whose OS targeting disagrees with the promoted app's platform ('Mobile Targeting Mismatch'). |
app_event_type | string optional | Optional in-app event to optimize for (PURCHASE, LEVEL_ACHIEVED, COMPLETE_REGISTRATION, etc.). Defaults to APP_INSTALLS when omitted. |
deep_link_url_ios | string optional | Optional iOS deep link (e.g. 'myapp://product/123'). |
deep_link_url_android | string optional | Optional Android deep link (e.g. 'myapp://product/123'). |
is_dynamic_creative | boolean optional | Set to true to enable Dynamic Creative Optimization on this ad set. Meta will test combinations of images, headlines, and text to find the best performer. Only 1 ad is allowed per DCO ad set. Use with add_meta_ad's image_urls/headlines/primary_texts fields. |
destination_type | string optional | Override the ad set destination type. Set to 'WEBSITE' for OUTCOME_LEADS campaigns that track conversions on your website via Meta Pixel instead of using Meta's built-in lead form. Set to 'WHATSAPP' for a WhatsApp-native (Click-to-WhatsApp) ad set — requires the parent campaign objective to be OUTCOME_ENGAGEMENT (or OUTCOME_LEADS) and facebook_page_id. Options: WEBSITE, ON_AD, WEBSITE_AND_ON_AD, WHATSAPP. |
whatsapp_welcome_message | string optional | For destination_type='WHATSAPP' only. The greeting shown when the WhatsApp chat opens from the ad. Ignored for non-WhatsApp ad sets. |
whatsapp_phone_number | string optional | For destination_type='WHATSAPP' only. Which WhatsApp number should receive the conversations, as displayed on the Page (e.g. '+55 51 99999-0000'). Leave it out and Meta picks a number for the Page itself — which is what you want for a Page with a single number, but on a Page with several Meta may not pick the one you expect. Pass this (or whatsapp_phone_number_id) whenever the Page has more than one number — it is far better to name the number up front than to correct it later. |
whatsapp_phone_number_id | string optional | For destination_type='WHATSAPP' only. Alternative to whatsapp_phone_number: the WhatsApp Business phone-number ID, if you have it from Meta Business Settings. Names the same destination — pass either one, not both. |
whatsapp_ice_breakers | array optional | For destination_type='WHATSAPP' only. Quick-reply prompt buttons shown when the WhatsApp chat opens (e.g. ['See pricing', 'Book a visit']). Ignored for non-WhatsApp ad sets. |
dsa_beneficiary | string optional | EU Digital Services Act beneficiary — the entity (usually the advertiser's business/legal name) that benefits from this ad. REQUIRED by Meta when the ad set targets any EU/EEA country (e.g. Spain, Germany, France). Ignored for non-EU targeting. Example: 'Acme Inc'. |
dsa_payor | string optional | EU DSA payor — the entity paying for the ad. Optional; defaults to dsa_beneficiary when omitted. Only needed if the payor differs from the beneficiary. |
regional_regulated_categories | array optional | Meta regional regulated-category declarations for non-EU regions, as a list of tokens. REQUIRED when targeting certain regions or Meta rejects the ad set: e.g. ['TAIWAN_UNIVERSAL'] for any Taiwan location (error 3858498). Other tokens: TAIWAN_FINSERV, SINGAPORE_UNIVERSAL, THAILAND_UNIVERSAL, AUSTRALIA_UNIVERSAL, AUSTRALIA_FINSERV, MALAYSIA_UNIVERSAL, BRAZIL_REGULATION, INDIA_FINSERV, US_SECURITIES_LICENSING. |
regional_regulation_identities | object optional | Map of Meta verified-identity ids (the verified advertiser/payer) for regions that require one (Meta errors 3858634 'Advertiser is missing' / 3858636). Keys: universal_beneficiary + universal_payer for AUSTRALIA_UNIVERSAL, MALAYSIA_UNIVERSAL, THAILAND_UNIVERSAL, BRAZIL_REGULATION, US_SECURITIES_LICENSING and any other region without its own keys; taiwan_universal_*, singapore_universal_*, taiwan_finserv_*, australia_finserv_*, india_finserv_* for those categories; united_kingdom_finserv_beneficiary + united_kingdom_finserv_payer for United Kingdom financial services; thailand_new_risky_beneficiary + thailand_new_risky_payer for Thailand new-risky; taiwan_finserv_funder (a single key, no beneficiary/payer pair) for the Taiwan financial-services funder. Send BOTH beneficiary and payer (same id allowed), e.g. {'universal_beneficiary': '<id>', 'universal_payer': '<id>'}. The id is NOT a Page id; get it from get_meta_advertiser_identities (reads it off an existing ad set). Never guess an id. |
optimization_goal | string optional | Ad-set optimization goal (e.g. LINK_CLICKS, LANDING_PAGE_VIEWS, OFFSITE_CONVERSIONS, POST_ENGAGEMENT, REACH, LEAD_GENERATION, THRUPLAY). Optional — defaults to the objective's standard goal, or (when adding to an existing campaign) the goal the other ad sets use. Set it explicitly when a cost-cap / lowest-cost campaign requires all ad sets to share one goal, or to pick a specific goal; Meta validates it against the objective. |
billing_event | string optional | Ad-set billing event (IMPRESSIONS, LINK_CLICKS, THRUPLAY, ...). Optional; defaults to the goal's standard billing event. |
{
"arguments": {
"campaign_id": "<campaign_id>",
"ad_type": "string",
"landing_page_url": "https://example.com",
"budget_daily": 1.0,
"campaign_budget_optimization": false,
"daily_min_spend_target": 1.0,
"daily_spend_cap": 1.0,
"image_url": "string",
"existing_image_hash": "string"
}
}
{
"success": true,
"data": {
"text": "(tool-specific textual output for add_meta_ad_set)",
"quota": {
"used": 42,
"limit": 150,
"tier": "plus",
"period_end": "2026-05-01"
}
},
"tool": "add_meta_ad_set"
}
{
"success": false,
"error": "You have 25 meta_ads accounts connected. Please specify which account to use by passing the ad_account_id parameter:\n - Acme Holdings (ad_account_id=\"act_123456789\")\n - Acme EU (ad_account_id=\"act_987654321\")",
"is_error": true,
"tool": "add_meta_ad_set"
}
{
"success": false,
"error": "\ud83d\udea8 Monthly limit reached (150/150 tool calls on Plus tier).\nUpgrade to Pro at https://adspirer.ai to keep building.",
"is_error": true,
"tool": "add_meta_ad_set",
"quota": {
"used": 150,
"limit": 150,
"tier": "plus",
"period_end": "2026-05-01",
"upgrade_url": "https://adspirer.ai"
}
}
Interactive: Swagger UI
Machine-readable: OpenAPI 3.1 spec · llms-full.txt
Adspirer REST API — get an API key at adspirer.ai/keys · adspirer.ai