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

# Meta Ads

> Connect a Meta Ads account to manage campaigns, ad sets, ads, and creatives, pull insights, and run native A/B split-tests from the dashboard.

## Overview

Connecting Meta Ads lets the dashboard:

* Create, update, pause, resume, and remove **campaigns**, **ad sets**, and **ads**.
* Upload creative assets (image, video, carousel) into the connected ad account.
* Pull spend, impressions, clicks, conversions, and conversion value via the Insights API.
* Run native creative experiments via Meta's **A/B Split Test** feature.
* Receive realtime ad-disapproval and account-status events via webhooks.

The integration uses the **Graph API v19.0** with OAuth 2.0 authentication.

## Prerequisites

Before connecting, make sure you have:

1. A Meta Ads account in good standing.
2. Admin role on the Meta Business account that owns the ad account.
3. (Optional) A Meta Pixel or Conversions API source if you want conversion-based optimization.

## OAuth scopes

The connection requests:

```
ads_management
ads_read
business_management
```

## Connect

1. Open the **Paid UA → Integrations** page in the dashboard.
2. Click **Connect** on the Meta Ads tile.
3. Sign in with the Facebook account that has access to your Business Manager.
4. Approve the requested scopes.
5. Pick the ad account to use.

The dashboard exchanges the short-lived user token for a long-lived
token (60-day expiry); it is rotated automatically before expiry, so
you don't need to reconnect manually unless the user revokes scope.

## What lives on the platform vs the dashboard

| Lives on Meta                           | Lives on the dashboard            |
| --------------------------------------- | --------------------------------- |
| Campaign / ad-set / ad ids              | Spend caps + automation controls  |
| Creative library                        | Vendor-neutral creative briefs    |
| Audience configurations                 | Idempotency keys + retry attempts |
| Insights (spend / impressions / clicks) | Daily roll-ups of your UA metrics |

## Webhooks

Meta posts ad-status, account-status, and disapproval events to:

```
POST /api/v1/webhooks/meta-ads
```

Signature: `X-Hub-Signature-256` HMAC-SHA256 over the raw body, verified
with a platform-managed signing secret configured by your administrator.
A previous signing secret is also accepted during key rotation.

## Disconnect

Disconnecting revokes the dashboard's stored OAuth token and stops all
background syncs. Campaigns created via the dashboard remain on the
platform — disconnect does not pause or delete them.

## Limits

* Token rotation: long-lived token, rotated automatically before expiry.
* Rate limits: per-ad-account token bucket; 429s are retried with
  exponential backoff.
* Creative size: image up to 8 MB, video up to 4 GB; format-specific
  limits enforced server-side before upload.
