> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Flexible Ad

> Creates flexible ads with multiple media (up to 10) and text variations (up to 5 each)

Creates flexible ads with multiple media (up to 10) and text variations (up to 5 each). By default it creates the full ad. It also supports detailed-results mode: by default the response returns only IDs, while return\_detailed\_results=true returns per-row success and failure details. Detailed results are recommended for AI agents.

|                       |                               |
| --------------------- | ----------------------------- |
| **App**               | Meta Ads                      |
| **Operation ID**      | `meta_ads_create_flexible_ad` |
| **Type**              | Action                        |
| **Connection**        | `meta_ads` (required)         |
| **Credits per run**   | 3                             |
| **Agent / MCP tool**  | Yes                           |
| **Requires approval** | Yes (write operation)         |

## Inputs

| Field                     | Type                                          | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------- | --------------------------------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account`                 | DynamicAccount                                | Yes      | -       | Select the Meta Ads account, ask the user for it if not provided                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `page`                    | string or SelectItem                          | Yes      | -       | Select Facebook page, ask the user for it if not provided                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `instagram_user_id`       | string or SelectItem                          | No       | -       | Optional Instagram account override. Leave empty in nearly all cases — the Instagram account linked to the selected Page is used automatically. Only set this when the user wants to advertise with a different Instagram account they have access to. Value is the numeric IG user/business account id.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `structured_data`         | array (also accepts a comma-separated string) | Yes      | -       | Structured data containing flexible ad information. Each row represents one flexible ad. Required columns: adset\_id, ad\_name, primary\_text\_1, headline\_1, website\_url, media\_1\_url. Optional columns: media\_2\_url through media\_10\_url (up to 10 media total), primary\_text\_2 through primary\_text\_5 (up to 5 variations), headline\_2 through headline\_5 (up to 5 variations), description\_1 through description\_5 (up to 5 variations), call\_to\_action (e.g., LEARN\_MORE, SHOP\_NOW, SIGN\_UP), url\_parameters, ad\_status (ACTIVE/PAUSED), form\_id (for lead form ads), disable\_creative\_enhancements (set to True/'true'/'TRUE' to disable Meta's automatic creative optimizations), disable\_multi\_advertiser\_ads (set to True/'true'/'TRUE' to opt out of showing your ad alongside other ads), ad\_start\_time (schedule ad start, format: YYYY-MM-DD HH:MM or YYYY-MM-DD, in the ad account's timezone), ad\_end\_time (schedule ad end, format: YYYY-MM-DD HH:MM or YYYY-MM-DD, in the ad account's timezone). Meta will automatically test different combinations to find the best performing ads. Note: user can provide direct media URLs or Google Drive share links; Markifact will convert Drive links to direct URLs automatically, the only requirement is that the file sharing is set to 'Anyone with the link'. |
| `return_detailed_results` | boolean                                       | No       | `False` | If true, returns per-row results (success\_count, failed\_count, total\_count, results\[]) and does NOT raise an error on partial failures so the workflow can continue. If false (default), returns a simple summary and raises an error if any row fails.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

### SelectItem

| Field   | Type   | Required | Default | Description                                                                                          |
| ------- | ------ | -------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `value` | string | Yes      | -       | The value of the selectable item.                                                                    |
| `label` | string | Yes      | -       | The label of the selectable item, used for display purposes. If not provided, defaults to the value. |

## Output

**Type**: `Dict`

Returns created ad details, a list of ad IDs and count.

**Fields**: `ad_ids`, `created_count`
