create_meta_dco_ad

Meta Ads Write

User wants Meta to automatically TEST MULTIPLE IMAGES and find the best combination

Endpoint

POST https://api.adspirer.ai/api/v1/tools/create_meta_dco_ad/execute

Headers

Description

User wants Meta to automatically TEST MULTIPLE IMAGES and find the best combination. This is Dynamic Creative Optimization (DCO). Meta tests all combinations of images × headlines × primary texts and optimizes delivery automatically. USE THIS TOOL when the user says ANY of these: - "test these images" / "test multiple images" - "let Meta find the winner" / "let Meta optimize" - "Dynamic Creative" / "DCO" - "which image performs best" - Provides multiple images and wants Meta to choose the best - "test combinations" / "mix and match" - "10 images × 5 headlines" DO NOT USE add_meta_ad multiple times for this — that creates separate ads (A/B test). DCO is ONE ad with multiple assets that Meta mixes and optimizes. Prerequisites: 1. You need an ad_set_id with is_dynamic_creative=true 2. If the user doesn't have one, first call `add_meta_ad_set` with `is_dynamic_creative=true` 3. Then call this tool with the image_urls and text variations Asset limits (from Meta): - Images: 2-10 (required) - Headlines: up to 5 (optional) - Primary texts: up to 5 (optional) - Descriptions: up to 5 (optional) - Total assets: max 30 DCO ad sets support only 1 ad — do NOT add more ads to a DCO ad set. Example: 5 images × 3 headlines × 2 primary texts = 30 combinations, Meta finds the winner.

Request body

All tool arguments are wrapped in an arguments object.

FieldTypeDescription
ad_set_idstring requiredThe Meta Ad Set ID. The ad set must have is_dynamic_creative=true (create one with add_meta_ad_set using is_dynamic_creative=true).
image_urlsarray requiredList of 2-10 image URLs for Meta to test. Meta will try all combinations.
primary_textstring requiredDefault primary text (used if primary_texts is not provided).
landing_page_urlstring requiredLanding page URL (HTTPS)
call_to_actionstring optionalCTA button default: "LEARN_MORE"
headlinesarray optionalList of headline variations (up to 5) for Meta to test.
headlinestring optionalSingle headline (used if headlines is not provided).
primary_textsarray optionalList of primary text variations (up to 5) for Meta to test.
descriptionsarray optionalList of description variations (up to 5) for Meta to test.
descriptionstring optionalSingle description (used if descriptions is not provided).
lead_form_idstring optionalLead form ID for OUTCOME_LEADS campaigns.
facebook_page_idstring optionalFacebook Page ID
instagram_account_idstring optionalInstagram account ID
ad_namestring optionalCustom name for the DCO ad
ad_account_idstring optionalMeta ad account ID

Example request

{
  "arguments": {
    "ad_set_id": "string",
    "image_urls": [
      "string"
    ],
    "primary_text": "string",
    "landing_page_url": "https://example.com",
    "call_to_action": "LEARN_MORE",
    "headlines": [
      "string"
    ],
    "headline": "string",
    "primary_texts": [
      "string"
    ],
    "descriptions": [
      "string"
    ],
    "description": "string"
  }
}

Example responses

200 — Success

{
  "success": true,
  "data": {
    "text": "(tool-specific textual output for create_meta_dco_ad)",
    "quota": {
      "used": 42,
      "limit": 150,
      "tier": "plus",
      "period_end": "2026-05-01"
    }
  },
  "tool": "create_meta_dco_ad"
}

400 — Tool-level error (bad arguments / multi-account selection)

{
  "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": "create_meta_dco_ad"
}

402 — Quota exhausted

{
  "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": "create_meta_dco_ad",
  "quota": {
    "used": 150,
    "limit": 150,
    "tier": "plus",
    "period_end": "2026-05-01",
    "upgrade_url": "https://adspirer.ai"
  }
}

Try it live


Adspirer REST API — get an API key at adspirer.ai/keys · adspirer.ai