Marketing API Version

Ad Account Reachfrequencypredictions

Reading

Reach frequency predictions for the ad account.

Example

Graph API Explorer
GET /v2.11/{ad-account-id}/reachfrequencypredictions HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{ad-account-id}/reachfrequencypredictions',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{ad-account-id}/reachfrequencypredictions",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{ad-account-id}/reachfrequencypredictions",
    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}/reachfrequencypredictions"
                                      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
  • ads_read
Page management Apps
No data
Other Apps
No data

Parameters

This endpoint doesn't have any parameters.

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {} }

data

A list of ReachFrequencyPrediction nodes.

paging

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

Validation Rules

ErrorDescription
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
100Invalid parameter

Creating

Example

You can make a POST request to reachfrequencypredictions edge from the following paths:
When posting to this edge, a ReachFrequencyPrediction will be created.

Parameters

NameDescription
budget
int64

Expected lifetime budget in cents in the currency for the ad account. Must be greater than the default budget limit.

campaign_group_id
numeric string or integer

The id of the campaign which this prediction belongs to

day_parting_schedule
list<Object>

Ad set schedule, representing a delivery schedule for a single day

Example:
[{"start_minute":360,"end_minute":1440,"days":[0,1,2,3,4,5,6]}]

- Day part should be same for all week days.
- At least 3 hours of delivery each day.

start_minute
int64

A 0 based minute of the day representing when the schedule starts

Required
end_minute
int64

A 0 based minute of the day representing when the schedule ends

Required
days
list<int64>

Array of ints representing which days the schedule is active. Valid values are 0-6 with 0 representing Sunday, 1 representing Monday, ... and 6 representing Saturday.

Required
destination_id
int64

The ID of the Page or the ID of the app which the ad promotes. [Using the correct advertiser Page or app ID will make your predictions more accurate. Reach and cost predictions for feed are specific to a given ID, as they take into account other ads running from the same Page, as well as the past creative quality of ads from the Page (which impacts cost).]. If the ad set has desktopfeed or mobilefeed placement, either specify destination_id or pass app or page id in destination_ids field. Using destination_ids is recommended.

destination_ids
list<numeric string or integer>

Array of ID's of the Facebook Page or App which the ad promotes. Also the Instagram account id if instagramstream placement is used. However, if the objective is MOBILE_APP_INSTALLS, only the app id is needed here. Do not provide Instagram account id even if instagramstream placement is used.

end_time
int64

Same as stop_time.

frequency_cap
int64

If interval_frequency_cap_reset_ period is specified, this field represents the frequency cap to be set for a custom period, such as show ad 3 times per user every 48 hours.
However when you read the values back, this represents the lifetime frequency cap for the campaign duration and a separate read-only field, interval_frequency_cap provides the frequency cap value originally set for the custom period.
If interval_frequency_cap_reset_period is not specified, this field represents the lifetime frequency cap, set for the campaign duration.

interval_frequency_cap_reset_period
int64

Custom period (in hours expressed as multiples of 24) to reset frequency cap. For example, to show ad no more than 3 times every 48 hours, reset period should be set to 48 (hours) and frequency_cap should be set to 3. Implemented using a rolling window.

num_curve_points
int64

How many grid points to return from the curve.
If the value is not specified, the default value (800) is used.
If the value is larger than 800 then 800 will be used.

objective
string
Default value: REACH

Objective of your reach and frequency campaign. This is used to better inform the optimized bid based on your objective. This will not modify the objective set at the ad campaign level. Of all possible ad objectives, only these values are allowed in Facebook R&F campaigns: BRAND_AWARENESS, POST_ENGAGEMENT, MOBILE_APP_INSTALLS, LINK_CLICKS, CONVERSIONS, REACH, and VIDEO_VIEWS. All of them except CONVERSIONS can be supported for R&F campaigns on Instagram.

prediction_mode
int64

0 to create a prediction of budget based on expected reach (reach value must be provided),
1 to create a prediction of reach based on expected budget (budget value must be provided).

reach
int64

The desired reach of the set, must be at least the minimum reach for the target country, 1,000,000 in most cases

rf_prediction_id_to_share
numeric string or integer

ID of a previously created prediction. The new prediction will also use the audience from the given prediction.

start_time
int64

Unix timestamp for the set start time.

stop_time
int64

Unix timestamp for the set stop time. Must be no greater than 8 weeks ahead of the current time and should end after 6AM on the last day in ad account timezone.

story_event_type
int64

Whether or not to include mobile devices that cannot display different ad formats.
Use 256 to run canvas ads
Use 128 to run video ads
Use 0 if you do not include video or canvas ads

If you include both canvas and video, set to 384 (256 + 128).
Note: You can not create video ads if you set this flag to 0 during prediction. You can create non-video ads if the flag is set to 128. Required if you target all mobile devices.
You cannot create canvas ads if this flag is set to 0 during prediction. However, you can create non-canvas ads even the flag is set to 256.

target_spec
Targeting object

Targeting spec for reach and frequency prediction. Please note that
- You cannot use rightcolumn together with any feed for placement.
- You cannot specify more than one country.
- Providing minimal iOS version for user_os is not supported.
- The followings are not supported: friends_of_connection, Website Custom Audiences and Audience network.
- The length of JSON serialized API targeting spec should not exceed 75,000 characters.

Return Type

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}

Validation Rules

ErrorDescription
2625The request for a reach frequency campaign is invalid.
100Invalid parameter
2628There is an error in updating the state for the given prediction.
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

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.