With Targeting Search, you can find targeting with one targeting type in a single API call. With the Detailed Targeting API, you can search for multiple targeting types in a single request at the same time. You can also get suggestions based on your query.
The API has four endpoints: Search, Suggestions, Browse, and Validation.
The response for these endpoints contains the following:
Name | Description |
---|---|
type: string | Target audience ID |
type: string | Name of the target audience |
integer | Estimated lower bound target audience size |
integer | Estimated upper bound target audience size |
type: array of strings | Includes the category and any parent categories the targeting falls into |
type: string | A short description about target audience |
If you do not provide limit_type
, we filter results with less than 2000 people into four categories: work_employers
, work_positions
, education_majors
, education_schools
. Otherwise you get less meaningful results. When you use limit_type
we filter for one of those four categories and will not return everything.
Retrieve target audiences for your ads that match your search query. You can provide the following parameters at this endpoint:
curl -G \ -d "q=harvard" \ -d "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/targetingsearch
Name | Description |
---|---|
type: string | Required. Query string |
type: integer | Optional. Number of results |
type: string | Optional. Limit the type of audience to retrieve. Default to all types. Valid values:
|
type: string | Optional. The locale to display audience names and descriptions, if available. Default to ad account's locale |
Returns additional audiences you can target based on a few selected audiences you provide.
curl -G \ -d "targeting_list=[{'type':'interests','id':6003263791114}]" \ -d "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/targetingsuggestions
Provide these parameters:
Name | Description |
---|---|
type: Array of | Required. Array of |
type: integer | Optional. Number of results. Default is 30. Maximum is 45. |
type: string | Optional. Limit the type of audience to retrieve. Default to all types Valid values:
|
type: string | Optional. The locale to display audience names and descriptions. Default to ad account's locale |
Get targeting in a structured taxonomy for Facebook categories, third party data providers and some interests. Results from this endpoint appear in the Browse functionality in Detailed Targeting UI component in Ads Manager.
curl -G \ -d "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/targetingbrowse
Provide the following optional parameters:
Name | Description |
---|---|
type: string | Limit the type of audience to retrieve. Default to all types. |
type: string | The locale to display audience names and descriptions. Default to ad account's locale |
Verify whether an audience is valid for targeting or not. This is helpful if you already created an ad set and want to verify its targeting spec is still valid. If the targeting is not valid, you should delete it from the targeting spec.
curl -G \ -d "targeting_list=[{'type':'interests','id':6003283735711}, {'type':'relationship_statuses','id':100}]" \ -d "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/targetingvalidation
In addition to the standard Detailed Targeting response fields, this endpoint also returns:
Name | description |
---|---|
type: boolean | Whether the targeting audience is valid or not |
Here is the list of input parameters:
Name | Description |
---|---|
type: Array of | Array of |
type: array of strings | Array of IDs for validation. Succeeds only if an ID is uniquely identifiable in our audience database |
type: array of strings | Array of Strings for validation. Interests only, case insensitive |
type: string | Locale to display audience names and descriptions. Defaults to ad account's locale |
Provide at least one of the following: targeting_list
, id_list
, and name_list
.