Marketing API Version

Ad Account Reachestimate

Reading

To get the Reach Estimates of a targeting specification using this ad account.

Error Response

If the parameters are missing or invalid, or the API is otherwise unable to return an estimate, the response will include the field unsupported with value true.

{
    "data": {
    "users": 0,
    "estimate_ready": true,
    "unsupported": true
  }
}

Examples

use FacebookAds\Object\AdAccount;

use FacebookAds\Object\Values\AdSetOptimizationGoalValues;

$account = new AdAccount('act_<AD_ACCOUNT_ID>');
$targeting_spec = array(
  'geo_locations' => array(
    'countries' => ['US'],
  ),
  'age_min' => 20,
  'age_max' => 40,
);
$reach_estimate = $account->getReachEstimate(
  array(),
  array(
    'currency' => 'USD',
    'optimize_for' => AdSetOptimizationGoalValues::OFFSITE_CONVERSIONS,
    'targeting_spec' => $targeting_spec,
  ));
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adset import AdSet

account = AdAccount('act_<AD_ACCOUNT_ID>')
targeting_spec = {
    'geo_locations': {
        'countries': ['US'],
    },
    'age_min': 20,
    'age_max': 40,
}
params = {
    'currency': 'USD',
    'optimize_for': AdSet.OptimizationGoal.offsite_conversions,
    'targeting_spec': targeting_spec,
}
reach_estimate = account.get_reach_estimate(params=params)
print(reach_estimate)
curl -G \
  -d 'currency=USD' \
  -d 'optimize_for=OFFSITE_CONVERSIONS' \
  --data-urlencode 'targeting_spec={ 
    "geo_locations": {"countries":["US"]}, 
    "age_min": 20, 
    "age_max": 40 
  }' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/reachestimate

Sample response:

{
  "data": {
    "users": 186000000,
    "estimate_ready": true
  }
}

Graph API Explorer
GET /v2.10/{ad-account-id}/reachestimate HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{ad-account-id}/reachestimate'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{ad-account-id}/reachestimate",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{ad-account-id}/reachestimate",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{ad-account-id}/reachestimate"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
  • ads_management
Page management Apps
No data
Other Apps
No data

Parameters

NameDescription
currency
UTF-8 encoded string

Currency the estimated bids should be returned in. For the list of supported currencies, and the ISO values you can use, see the supported currencies.

daily_budget
float

The daily budget planned.

object_store_url
string

For a mobile app campaign, the url of the app in the app store.

optimize_for
enum{NONE, APP_INSTALLS, BRAND_AWARENESS, AD_RECALL_LIFT, CLICKS, ENGAGED_USERS, EVENT_RESPONSES, IMPRESSIONS, LEAD_GENERATION, LINK_CLICKS, OFFER_CLAIMS, OFFSITE_CONVERSIONS, PAGE_ENGAGEMENT, PAGE_LIKES, POST_ENGAGEMENT, REACH, SOCIAL_IMPRESSIONS, VIDEO_VIEWS, APP_DOWNLOADS, LANDING_PAGE_VIEWS}

What you are optimizing for, allowed values are same as ad set's optimization_goal. This API generates min, median, and max bid estimates related to the optimization goal. Required.

targeting_spec
Targeting object

The targeting structure for reach estimate. "countries" is required. See targeting.

Required

Fields

Reading from this edge will return a JSON formatted result:

{ "data": "ReachEstimate", "paging": {} }

data

A single ReachEstimate node.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
100Invalid parameter
2641By law, we cannot serve ads to the following countries
273This Ads API call requires the user to be admin of the ad account
105The number of parameters exceeded the maximum for this operation
200Permissions error
274The ad account is not enabled for usage in Ads API. Please add it in developers.facebook.com/apps -> select your app -> settings -> advanced -> advertising accounts -> Ads API
2654Failed to create custom audience
278Reading advertisements requires an access token with the extended permission ads_read
272This Ads API call requires the user to be admin of the application

Creating

You can't perform this operation on this endpoint.

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.