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 Endpoints

Next Steps

1. Marketing API Quickstart

To get started with the Marketing API read and complete our quickstart. This guide will teach you how to create an ad account and Facebook app, install our SDKs and explain the basic usage of the Marketing API.

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);
print_r($insights);
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>" \
"https://graph.facebook.com/<API_VERSION>/<AD_CAMPAIGN_ID>/insights"

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

3. All Endpoints

The Ads Insights API covers the following endpoints:

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.