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

# Facebook Ads

Only in Mage Pro.

Try our fully managed solution to access this advanced feature.

[Get started for free](https://cloud.mage.ai/sign-up?source=facebook-ads)

![Facebook](https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Facebook_Logo_%282019%29.svg/2560px-Facebook_Logo_%282019%29.svg.png)

## Configuration

To set up the Facebook Ads source, provide the following configuration parameters:

| Key | Description | Sample Value | Required |
| - | - | - | - |
| `account_id` | The Facebook Ad account ID used when extracting data. | `"abc123..."` (double quotes required) | ✅ |
| `access_token` | OAuth token to access API endpoints. | `abc123...` | ✅ |
| `start_date` | Fetch data newer than the specified `start_date`. Format: ISO8601. | `2022-01-01T00:00:00Z` | ✅ |

## Streams

Facebook Ads includes the following insight streams:

* `ads_insights`
* `ads_insights_age_and_gender`
* `ads_insights_country`
* `ads_insights_device_platform`
* `ads_insights_platform_and_device`
* `ads_insights_region`
* `ads_insights_dma`
* `ads_insights_hourly_advertiser`

### `account_id`

Visit [Facebook Ads Manager Accounts](https://www.facebook.com/adsmanager/manage/accounts) to find your account ID.\
It should look like: `13261011608127020`.

> **Note**\
> Your account ID is **not** the same as your App ID.

### `access_token`

1. [Create a Facebook App](https://developers.facebook.com/docs/development/create-an-app/).
2. Get the access token:
   1. Go to: `https://developers.facebook.com/apps/[app_id]/marketing-api/tools`
      * Replace `[app_id]` with the ID of the app you created.
   2. Under **Select Token Permissions**, check the following:
      * `ads_management`
      * `ads_read`
      * `read_insights`
   3. Click **Get Token**.
3. Copy the generated `access_token`.

## Errors

### API Rate Limit

If you encounter API rate limits, refer to this [Facebook Community Thread](https://developers.facebook.com/community/threads/158172292247085/) for more information.


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