ORs combinations together. Learn more about core or basic targeting.flexible_spec, you must also provide one of the following under targeting:geo_locations (geographical targeting field from country, region, city, zip)custom_audiencesproduct_audience_specsdynamic_audience_idscurl -X POST \
-F 'name=My AdSet' \
-F 'optimization_goal=REACH' \
-F 'billing_event=IMPRESSIONS' \
-F 'bid_amount=2' \
-F 'daily_budget=1000' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'targeting={
"geo_locations": {"countries":["US"]},
"user_device": ["Galaxy S6","One m9"],
"user_os": ["android"]
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
user_device.| Field | Description |
|---|---|
user_ostype: array | Required. One or more values from OS option table below. Possible values are at Targeting Search API with type=adTargetingCategory and class=user_os. You cannot target the minimum version of one platform with the other platform. However you can target both platforms without specifying minimal versions of either.Valid:
Invalid:
|
user_devicetype: array | Optional. Devices must match the value in user_os. Get possible values at Targeting Search API with type=adTargetingCategory and class=user_device. |
excluded_user_devicetype: array | Optional. Devices to exclude. Devices must match the value in user_os. Get possible values at Targeting Search API with type=adTargetingCategory and class=user_device. |
wireless_carriertype: array | Optional. Allowed value is Wifi. Target mobile users currently on wifi networks. |
| Field | Description |
|---|---|
iOStype: string | iOS devices, including iPhone, iPad, and iPod |
iOS_ver_x.x_and_abovetype: string | iOS devices running OS version x.x and above.
Options: 2.0, 3.0, 4.0, 4.3, 5.0, 6.0, 7.0, 8.0, 9.0.
Example: iOS_ver_4.0_and_aboveFor Meta App Ads:
|
iOS_ver_x.x_to y.ytype: string | iOS devices running OS versions x.x to y.y.
Options: 2.0, 3.0, 4.0, 4.3, 5.0, 6.0, 7.0, 8.0, 9.0. Example: iOS_ver_8.0_to_9.0, where x.x must be less than y.y |
Androidtype: string | Android devices |
Android_ver_x.x_and_abovetype: string | Android devices running version x.x and above.
Options: 2.0, 2.1, 2.2, 2.3, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2., 4.3, 4.4, 5.0, 5.1, 6.0, 7.0, 7.1, and 8.0. Example: Android_ver_4.0_and_above |
Android_ver_x.x_to y.ytype: string | Android devices running versions x.x to y.y.
Options: 2.0, 2.1, 2.2, 2.3, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2., 4.3, 4.4, 5.0, 5.1, 6.0, 7.0, 7.1, and 8.0. Example: Android_ver_4.2_to_8.0, where x.x must be less than y.y |
life_events:curl -G \
-d 'type=adTargetingCategory' \
-d 'class=life_events' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/search
targeting_spec:curl -X POST \
-F 'name="My First AdSet"' \
-F 'daily_budget=10000' \
-F 'bid_amount=300' \
-F 'billing_event="IMPRESSIONS"' \
-F 'optimization_goal="REACH"' \
-F 'campaign_id="<AD_CAMPAIGN_ID>"' \
-F 'promoted_object={
"page_id": "<PAGE_ID>"
}' \
-F 'targeting={
"facebook_positions": [
"feed"
],
"age_max": 24,
"age_min": 20,
"behaviors": [
{
"id": 6002714895372,
"name": "All travelers"
}
],
"device_platforms": [
"mobile"
],
"genders": [
1
],
"geo_locations": {
"countries": [
"US"
],
"regions": [
{
"key": "4081"
}
],
"cities": [
{
"key": 777934,
"radius": 10,
"distance_unit": "mile"
}
]
},
"interests": [
{
"id": "<INTEREST_ID>",
"name": "<INTEREST_NAME>"
}
],
"life_events": [
{
"id": 6002714398172,
"name": "Newlywed (1 year)"
}
],
"publisher_platforms": [
"facebook",
"audience_network"
]
}' \
-F 'status="PAUSED"' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
curl \
-F 'name=My AdSet' \
-F 'optimization_goal=REACH' \
-F 'billing_event=IMPRESSIONS' \
-F 'bid_amount=2' \
-F 'daily_budget=1000' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'targeting={
"age_max": 43,
"age_min": 18,
"genders": [1],
"geo_locations": {
"regions": [{"key":"3847"}],
"cities": [
{
"key": "2430536",
"radius": 12,
"distance_unit": "mile"
}
]
},
"interests": [{"id":6003139266461,"name":"Movies"}],
"relationship_statuses": [
2,
3,
4
]
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
| Name | Description |
|---|---|
relationship_statusestype: array | Array of integers representing relationship status. 1: single2: in_relationship3: married4: engaged6: not specifiedDefault: ALL, if you specify Null or do not provide a value.Restrictions: Do not use 0. |
life_eventstype: array | Array of objects with ‘id’ and optional ‘name’ fields: [{'id': 123, 'name': 'foo'}, {'id': 456}, 789] |
industriestype: array | Array of objects with ‘id’ and optional ‘name’ fields |
incometype: array | Array of objects with ‘id’ and optional ‘name’ fields |
family_statusestype: array | Array of objects with ‘id’ and (optional) ‘name’ fields |
| Name | Description |
|---|---|
education_schoolstype: array | Schools, colleges, and institutions.
Limit: 200 education schools. Example: [{id: 105930651606, 'name': 'Harvard University'}, {id: 105930651607}, 105930651608] |
education_statusestype: array | Array of integers to target based on education level. 1: HIGH_SCHOOL2: UNDERGRAD3: ALUM4: HIGH_SCHOOL_GRAD5: SOME_COLLEGE6: ASSOCIATE_DEGREE7: IN_GRAD_SCHOOL8: SOME_GRAD_SCHOOL9: MASTER_DEGREE10: PROFESSIONAL_DEGREE11: DOCTORATE_DEGREE12: UNSPECIFIED13: SOME_HIGH_SCHOOL |
college_yearstype: array | Array of integers. College graduation
Limit: Earliest year allowed is 1980 |
education_majorstype: array | Majors.
Example: [{'id': 123, 'name': 'Computer Science'}, {'id': 456}, 789]Limit: 200 |
work_employerstype: array | Company, organization, or workplace Example: [{'id':'50431654','name':'Microsoft'}, {'id':50431655}, 50431656]Limit: 200 |
work_positionstype: array | Self-declared work. Example: [{'id':105763692790962, 'name':'Contractor'}, {'id':105763692790963}, 105763692790964]Limit: 200 |
custom_audiences and 500 custom audiences in excluded_custom_audiences.excluded_custom_audiences in targeting_specs is different than excluded_custom_audiences in APP_COMBINATION Custom Audience.| Field | Description |
|---|---|
custom_audiencestype: array | Array of audience IDs or audience objects. 'id' field only: [123, 456] or [{'id': 123}, {'id': 456}] |
excluded_custom_audiencestype: array | Array of audience IDs or audience objects. 'id' field only: [123, 456] or [{'id': 123}, {'id': 456}] |
targeting:{
"geo_locations":{
"countries":["US"],
},
"age_min":25,
"age_max":40,
"custom_audiences":[{"id":6004192254512}]}
"excluded_custom_audiences":
[{"id":6004192252847}],
}
| Field | Description |
|---|---|
localestype: array | Locales, see Targeting Search, Locales. Indices in a sub-array ‘locales’. Target Accounts Center accounts with language other than common language for a location. Provide an ID for the language, such as 5 for German. Limit: 50. See mapping of virtual ‘locales’ to language sets at Targeting Search, Locale with type=adlocale. |
geo parameter under individual_setting in targeting_automation to 1.geo parameter under individual_setting in targeting_automation to 0."targeting": { "age_range": [25, 35], "geo_locations": { "countries": ["GB"], "cities": [{"key":"2430536", "radius":12, "distance_unit":"mile"}] }, "targeting_automation": { "individual_setting": { "geo": 1 } } }
geo_locations field).curl -X POST \
-F 'name="advantage audience test"' \
-F 'is_autobid="true"' \
-F 'daily_budget="100"' \
-F 'billing_event="IMPRESSIONS"' \
-F 'campaign_id="<CAMPAIGN_ID>"' \
-F 'targeting={
"age_range": [25,35],
"geo_locations":
{
"cities": [{"key":"2430536","radius":12,"distance_unit":"mile"}]
},
"targeting_automation": {"individual_setting": {"geo": 1 } }}' \
-F 'access_token="<ACCESS_TOKEN>"' \
https://facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
individual_setting parameter in the targeting_automation field. This setting will also be returned when retrieving the ad set, if it exists for the adset.OUTCOME_SALES and APP_INSTALLS objectives.age parameter under individual_setting in targeting_automation to 1. Then, include the age_range field in your audience specification.{ "geo_locations": { "countries": [ "US" ] }, "age_min": 18, "age_range": [25, 35], "targeting_automation": { "individual_setting": { "age": 1 } } }
gender parameter under individual_setting in targeting_automation to 1.{ "geo_locations": { "countries": [ "US" ] }, "age_min": 21, "genders":[1], "targeting_automation": { "individual_setting": { "gender": 1 } } }
curl -X POST \
-F 'name="advantage audience test"' \
-F 'is_autobid="true"' \
-F 'daily_budget="100"' \
-F 'billing_event="IMPRESSIONS"' \
-F 'campaign_id="<CAMPAIGN_ID>"' \
-F 'promoted_object={"pixel_id": "<PIXEL_ID>","custom_event_type": "PURCHASE"}' \
-F 'targeting={
"age_min": 18,
"age_range": [25,35],
"genders":[1],
"geo_locations": {
"countries": ["US"]
},
"targeting_automation": {"individual_setting": {"age": 1, "gender": 1 } }}' \
-F 'access_token="<ACCESS_TOKEN>"' \
https://facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
{ "id": "<AD_SET_ID>", }
curl -X GET \
-d 'fields="targeting"' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/<AD_SET_ID>/
{ "targeting": { "age_max": 65, "age_min": 19, "age_range": [ 25, 35 ], "genders": [ 1 ], "geo_locations": { "countries": [ "US" ], "location_types": [ "home", "recent" ] }, "targeting_relaxation_types": { "lookalike": 0, "custom_audience": 0 }, "targeting_automation": { "advantage_audience": 0, "individual_setting": { "age": 1, "gender": 1 } } }, "id": "<AD_SET_ID>", }
curl \
-F 'name=My AdSet' \
-F 'optimization_goal=REACH' \
-F 'billing_event=IMPRESSIONS' \
-F 'bid_amount=2' \
-F 'daily_budget=1000' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'targeting={
"geo_locations": {"countries":["US"]},
"user_adclusters": [
{"id":6002714885172,"name":"Cooking"},
{"id":6002714898572,"name":"Small Business Owners"}
]
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
curl \
-F 'name=My AdSet' \
-F 'optimization_goal=REACH' \
-F 'billing_event=IMPRESSIONS' \
-F 'bid_amount=2' \
-F 'daily_budget=1000' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'targeting={
"geo_locations": {"countries":["US"]},
"relationship_statuses": [2],
"user_adclusters": [{"id":6002714886772,"name":"Food & Dining"}]
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
| Name | Description |
|---|---|
user_adclusterstype: array | Array of ID-name pairs for BCT clusters. See below for information on retrieving BCT’s. Limit: 50 ID-name pairs. |
HTTP GET:https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/broadtargetingcategories
| Name | Description |
|---|---|
idtype: long | ID of broad category is used for ad targeting spec |
nametype: string | Name of broad category |
parent_categorytype: string | Parent category of broad category |
size_lower_boundtype: int | Lower bound audience size of broad category |
size_upper_boundtype: int | Upper bound audience size of broad category |
typetype: int | 6=BCT |
type_nametype: string | BCT |