The Marketing API offers endpoints to manage audiences and analyze advertising campaign insights. Understanding these endpoints and their functionalities is important for both new and experienced developers looking to optimize their advertising strategies.
customaudiences
endpointThe customaudiences
endpoint allows you to create and manage custom and lookalike audiences, tailoring ads to specific user segments based on demographics, interests, and behaviors.
Example API Request
curl -X POST \
https://graph.facebook.com/v21.0
/act_<AD_ACCOUNT_ID>/customaudiences \
-F 'name=My Custom Audience' \
-F 'subtype=CUSTOM' \
-F 'access_token=<ACCESS_TOKEN>'
insights
endpointThe insights
endpoint provides valuable analytics about the performance of campaigns, ad sets, and ads, allowing you to track key metrics such as impressions, clicks, and conversions.
Example API Request
curl -X GET \
https://graph.facebook.com/v21.0
/act_<AD_ACCOUNT_ID>/insights \
-F 'fields=impressions,clicks,spend' \
-F 'time_range={"since":"2023-01-01","until":"2023-12-31"}' \
-F 'access_token=<ACCESS_TOKEN>'