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 | Primary ad text (max 2200 chars, recommended 125). Supports emojis and line breaks. |
headline | string optional | Headline (max 255 chars, recommended 40) |
landing_page_url | string required | Landing page URL (HTTPS) |
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) |
locations | array optional | Location targeting. Country codes (['US']) or location objects from search_meta_targeting ([{'key': '2421836', 'type': 'city', 'radius': 25, 'distance_unit': 'mile'}]). Default: ['US'] |
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 | Conversion event: PURCHASE, LEAD, ADD_TO_CART, OTHER, etc. Use OTHER with custom_conversion_id for custom events. |
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). |
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. |
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