Back

Facebook Custom Audiences API Essential Guide

Aug 2, 20246 minute read

What type of API does Facebook Custom Audiences provide?

Facebook Custom Audiences uses a REST API as part of the broader Facebook Marketing API. The API provides various endpoints for managing Custom Audiences, such as creating, updating, and deleting audiences. It typically uses JSON for request and response payloads. Access to the API requires authentication using an access token, which can be obtained through the Facebook Login process or by creating an app on the Facebook Developers platform. Facebook regularly updates its API, and different versions may have slight differences in functionality or syntax.

Does the Facebook Custom Audiences API have webhooks?

The Facebook Custom Audiences API does not have dedicated webhooks for Custom Audiences events. However, Facebook offers webhooks for other related features within its advertising ecosystem.

Key points:

  1. Custom Audiences API: Allows advertisers to manage custom audiences programmatically, but doesn't provide direct webhook functionality.

  2. Marketing API Webhooks: Available for various advertising-related events, though not specifically for Custom Audiences.

  3. Available webhook events include:

    • Ad account updates
    • Campaign updates
    • Ad set updates
    • Ad creative updates
  4. Business Manager webhooks: Provided for Business Manager events, which may be relevant for some advertising-related use cases.

Best practices:

  1. Consider implementing a polling mechanism using the Custom Audiences API for real-time updates.

  2. Explore Marketing API webhooks for events that could indirectly provide useful information for Custom Audiences-related workflows.

  3. Regularly check Facebook's documentation for the most up-to-date information on APIs and features.

While the Facebook Custom Audiences API doesn't offer direct webhook functionality, other webhook options within Facebook's advertising ecosystem might be useful depending on specific needs.

Rate Limits and other limitations

The Facebook Custom Audiences API, which is part of the broader Facebook Marketing API, has specific rate limits to ensure fair usage and system stability. Here are the key points regarding the API rate limits for Custom Audiences:

  1. General API Rate Limit:

    • The Facebook Marketing API has a general rate limit of 200 calls per hour per app per ad account.
  2. Custom Audience-specific Limits:

    • For Custom Audience creation and management, there are additional limits in place:
      • You can create up to 500 Custom Audiences per ad account.
      • You can add up to 10,000 users per request when adding users to a Custom Audience.
  3. Throttling:

    • Facebook implements throttling to prevent excessive API usage. If you exceed the rate limits, your requests may be temporarily blocked or slowed down.
  4. Error Handling:

    • When you reach the rate limit, the API will return an error response with a status code of 17 (User request limit reached) or 4 (Application request limit reached).
  5. Best Practices:

    • Implement proper error handling in your code to catch rate limit errors and implement appropriate retry logic.
    • Use batch requests when possible to reduce the number of API calls.
    • Monitor your API usage to ensure you stay within the limits.
  6. Increasing Limits:

    • In some cases, you may be able to request an increase in your rate limits by contacting Facebook support or through your Facebook representative.

It's important to note that these limits may change over time, and Facebook may apply different limits based on various factors such as app performance and compliance with policies. Always refer to the official Facebook Marketing API documentation for the most up-to-date information on rate limits and best practices for API usage.

Latest API Version

The most recent version of the Facebook Custom Audiences API is version 18.0, which was released on October 3, 2023.

Key points to consider:

  • Facebook regularly updates its APIs, including the Custom Audiences API, to improve functionality and security.
  • Version 18.0 is the latest stable release as of the current date.
  • It's important to note that Facebook typically maintains support for older API versions for a certain period, but developers are encouraged to use the most recent version for the best features and performance.

Best practices:

  • Always check the official Facebook for Developers documentation for the most up-to-date information on API versions and changes.
  • When implementing the Custom Audiences API, ensure you're using the latest version to take advantage of new features and improvements.
  • Keep your integration updated to avoid potential issues when older versions are deprecated.
  • Subscribe to Facebook's developer newsletter or follow their official channels to stay informed about upcoming changes and new releases.

