Marketing API Version

Ads Insights API - Step-by-Step Tutorial

The Ads Insights API provides API access for reporting and analytics purposes. When exclusively using the Ad Insights API, request the ads_read permission.

1. Marketing API Quickstart

2. Example Query: Campaign Statistics

3. All References

Next Steps

1. Marketing API Quickstart

To get started with the Marketing API, start by creating an app. Once created, you can add Marketing API as a product and go through the Quickstart experience within your app dashboard.

Marketing API Quickstart simplifies using the Marketing API by generating sample code for you. It is a step-by-step on-boarding flow that helps you use ad management and insights tools built on Facebook's Marketing API. You can start getting insights from your Facebook Pixel or App Ads SDKs by clicking the Create Ad reports below.

Marketing API Quickstart

2. Example Query: Campaign Statistics

To get the statistics of a campaign's last 7 day performance run the following query:

use FacebookAds\Object\AdCampaign;
use FacebookAds\Object\Values\InsightsPresets;

$campaign = new AdCampaign('<AD_CAMPAIGN_ID>');
$params = array(
  'date_preset' => InsightsPresets::LAST_7_DAYS,
$insights = $campaign->getInsights(null, $params);
from facebookads.objects import AdCampaign
campaign = AdCampaign('<AD_CAMPAIGN_ID>')
params = {
    'date_preset': AdCampaign.Preset.last_7_days,
insights = campaign.get_insights(params=params)
print insights
curl -G \
-d "date_preset=last_7_days" \
-d "access_token=<ACCESS_TOKEN>" \

To learn more about how to query statistics, see the ad insights edge documentation.

3. All References

The Ads Insights API has the following references that we strongly recommend to read:

Any endpoints not in the above list are not covered in this API.

If you are planning to include reports for Facebook in your product interface, please refer to section 14.7 of the Ads API policy.