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 in USD for this ad set (minimum $1). 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 from validate_and_prepare_meta_assets (for image ad_type) |
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) |
thumbnail_url | string optional | Custom thumbnail URL for video |
cards | array optional | Carousel cards (2-10). Each: {image_url, headline, landing_page_url, description?, call_to_action?} |
primary_text | string required | **REQUIRED.** Primary ad text (max 2200 chars, recommended 125). 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) |
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 | Master switch for Meta's Advantage+ Creative AI enhancements. Set False to opt OUT of ALL granular enhancements at once. Leave None or True to keep Meta's defaults. |
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 | Geo reach mode (a.k.a. location expansion / 'people interested in this location'). List of: 'home' (people who live there), 'recent' (recently there), 'travel_in' (people interested in / traveling to the location). Meta defaults to ['home','recent'] when omitted. To turn ON location expansion, include 'travel_in' (e.g. ['home','recent','travel_in']). |
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 |
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 in account currency for this ad set (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. |
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. Options: WEBSITE, ON_AD, WEBSITE_AND_ON_AD. |
{
"arguments": {
"campaign_id": "<campaign_id>",
"ad_type": "string",
"primary_text": "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