Back

Facebook Marketing API Essential Guide

Aug 7, 20246 minute read

What type of API does Facebook Marketing provide?

Based on the search results, Facebook Marketing API uses GraphQL as its API type. Here are the key points:

GraphQL API

  • Facebook originally developed GraphQL to simplify endpoint management for REST-based APIs.

  • GraphQL provides a single endpoint that can handle complex queries and return only the specific data requested.

  • It allows clients to request exactly the data they need in a single request, which can be more efficient than REST APIs in some cases.

  • GraphQL APIs are good for scenarios where the client needs to request complex or customized data from the server.

Key Advantages of GraphQL for Facebook Marketing API

  • Flexibility: Allows clients to request only the data they need, reducing over-fetching of data.

  • Efficiency: Can retrieve complex, nested data in a single request instead of multiple API calls.

  • Evolving API: Easier to add new fields and types without versioning the entire API.

  • Detailed error messages: Provides specific error information for troubleshooting.

Considerations

  • While powerful, GraphQL can be more complex to implement and maintain compared to REST APIs.

  • It requires specialized server and client libraries to use effectively.

  • Performance issues can occur with very complex nested queries.

In summary, Facebook chose GraphQL for its Marketing API to provide a flexible, efficient, and evolving API that can handle the complex data requirements of marketing applications while allowing clients to request precisely the data they need.

Does the Facebook Marketing API have webhooks?

Yes, the official Facebook Marketing API does have webhooks. Here are the key points about webhooks in the Facebook Marketing API:

Webhook Availability

  • Webhooks are available for certain Marketing API features, particularly for Lead Ads.

Types of Events

While the search results don't provide an exhaustive list specifically for Marketing API webhooks, they do mention:

  1. Lead Ads webhooks - These allow you to receive notifications when new leads are generated through Lead Ads.

  2. Ad approval events - While not explicitly stated, there is interest in webhooks for ad approval events, suggesting this may be a use case.

General Webhook Events

The Facebook platform offers webhooks for various objects and events, including:

  • message_deliveries
  • message_echoes
  • message_edits
  • message_reactions
  • message_reads
  • messages
  • messaging_account_linking
  • messaging_feedback
  • messaging_game_plays
  • messaging_handovers
  • messaging_optins
  • messaging_policy_enforcement
  • messaging_postbacks
  • messaging_referrals
  • messaging_seen
  • send_cart
  • standby

Key Considerations

  • Webhooks require setting up an HTTPS endpoint on your server.
  • You need to configure the Webhooks product in your app dashboard.
  • Permissions are required to receive webhook notifications for certain object types.
  • Apps in development mode have limitations on webhook notifications.

While the search results don't provide complete details specifically for Marketing API webhooks, they do confirm their existence, particularly for Lead Ads. For the most up-to-date and comprehensive information on Marketing API webhooks, it's recommended to consult the official Facebook Marketing API documentation.

Rate Limits and other limitations

Here are the key points about the API rate limits for the Facebook Marketing API:

  1. The Marketing API has its own rate limiting logic separate from the Graph API rate limits.

  2. Rate limiting is applied at the ad account level.

  3. There are different tiers of access with different rate limits:

    • Development tier:

      • Maximum score of 60
      • Decays in 300 seconds
      • Blocked for 300 seconds when limit reached
    • Standard tier:

      • Maximum score of 9000
      • Decays in 300 seconds
      • Blocked for 60 seconds when limit reached
  4. Each API call is assigned a score - generally 1 point for read calls and 3 points for write calls.

  5. There are specific rate limits for different business use cases:

    • Ads Management: (100,000 for Standard tier or 300 for Dev tier) + 40 * Number of active ads per hour

    • Custom Audiences: Up to 700,000 per hour

    • Ads Insights: (190,000 for Standard tier or 600 for Dev tier) + 400 * Number of active ads per hour

    • Catalog Management: 20,000 + 20,000 * log2(unique users) per hour

  6. There are additional limits on things like changing account spending limits (10 times per day) and ad set budgets (4 times per hour).

  7. Rate limits can also be impacted by total CPU time and wall time usage.

  8. To increase rate limits, you can apply for Advanced Access to the Ads Management Standard Access feature.

  9. The API provides headers with usage information to help track rate limit consumption.

  10. Implementing strategies like batching requests and using asynchronous requests can help optimize usage within the rate limits.

