Comment on page
Facebook Marketing
Facebook custom audiences
- Base URL: https://graph.facebook.com/<VERSION>/
- Test Facebook Graph API Playground: https://developers.facebook.com/tools/explorer?method=GET&path=me%3Ffields%3Did%2Cname&version=v12.0
You need to know your Facebook User and Page IDs for a few actions, here is how to find them.
- 1.Go to the Facebook Business Integrations settings with the Facebook user you used to authenticate with Locoia
- 2.Click on View and edit next to the Locoia integration
- 3.Scroll to the very bottom to see your user ID.

Facebook User ID in integration settings
To find your page ID, you can follow the official Facebook instructions (here a direct link to your Facebook pages).
200 multiplied by 24 multiplied by the number of leads created in the past 30 days for the Facebook page.
You can find your Facebook ad account id on the page here. It is in the upper right or in the URL. You should replace it in the above URL with {{ ... }}. So a final URL can look like
https://graph.facebook.com/v11.0/act_1234567890/
followed by the endpoint, customaudience
The Data Processing Terms need to be accepted to upload custom audiences: https://business.facebook.com/ads/manage/customaudiences/tos/?act=1234567890
1234567890 has to be replaced with the respective account id.
For app builders: Any app needs at least the scopes
ads_management
to have access.curl -X POST \
-D '{
"name": "My new Custom Audience 1",
"subtype": "CUSTOM",
"description": "People who purchased on my website",
"customer_file_source": "USER_PROVIDED_ONLY"
}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {{ token }}' \
https://graph.facebook.com/v12.0/act_{{ my ad account id }}/customaudiences
curl -X POST \
-D '{
"payload": {
"schema": [ "MADID" ],
"data": [
[
"{{ my mobile device id }}"
],
[
"{{ my mobile device id }}"
]
]
},
"session": {
"session_id": "{{ some session id }}",
"batch_seq": 1,
"last_batch_flag": true,
"estimated_num_total": 2
}}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {{ token }}' \
https://graph.facebook.com/v12.0/{{ my audience id }}/users
If your JSON is malformatted, you will get this error: { "error": { "message" : "(#100) Invalid parameter", "type": "OAuthException", "code": 100,"fbtrace_id": "some id" } }
- Creating a Custom audience based on CRM or similar data - Customer File Custom Audiences. Creating manually as a user, can be found here https://www.facebook.com/adsmanager/audiences?act=xxxxxaccount_id&tool=AUDIENCES&nav_source=business_manager In order to make this endpoint work, you need to connect it with a business.
Last modified 1yr ago