targeting spec, which contains ad set attributes defining who should see the ad.curl -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"]},
"industries": [{"id":6009003307783,"name":"Accounting and finance"}],
"life_events": [{"id":6003054185372,"name":"Recently Moved"}],
"relationship_statuses": [2,4]
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
| Name | Description |
|---|---|
genders
array
| Genders to target. Defaults to all. 1 targets males, 2 targets females. |
age_min
int
| Minimum age. Defaults to 18. If used, must be 13 or higher. If the app has custom settings for age restrictions, the app’s age restrictions will be used for ads with APP_INSTALL goals. For example, if you set age_min to 13 but your app’s age minimum is set to 18, 18 will be used in ads targeting. |
age_max
int
| Maximum age. If used, must be 65 or lower. |
user_age_unknown
boolean
| Includes people on WhatsApp whose age is unknown. Applies only to the WhatsApp Status placement Starting May 2026, if the WhatsApp Status placement is included and this field is not set, it defaults to true. Setting it to false allows businesses to exclude people on WhatsApp whose age is unknown. Businesses will be able to opt out of including people on WhatsApp whose age is unknown at any time. |
geo_locations to target locations, and optionally, excluded_geo_locations to exclude areas.country_groups for geo_locations to target broader geographic regions such as Europe or North America.radius can cause an error, code: 100, subcode 1815946, when targeting multiple locations. We recommend creating an ad for each location or not using radius in your call.| Name | Description |
|---|---|
countries
array
| Country targeting. Requires array of country codes, see Targeting Search, Countries. Example: 'countries': ['US'] |
regions
array
| State, province, or region. Available values, see Targeting Search, Regions. Limit: 200. Example: 'regions': [{'key':'3847'}] |
cities
array
| Specify key, radius & distance_unit. For key, see Targeting Search, Cities. radius is a distance around cities, from 10 to 50 miles or 17 to 80 kilometers. distance_unit is mile or kilometer. Limit: 250.Example: 'cities': [{'key':'2430536', 'radius':12, 'distance_unit':'mile'}] |
zips
array
| Target Zip Code, See targeting search API. Limit: 50,000 (formerly 2,500). If you provide more than 2,500, we create an array known as location_cluster which represents a set of zip codes.Example: 'zips':[{'key':'US:94304'},{'key':'US:00501'}]To read a location_cluster and see the locations targeted: GET /location_cluster_ID |
places
array
| Provide a specific place. Limit: 200. Example: "places":[{"key":129672430416115,"name":"SFO", "radius":10, "distance_unit":"mile"}] |
custom_locations
array
| Available for all objectives. Provide exact location in latitude and longitude or address as the center of an area. Also specify radius for your location from .63 to 50 miles, or 1 to 80 kilometers. distance_unit is miles or kilometers; default is mile. Limit: 200. PO Box alone is not supported in address_string. You must provide at minimum, a street address.Example: 'custom_locations':[{'address_string': '1601 Willow Road, Menlo Park, CA', 'radius': 5},{'latitude': 36, 'longitude': -121.0, 'radius': 5, 'distance_unit': 'kilometer'},] |
custom_locations.latitude
float
| Latitude of location |
custom_locations.longitude
float
| Longitude of location |
custom_locations.name
string
| Name for address. You can use with latitude and longitude values for geo location targeting without providing address_string |
custom_locations.radius
float
| Radius around latitude/longitude, in miles unless otherwise in distance_unit. From 0.63 to 50 miles, or 1 to 80 kilometers. |
custom_locations.distance_unit
string
| Optional. kilometer or mile; default mile |
custom_locations.address_string
string
| Address at latitude/longitude, such as 1601 Willow Rd, Menlo Park, CA. Suggested format: street number street name, city, state/province, country. Exclude postal codes. |
geo_markets
array
| Geomarkets using DMA and/or Comscore Markets. Limit: 2500. Example: 'geo_markets':[{'key': 'DMA:501', 'name': 'New York'},{'key': COMSCORE_MARKET:2001', 'name': 'New York, NY'}, {'key': 'DMA:543', 'name': 'Springfield-Holyoke'},] |
electoral_district
array
| Key for electoral districts. Get districts at Targeting Search, Electoral. Example: 'electoral_districts':[{'key':'US:AK00'},{'key':'US:CA01'},{'key':'US:NY14'}] |
location_types
array
| The array ['home', 'recent'] is the only option available. If no location_types array is provided, it will default to ['home', 'recent'].
|
country_groups
array
| Global geographical regions and free trade areas. See Targeting Search, Country Groups. Provide array of country group codes:
Example: 'country_groups': ['asia','mercosur'] |
curl -X POST \ -F 'name="My Reach Ad Set"' \ -F 'optimization_goal="REACH"' \ -F 'billing_event="IMPRESSIONS"' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'targeting={ "geo_locations": { "countries": [ "US" ] }, "facebook_positions": [ "feed" ] }' \ -F 'status="PAUSED"' \ -F 'promoted_object={ "page_id": "<PAGE_ID>" }' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v24.0/act_<AD_ACCOUNT_ID>/adsets
curl -X POST \
-F 'name="My Reach Ad Set"' \
-F 'optimization_goal="REACH"' \
-F 'billing_event="IMPRESSIONS"' \
-F 'bid_amount=2' \
-F 'daily_budget=1000' \
-F 'campaign_id="<AD_CAMPAIGN_ID>"' \
-F 'targeting={
"excluded_geo_locations": {
"regions": [
{
"key": "3847"
}
]
},
"geo_locations": {
"countries": [
"US"
]
},
"facebook_positions": [
"feed"
]
}' \
-F 'status="PAUSED"' \
-F 'promoted_object={
"page_id": "<PAGE_ID>"
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
curl -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":{
"zips":[{"key":"US:94304"},{"key":"US:00501"}]}
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
curl -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": {
"custom_locations": [
{"address_string":"1601 Willow Road, Menlo Park, CA","radius":"5"},
{
"latitude": "36",
"longitude": "-121.0",
"radius": "5",
"distance_unit": "kilometer"
}
],
"geo_markets": [
{"key":"DMA:501","name":"New York"},
{"key":"DMA:543","name":"Springfield-Holyoke"},
{"key":"COMSCORE_MARKET:2001","name":"New York, NY"},
{"key":"COMSCORE_MARKET:2051","name":"New Orleans, LA"}
],
"location_types": ["recent","home"]
}
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
curl -G \
-d 'location_types=["country"]' \
-d 'type=adgeolocation' \
-d 'q=japan' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/search
curl -G \
-d 'location_types=["region"]' \
-d 'type=adgeolocation' \
-d 'q=texas' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/search
curl -G \
-d 'location_types=["city"]' \
-d 'type=adgeolocation' \
-d 'q=menlo' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/search
genders and age as age_min and age_max.curl \
-F 'name=My First AdSet' \
-F 'daily_budget=10000' \
-F 'bid_amount=300' \
-F 'billing_event=IMPRESSIONS' \
-F 'optimization_goal=REACH' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'promoted_object={"page_id":"<PAGE_ID>"}' \
-F 'targeting={
"age_max": 24,
"age_min": 20,
"device_platforms": ["mobile"],
"genders": [1],
"geo_locations": {
"countries": ["JP"],
"regions": [{"key":"3886"}],
"cities": [
{
"key": "2420605",
"radius": 10,
"distance_unit": "mile"
}
]
},
"publisher_platforms": ["facebook","audience_network"]
}' \
-F 'status=PAUSED' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
custom_type to multi_city and define either country or country_group as described before.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": {
"custom_locations": [
{
"custom_type": "multi_city",
"min_population": 500000,
"max_population": 1000000,
"country": "BR"
},
{"custom_type":"multi_city","country_group":"Europe"}
],
"location_types": ["recent","home"]
}
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
| Name | Description |
|---|---|
min_population
int
| The minimum population threshold on which the cities are chosen for targeting. |
max_population
int
| The maximum population threshold on which the cities are chosen for targeting. |
curl -G \
-d 'type=adinterest' \
-d 'q=soccer' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/search
name and id to a targeting spec, where path is the path of this interest in ads tools.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="<CAMPAIGN_ID>"' \
-F 'promoted_object={
"page_id": "<PAGE_ID>"
}' \
-F 'targeting={
"facebook_positions": [
"feed"
],
"geo_locations": {
"countries": [
"US"
],
"regions": [
{
"key": "4081"
}
],
"cities": [
{
"key": 777934,
"radius": 10,
"distance_unit": "mile"
}
]
},
"genders": [
1
],
"age_max": 24,
"age_min": 20,
"publisher_platforms": [
"facebook",
"audience_network"
],
"device_platforms": [
"mobile"
],
"flexible_spec": [
{
"interests": [
{
"id": "<INTEREST_ID>",
"name": "<INTEREST_NAME>"
}
]
}
]
}' \
-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={
"geo_locations": {"countries":["US"]},
"interests": [
{"id":6003139266461,"name":"Movies"},
{"id":6003397425735,"name":"Tennis"},
{"id":6003659420716,"name":"Cooking"}
]
}' \
-F 'status=ACTIVE' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
| Name | Description |
|---|---|
interests
array
| Array with id and optional name fields:'interests':[{id: 6003139266461,
'name': 'Movies'}, {id: 6003139266462}, 6003139266463] |
Browse such as Frequent Travelers. See Targeting Search API.curl -G \
-d 'type=adTargetingCategory' \
-d 'class=behaviors' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/search
targeting spec:curl \
-F 'name=My First AdSet' \
-F 'daily_budget=10000' \
-F 'bid_amount=300' \
-F 'billing_event=IMPRESSIONS' \
-F 'optimization_goal=REACH' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'promoted_object={"page_id":"<PAGE_ID>"}' \
-F 'targeting={
"age_max": 24,
"age_min": 20,
"behaviors": [{"id":6002714895372,"name":"All frequent travelers"}],
"device_platforms": ["mobile"],
"genders": [1],
"geo_locations": {
"countries": ["JP"],
"regions": [{"key":"3886"}],
"cities": [
{
"key": "2420605",
"radius": 10,
"distance_unit": "mile"
}
]
},
"interests": [{"id":6003107902433,"name":"Association football (Soccer)"}],
"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 -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={
"facebook_positions": [
"feed"
],
"geo_locations": {
"countries": [
"US"
]
},
"behaviors": [
{
"id": 6007101597783,
"name": "Business Travelers"
},
{
"id": 6004386044572,
"name": "Android Owners (All)"
}
]
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adsets
| Name | Description |
|---|---|
behaviors
array
| Array with id and optional name fields:'behaviors':[{id: 6004386044572,
'name': 'Android Owners (All)'}, {id: 6004386044573}, 6004386044574] |