The specific limits can change, so it's recommended to check the official documentation for the most up-to-date information. Proper error handling and backoff strategies are important when working with these rate limits.

Latest API Version

The most recent version of the Facebook Marketing API is v20.0 [3][5].

Key points to consider:

  • The latest version v20.0 was introduced on May 21, 2024 [5].

  • Facebook regularly releases new versions of their Marketing API, with the previous version v19.0 introduced on January 23, 2024 [5].

  • Each version has an availability period. For example, v19.0 will be available until February 4, 2025 [5].

  • Developers are encouraged to upgrade to the latest version to access new features and improvements [3].

Best practices:

  1. Stay updated with the latest changes by regularly checking the Marketing API changelog [3][5].

  2. Plan for version upgrades in advance, as older versions eventually become deprecated [5].

  3. Test your integrations thoroughly when upgrading to a new API version [3].

  4. Familiarize yourself with Facebook's core advertising concepts before using the Marketing API [3].

  5. Utilize resources like Meta Blueprint, Developer Community Forums, and the Meta for Developers Facebook Page for additional support and updates [3].

How to get a Facebook Marketing developer account and API Keys?

To get a developer account for Facebook Marketing and create an API integration, you need to follow these steps:

1. Create a Facebook Developer Account

  1. Go to the Facebook for Developers website (https://developers.facebook.com/)
  2. Click on "Get Started" or "Log In" if you already have a Facebook account
  3. Follow the prompts to set up your developer account

2. Create a Facebook App

  1. Go to the Facebook for Developers dashboard
  2. Click on "Create App"
  3. Choose the app type (e.g., "Business" for marketing purposes)
  4. Fill in the required information and create your app

3. Set Up Marketing API Access

  1. In your app dashboard, go to "Add Products"
  2. Find and add the "Marketing API" product
  3. Follow the setup instructions provided

4. Obtain Necessary Permissions

  1. Review the permissions required for your intended API usage
  2. Apply for any necessary permissions through the app review process

5. Generate Access Tokens

  1. Go to the "Tools" section in your app dashboard
  2. Use the Graph API Explorer or Access Token Tool to generate the required tokens

What can you do with the Facebook Marketing API?

I apologize, but it seems there was an issue with the search results provided. The link you shared appears to be broken or inaccessible. However, I can still provide you with information about the data models you can interact with using the Facebook Marketing API based on my knowledge. Please note that this information might not be the most up-to-date, as Facebook's API can change over time.

Here's a list of key data models you can typically interact with using the Facebook Marketing API, along with what's possible for each:

Ad Account

  • Retrieve account information
  • Manage account settings
  • Access billing information
  • View and manage account users and roles

Campaigns

  • Create, read, update, and delete campaigns
  • Set campaign objectives
  • Manage campaign budgets and schedules
  • Retrieve campaign performance metrics

Ad Sets

  • Create, read, update, and delete ad sets
  • Define targeting options (demographics, interests, behaviors)
  • Set budgets and bidding strategies
  • Schedule ad set run times
  • Manage placements

Ads

  • Create, read, update, and delete ads
  • Upload ad creatives (images, videos, carousel ads)
  • Set ad copy and headlines
  • Define call-to-action buttons
  • Retrieve ad performance metrics

Audiences

  • Create and manage custom audiences
  • Create and manage lookalike audiences
  • Upload customer lists for audience creation
  • Create website custom audiences based on pixel data

Pixels

  • Create and manage Facebook pixels
  • Retrieve pixel firing data
  • Set up pixel events and parameters

Insights

  • Retrieve performance data for accounts, campaigns, ad sets, and ads
  • Access metrics such as impressions, clicks, conversions, and ROI
  • Generate custom reports with specific metrics and breakdowns

Creative Assets

  • Upload and manage images and videos
  • Create and manage ad templates
  • Access the Ad Creative API for dynamic ad creation

Business Manager

  • Manage business settings and information
  • Add and remove users and assign roles
  • Link and unlink ad accounts and pages

Pages

  • Retrieve page information and insights
  • Manage page posts and content
  • Access page engagement metrics

Remember that the exact capabilities and data models available may vary depending on your access level and any recent updates to the Facebook Marketing API. It's always best to consult the official Facebook Marketing API documentation for the most current and detailed information.