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

# Meta Ads source connector

> Read Meta ad accounts, campaigns, ad sets, ads, creatives, audiences, and daily insights with Filament, the open-source data movement engine.

Connector ID `meta_ads`

The Meta Ads source reads every ad account an access token can reach, along
with its campaigns, ad sets, ads, creatives, assets, audiences, conversions,
change history, and daily performance insights. It uses an
[HTTP manifest](https://filament.getgalaxy.io/pages/connectors/building-a-connector/http-manifests.md) and
targets Marketing API version `v27.0`. The connector is in preview. It follows
Meta's API docs but has not been tested against a live ad account.

## Configuration

| Field | Scope | Default | Description |
| - | - | - | - |
| `access_token` | Connection | | Required. Secret. System user or long-lived user access token with the `ads_read` permission. |
| `insights_date_preset` | Pipeline | `last_28d` | Relative date range that every daily insights resource reads. |
| `hourly_insights_date_preset` | Pipeline | `last_28d` | Relative date range that `campaign_insights_hourly` reads. |
| `activities_start_date` | Pipeline | | Required for `activities`. YYYY-MM-DD date that full reads and the first incremental run start from. |

Create a Meta app with the Marketing API product. Then create a system user in
[Business settings](https://business.facebook.com/settings/) under
**System Users**, assign it your ad accounts, and generate a token for your app
with `ads_read`.
[System user tokens](https://developers.facebook.com/docs/business-management-apis/system-users/install-apps-and-generate-tokens/)
can be generated to never expire or to expire after 60 days, and some businesses
must use the expiring kind. Check the token's expiration when you generate it,
and renew an expiring token before it lapses or scheduled runs start failing. A
long-lived user token also lasts about 60 days and must then be replaced. Reading ad accounts that belong to
other people needs advanced access to `ads_read`. See
[Authorization](https://developers.facebook.com/documentation/ads-commerce/marketing-api/get-started/authorization).

Leave **Require App Secret** off in the app's advanced settings. The connector
does not sign requests with `appsecret_proof`, so Meta rejects every call when
that setting is on.

Connection testing lists the ad accounts with `GET /v27.0/me/adaccounts`. Every
read starts from that list, so the connector reads each ad account the token can
access. To read fewer accounts, assign the system user only those accounts. An
error from any one ad account fails the whole resource for that run, so remove
accounts the token can list but no longer read.

`insights_date_preset` takes any of Meta's
[`date_preset` values](https://developers.facebook.com/documentation/ads-commerce/marketing-api/reference/ad-account/insights),
such as `last_7d`, `last_28d`, `last_90d`, `this_month`, or `maximum`. Meta
caps `maximum` at 37 months. `hourly_insights_date_preset` offers the same
presets up to `this_year` and leaves out `last_year`, `maximum`, and
`data_maximum`, because Meta returns no hourly data for a range that starts more
than 13 months ago.

## Resources

| Resource | Endpoint | Parent |
| - | - | - |
| `ad_accounts` | `GET /v27.0/me/adaccounts` | |
| `campaigns` | `GET /v27.0/{ad_account}/campaigns` | Ad accounts |
| `ad_sets` | `GET /v27.0/{ad_account}/adsets` | Ad accounts |
| `ads` | `GET /v27.0/{ad_account}/ads` | Ad accounts |
| `ad_creatives` | `GET /v27.0/{ad_account}/adcreatives` | Ad accounts |
| `ad_creatives_by_ad` | `GET /v27.0/{ad_account}/ads` | Ad accounts |
| `ad_images` | `GET /v27.0/{ad_account}/adimages` | Ad accounts |
| `ad_videos` | `GET /v27.0/{ad_account}/advideos` | Ad accounts |
| `custom_audiences` | `GET /v27.0/{ad_account}/customaudiences` | Ad accounts |
| `saved_audiences` | `GET /v27.0/{ad_account}/saved_audiences` | Ad accounts |
| `custom_conversions` | `GET /v27.0/{ad_account}/customconversions` | Ad accounts |
| `ads_pixels` | `GET /v27.0/{ad_account}/adspixels` | Ad accounts |
| `ad_labels` | `GET /v27.0/{ad_account}/adlabels` | Ad accounts |
| `ad_rules` | `GET /v27.0/{ad_account}/adrules_library` | Ad accounts |
| `activities` | `GET /v27.0/{ad_account}/activities` | Ad accounts |
| `account_insights` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `campaign_insights` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_set_insights` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_rankings` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_age` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_gender` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_age_gender` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_country` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_region` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_comscore_market` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_publisher_platform` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_placement` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_placement_device` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_device_platform` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_publisher_device_platform` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_product` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_action_carousel_card` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_action_reaction` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_action_video_sound` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `ad_insights_action_video_type` | `GET /v27.0/{ad_account}/insights` | Ad accounts |
| `campaign_insights_hourly` | `GET /v27.0/{ad_account}/insights` | Ad accounts |

`{ad_account}` is the `act_` ID that `GET /v27.0/me/adaccounts` returns. That
list is read on every run and never written. Every other resource except
`ad_accounts` makes its requests once per ad account.

`ad_accounts`, `campaigns`, `ad_sets`, `ads`, `ad_creatives`, and the account,
campaign, ad set, and ad insights are selected by default. The other resources
are optional.

### Objects and assets

Each request names the fields it reads with the `fields` parameter. Nested
objects such as targeting, bid settings, promoted objects, story specs, and
action lists are kept as JSON columns. The connector does not read
signed media URLs such as creative thumbnails, image download URLs, or video
sources, because Meta's signed URLs expire. `permalink_url`, `image_hash`, and
`video_id` identify the assets instead. Ad account billing fields that Meta
gates behind the `MANAGE` task, such as funding source details, are not read.

Money keeps the values Meta returns, without currency conversion, and the unit
depends on the field. Meta documents budgets, bids, and spend caps in the
currency's smallest unit, such as cents for USD and yen for JPY. That covers
`daily_budget`, `lifetime_budget`, `budget_remaining`, the ad set spend targets
and caps, `bid_amount`, and `spend_cap`. Meta reports the ad account's
`amount_spent` and `balance` against `spend_cap` but does not state their unit,
and they are commonly read in the same smallest unit. Insights `spend` and cost
metrics are decimal amounts in the account currency, such as `12.34` for
\$12.34.

Campaigns, ad sets, and ads include archived objects through an
`effective_status` filter. Deleted objects are left out, because Meta returns an
error when that filter names `DELETED`. Campaigns, ad sets, ads, creatives,
images, labels, and rules are keyed by their ID. Videos, custom audiences, saved
audiences, custom conversions, and pixels are keyed by `ad_account_id` and ID,
so an asset that several ad accounts list keeps one row per account.
`ad_account_id` is the numeric ID of the ad account that listed the row.

`ad_creatives_by_ad` reads each ad's creative through the ads listing, 25 ads per
page, with one row per ad keyed by `ad_id`. Use it when `ad_creatives` fails on
a large account with "Please reduce the amount of data you're asking for". Ads
that share a creative repeat its columns.

`custom_audiences` reports `time_created`, `time_updated`, and
`time_content_updated` as Unix seconds, so they load as integers. It does not
read the audience `rule`, because that field can make Meta answer "Please
reduce the amount of data you're asking for".

`ad_videos` can fail with error `283` when Meta wants a Page permission such as
`pages_read_engagement` for videos that belong to a Page.

### Insights

Each insights row covers one day, through `time_increment=1`. `date_start` and
`date_stop` are calendar dates in the ad account's time zone, which
`ad_accounts` reports as `timezone_name`. The row's level sets its key, which is
`account_id`, `campaign_id`, `adset_id`, or `ad_id` together with `date_start`.
The account, campaign, ad set, and ad resources read impressions, clicks,
spend, reach, frequency, cost metrics, link clicks, outbound clicks, actions and
action values, conversions, return on ad spend, and video views. Actions and
other per-action metrics are JSON arrays of action types and values.

Campaign, ad set, and ad insights filter on `effective_status` with every status
including `ARCHIVED` and `DELETED`. Meta documents the `DELETED` value for the
`ad.effective_status` filter, so ad-level rows keep delivery from ads deleted
later. Meta does not document it for `campaign.effective_status` or
`adset.effective_status`, so campaign and ad set rows for deleted objects may be
missing.

`ad_insights_rankings` reads the quality, engagement rate, and conversion rate
rankings for each ad and day. Meta's current insights field lists do not
include these rankings, and integrators report Meta stopped returning them in
version `v18.0`. This resource can return empty rankings or fail, so it is kept
apart from `ad_insights`.

Breakdown resources read ad-level daily insights split by one or more
dimensions. Their keys add the breakdown columns to `ad_id` and `date_start`.
They leave out video metrics, which Meta does not support with every breakdown.

| Resource | Breakdowns |
| - | - |
| `ad_insights_age` | `age` |
| `ad_insights_gender` | `gender` |
| `ad_insights_age_gender` | `age`, `gender` |
| `ad_insights_country` | `country` |
| `ad_insights_region` | `region` |
| `ad_insights_comscore_market` | `comscore_market` |
| `ad_insights_publisher_platform` | `publisher_platform` |
| `ad_insights_placement` | `publisher_platform`, `platform_position` |
| `ad_insights_placement_device` | `publisher_platform`, `platform_position`, `impression_device` |
| `ad_insights_device_platform` | `device_platform` |
| `ad_insights_publisher_device_platform` | `publisher_platform`, `device_platform` |
| `ad_insights_product` | `product_id` |

* `comscore_market` replaced the `dma` breakdown on June 22, 2026. It needs the
  `comscore` insights feature on the ad account and returns no rows without it.
* `impression_device` needs enablement for some ad accounts since August 6,
  2026\. Without it `ad_insights_placement_device` returns no rows.
* `device_platform` is a documented breakdown but is missing from Meta's table
  of allowed combinations. `ad_insights_device_platform` and
  `ad_insights_publisher_device_platform` can fail if Meta rejects it.
* Meta reports region names without their country. Two regions with the same
  name in different countries, such as Limburg in Belgium and the Netherlands,
  share a key in `ad_insights_region`, and an upsert keeps only one of them.

Action breakdown resources read the same metrics as `ad_insights` but group the
entries of the action arrays by another dimension. They add no columns or rows,
so they keep the `ad_id` and `date_start` key.

| Resource | Action breakdowns |
| - | - |
| `ad_insights_action_carousel_card` | `action_carousel_card_id`, `action_carousel_card_name` |
| `ad_insights_action_reaction` | `action_reaction` |
| `ad_insights_action_video_sound` | `action_video_sound` |
| `ad_insights_action_video_type` | `action_video_type` |

`action_video_sound` and `action_video_type` are documented action breakdowns
but are missing from Meta's combination table, so Meta may reject them.

`campaign_insights_hourly` reads campaign insights by
`hourly_stats_aggregated_by_advertiser_time_zone`, which is part of its key,
over `hourly_insights_date_preset`. It reads delivery, cost, click, and action metrics. Meta returns `0` for reach and
frequency with hourly breakdowns and does not allow video metrics, so the
resource reads neither.

## Modes

All resources support full reads. Use **full upsert** for insights. Each run
rereads the days in its preset and replaces those rows by key.
**Full replace** would delete every day outside the preset, so avoid it for
insights. Meta says insights
[do not change after 28 days](https://developers.facebook.com/documentation/ads-commerce/marketing-api/insights/best-practices),
which is why the default preset is `last_28d`. A shorter preset stops
refreshing older days while late conversions can still change them, so those
days stay stale.

Entity resources are full only. Use full upsert to refresh existing rows, or
full replace to also drop rows Meta no longer returns, such as deleted
campaigns. The campaigns listing has no modified-time filter. The ad set and ad
listings accept `updated_since`, but one watermark would be shared across every
ad account. A campaign's paused or archived status also passes down to its ad
sets and ads as their `effective_status`, and Meta does not document whether
that changes the child's update time.

`activities` also supports **incremental append** on `event_time`. Meta returns
one week of activity when a request names no start, so the resource needs
`activities_start_date`. Full reads and the first incremental run send it as
`since`. Later runs send the watermark as `since` in Unix seconds, one hour
earlier to cover activity logged while other ad accounts were read. Activity
rows have no ID, so they are keyless, and rows inside that hour can repeat.
Every column of a repeated row matches, so `SELECT DISTINCT` removes them.

The `activities` watermark is the latest `event_time` across every ad account,
and ad accounts are read at the same time. When a run fails after some accounts
have advanced the watermark, the next run starts from it and can skip events
that a slower account had not yet delivered. A newly added ad account also
starts at the shared watermark. Run a full read to recover either case.

Insights do not support incremental reads. Meta's `time_range` needs an end
date, and the manifest cannot compute the current date.

## Behavior

* **Auth** sends the token as a bearer token in the `Authorization` header
  rather than the `access_token` query parameter, which keeps it out of the
  URLs the connector builds. Meta does not document whether its `paging.next`
  links carry the token.
* **Pagination** follows the `paging.next` URL Meta returns with each page until
  a page has none. A page can be empty and still link to the next one. Lists use
  100 rows per page. Creatives and custom audiences use 25, since their
  responses carry large specs.
* **Rate limiting** sends at most two requests per second across the connection,
  which suits apps with Full access to the Marketing API. Meta's throttling
  errors back off from 30 seconds and retry. These are codes `4`, `17`, `341`,
  `613`, `80000`, `80003`, `80004`, and `80014`, and insights subcode `1504043`,
  when Meta returns them with HTTP 400 or 403. An app with Limited access gets a
  score of 60 per ad account that decays over 300 seconds, about one read every
  five seconds, and is blocked for five minutes when it runs out. Such apps
  spend much of a run waiting on retries. See
  [rate limiting](https://developers.facebook.com/documentation/ads-commerce/marketing-api/overview/rate-limiting).
  Filament does not read Meta's usage headers or track quotas shared with other
  apps.
* **Errors** other than throttling fail the read with Meta's message, including
  expired tokens, missing permissions, and invalid parameters. Server errors are
  retried up to three times.
* **Insights timeouts** happen when a synchronous request asks for too much
  data. Meta returns code `100` subcode `1504018` or code `2` subcode `1504038`
  and the read fails. Ad-level and breakdown insights over a long preset on a
  large account are the likeliest to time out. Meta's remedy is an asynchronous
  report or a request split into shorter date ranges, and the connector supports
  neither. A shorter preset can reduce the timeout risk, but Meta sets no
  size below which a query is sure to finish, and a preset shorter than 28 days
  leaves older days stale, as described in Modes. A backfill with `maximum` is likeliest to
  finish for account and campaign insights and likeliest to time out for
  ad-level and breakdown insights on large accounts.
* **Insights history** follows Meta's retention. `maximum` returns at most 37
  months. Breakdown queries that start more than 13 months ago leave out reach,
  frequency, and `cpp`. Hourly queries that start more than 13 months ago return
  no data, so the hourly preset offers no range that reaches that far.
* **Attribution** follows each ad set's attribution setting, which Meta reports
  in `attribution_setting`. Meta has ignored `use_unified_attribution_setting`
  and `action_report_time` since June 2025. The connector sends neither and
  leaves `action_attribution_windows` at Meta's default.
* **Off-Meta actions** are not returned with the `region` breakdown or hourly
  insights. With the `product_id` breakdown and the carousel card action
  breakdowns Meta returns off-Meta web actions without the breakdown value and
  drops mobile app actions. On-Meta metrics such as impressions and link clicks
  are unaffected.

This version covers ad accounts, campaign structure, creative assets,
audiences, conversions, pixels, labels, rules, change history, and synchronous
insights with a fixed set of breakdowns. Asynchronous insights report runs are
not supported, because their results are paged and the manifest's export reads
one response. Custom insights reports with user-chosen fields, breakdowns, and
levels are not supported, because the manifest declares each resource ahead of
time. Lead ads data, business-level assets, product catalogs, lift studies, ad
previews, and ad account users are outside its scope.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.