It's worth noting that while version 18.0 is the most recent stable release, Facebook may introduce new versions or updates in the future. Always refer to the official documentation for the most current information on API versions and their features.

How to get a Facebook Custom Audiences developer account and API Keys?

  1. Create a Facebook Developer Account:

    • Go to the Facebook Developers website https://developers.facebook.com
    • Click on "Get Started" or "Log In" if you already have an account
    • Follow the prompts to set up your developer account
  2. Create a Facebook App:

    • Once logged in, click on "My Apps" in the top menu
    • Click "Create App"
    • Choose the app type (e.g., "Business" for Custom Audiences)
    • Fill in the required information and create your app
  3. Set up Facebook Business Manager:

    • If you haven't already, create a Business Manager account at https://business.facebook.com
    • Add your Facebook app to your Business Manager account
  4. Configure App Settings:

    • In your app dashboard, go to "Settings" > "Basic"
    • Fill in all required fields, including privacy policy URL and app icon
  5. Add Marketing API:

    • In your app dashboard, click on "Add Product"
    • Find and add the "Marketing API" product
  6. Request Access to Custom Audiences:

    • In your app settings, go to "App Review"
    • Request permissions for "ads_management" and "ads_read"
    • You may need to provide additional information about your use case
  7. Generate Access Token:

    • Once approved, go to the "Tools" section in your app dashboard
    • Generate a long-lived access token for API calls
  8. Implement API Integration:

    • Use the Facebook Marketing API documentation to implement Custom Audiences functionality in your application

What can you do with the Facebook Custom Audiences API?

To answer your question about the data models you can interact with using the Facebook Custom Audiences API, I'll provide a list of bullet points covering the main data models and what's possible for each. Here's an overview:

Custom Audience

• Create new Custom Audiences based on various data sources • Update existing Custom Audiences • Delete Custom Audiences • Retrieve information about Custom Audiences • Add users to Custom Audiences • Remove users from Custom Audiences • Share Custom Audiences with other ad accounts or business managers • Create lookalike audiences based on existing Custom Audiences

Customer File

• Upload customer data (e.g., email addresses, phone numbers, names) to create or update Custom Audiences • Perform data hashing for privacy protection • Support various types of customer identifiers (e.g., email, phone, mobile advertiser ID) • Manage customer lifetime value (LTV) data

Website Traffic

• Create Custom Audiences based on website visitor data • Define rules for audience creation (e.g., visitors of specific pages, time spent on site) • Use Facebook Pixel data to create these audiences

App Activity

• Create Custom Audiences based on app user behavior • Define rules for audience creation (e.g., users who have completed specific in-app actions) • Utilize app event data for audience segmentation

Offline Activity

• Upload offline conversion data to create Custom Audiences • Match offline customer interactions with online profiles • Create audiences based on in-store purchases or other offline events

Engagement

• Create Custom Audiences based on user engagement with Facebook content • Include users who have interacted with your Facebook Page, Instagram profile, or ads • Define engagement types (e.g., video views, lead form submissions)

Lookalike Audience

• Create Lookalike Audiences based on existing Custom Audiences • Specify the size and location for Lookalike Audiences • Optimize Lookalike Audiences for specific conversion goals

Value-Based Audience

• Create audiences based on customer lifetime value (LTV) • Upload customer purchase history and value data • Use this data to create more targeted and valuable audiences

Audience Insights

• Retrieve demographic and interest data about your Custom Audiences • Analyze audience overlap between different Custom Audiences • Get estimated audience sizes for targeting options

Audience Sharing

• Share Custom Audiences with other ad accounts or business managers • Manage permissions for shared audiences • Control access to shared audiences

By utilizing these data models through the Facebook Custom Audiences API, advertisers can create highly targeted and effective advertising campaigns based on various data sources and user behaviors.