> ## 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.

# Library

> Search and retrieve ads from Meta's Ad Library to spy on competitors

Search and retrieve ads from Meta's Ad Library to spy on competitors

|                      |                    |
| -------------------- | ------------------ |
| **App**              | Meta Ads           |
| **Operation ID**     | `meta_ads_library` |
| **Type**             | Action             |
| **Connection**       | None               |
| **Credits per run**  | 5                  |
| **Agent / MCP tool** | Yes                |

## Inputs

| Field               | Type                                | Required | Default  | Description                                                                                                                       |
| ------------------- | ----------------------------------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `input_mode`        | string or SelectableOption          | Yes      | -        | Input mode, either provide a Meta Ads Library URL or configure manually by filling out the fields below like page\_id, query, etc |
| `meta_ads_url`      | string                              | No       | -        | Meta Ads Library URL to parse, user can provide from the browser. Use only when input\_mode is 'url'                              |
| `q`                 | string                              | No       | -        | Search keyword or phrase                                                                                                          |
| `page_id`           | string                              | No       | -        | Specific Facebook page ID, user can find in the meta ads library url after the 'view\_all\_page\_id' parameter                    |
| `country`           | string                              | No       | `ALL`    | Country for the search. Default is 'ALL', provide 2-letter country code (e.g., 'US') to filter by country.                        |
| `ad_type`           | string or SelectableOption          | No       | `all`    | Type of ads to search                                                                                                             |
| `active_status`     | string or SelectableOption          | No       | `active` | Ad status filter                                                                                                                  |
| `media_type`        | string or SelectableOption          | No       | `all`    | Media type filter                                                                                                                 |
| `platforms`         | array of string or SelectableOption | No       | -        | list of platforms where the ads appear like 'facebook', 'instagram', don't set to select all                                      |
| `date_range`        | DateRange                           | No       | -        | Date range with start/end dates                                                                                                   |
| `group_similar_ads` | boolean                             | No       | `False`  | Group similar ads by collation\_id                                                                                                |
| `limit`             | integer                             | No       | `50`     | Maximum number of results to return                                                                                               |

### DateRange

| Field     | Type           | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------- | -------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `start`   | string         | No       | -       | The start date of the date range to query, format: YYYY-MM-DD or dynamic node reference like \{\{nodeId\_\_data.start\_date}}. Required when preset is 'FIXED' or 'CUSTOM'.                                                                                                                                                                                                                                                                                                   |
| `end`     | string         | No       | -       | The end date of the date range to query, format: YYYY-MM-DD or dynamic node reference like \{\{nodeId\_\_data.end\_date}}. Required when preset is 'FIXED' or 'CUSTOM'.                                                                                                                                                                                                                                                                                                       |
| `preset`  | string         | No       | -       | Predefined date ranges or input modes: - Use 'FIXED' or leave empty when you want to specify exact dates (YYYY-MM-DD format) in start/end fields - Use 'CUSTOM' when you want to use dynamic values from other nodes (\{\{nodeId\_\_data.start\_date}} format) in start/end fields - Use other presets (TODAY, YESTERDAY, LAST\_7\_DAYS, etc.) for predefined date ranges (start/end will be ignored) When using 'FIXED' or 'CUSTOM', both start and end fields are required. |
| `compare` | CompareOptions | No       | -       | Optional comparison date range settings. ALWAYS use this field for comparisons; DO NOT create additional requests or nodes, as the backend returns current, comparison, and delta metrics in a single call.                                                                                                                                                                                                                                                                   |

### SelectableOption

| Field   | Type   | Required | Default | Description |
| ------- | ------ | -------- | ------- | ----------- |
| `value` | string | Yes      | -       |             |
| `label` | string | Yes      | -       |             |

### CompareOptions

| Field                   | Type   | Required | Default      | Description                                                                                                                                                                                                                                               |
| ----------------------- | ------ | -------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `start`                 | string | No       | -            | The start date of the comparison range, format: YYYY-MM-DD. Optional if preset is provided.                                                                                                                                                               |
| `end`                   | string | No       | -            | The end date of the comparison range, format: YYYY-MM-DD. Optional if preset is provided.                                                                                                                                                                 |
| `preset`                | string | No       | -            | Predefined comparison ranges. When provided, start and end will be ignored.                                                                                                                                                                               |
| `comparison_format`     | string | No       | `rows`       | Comparison output layout: 'rows' returns separate rows for current, comparison, and delta along with date ranges; 'columns' returns a single row with delta values only as additional \*\_pct or \*\_change columns depending on comparison\_value\_type. |
| `comparison_value_type` | string | No       | `percentage` | Value type: 'percentage' or 'absolute'                                                                                                                                                                                                                    |

## Output

**Type**: `List[Dict]`

Returns list of ads from Meta Ads Library.

**Fields**: dynamic (depend on the inputs)
