Back

Facebook Lead Ads API Essential Guide

Jul 21, 20246 minute read

What type of API does Facebook Lead Ads provide?

Facebook's lead ads API uses the Graph API, which is a RESTful API.

The Graph API is the primary way to get data in and out of Facebook. It is a low-level HTTP-based API that can be used to retrieve new lead ads in real-time.

The API allows developers to retrieve leads as JSON objects, making it easy to integrate and map data.

Facebook provides multiple ways to retrieve leads through their API:

  1. Bulk read with the Graph API
  2. Webhooks for real-time updates
  3. Leads Center for managing and downloading leads

To use the API, developers need to set up a Facebook app, obtain proper permissions through App Review, and use access tokens for authentication.

The API supports integration with CRM systems, allowing leads to be instantly updated into a business's CRM.

Does the Facebook Lead Ads API have webhooks?

Yes, the Facebook Lead Ads API supports webhooks.

Webhooks Support

The official Facebook Lead Ads API supports webhooks.

Types of Events

Webhooks can be used to:

  • Receive leads in real-time
  • Get notified every time a new lead is submitted

How Webhooks Work for Lead Ads

  1. When a new lead is submitted through a lead ad, an update is sent to your specified endpoint.
  2. You can then fetch the lead information by accessing the Marketing API.

Key Points to Consider

  • Webhooks are recommended for CRM integration with Facebook to receive leads in real-time.
  • Using webhooks allows you to retrieve every new lead in real time, as opposed to bulk reading.
  • You'll need to set up an endpoint on your server to receive webhook notifications from Facebook.
  • You may need to go through Facebook's App Review process and obtain necessary permissions to access lead data.

Best Practices

  • Use Page access tokens instead of User access tokens for better rate limits.
  • Ensure your app is in Live mode to have access to all leads. Apps in Development mode have limited access.

Rate Limits and other limitations

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

Ad Account Level Business Use Case Rate Limits

  • Rate limiting is at the ad account level and quota is computed based on your app's ads API access tier.

  • For custom_audience:

    • Maximum of 700,000 calls per ad account in a one-hour period
    • Minimum of 190,000 calls if your app is in the Marketing API Standard tier
    • Minimum of 5,000 calls if your app is in the Dev tier
    • Plus 40 * Number of Active custom audiences
  • For ads_insights:

    • (190,000 if in Standard tier or 600 if in Dev tier) + 400 * Number of Active ads - 0.001 * User Errors
  • For Catalog Management:

    • 20,000 + 20,000 * log2(unique users) per ad account in a one-hour period
  • For Catalog Batch:

    • 200 + 200 * log2(unique users) per ad account in a one-hour period

Ad Account Level API-Level Limits

  • If your app is in the Marketing API development tier:

    • Maximum score of 60
    • Decays in 300 seconds
    • Blocked for 300 seconds when limit reached
  • If your app is in the Marketing API Standard tier:

    • Maximum score of 9000
    • Decays in 300 seconds
    • Blocked for 60 seconds when limit reached

Lead Retrieval Rate Limit

  • 200 * 24 * (number of leads created in past 90 days) per Facebook Page in a 24 hour period

Key Considerations

  • Rate limits are calculated separately from Graph API limits
  • Upgrading to Advanced Access of Ads Management Standard Access provides higher rate limits
  • Rate limit usage can be monitored via HTTP headers and the App Dashboard
  • Implement strategies like preventing burst traffic, optimizing requests, and using backoff when hitting limits

In summary, the rate limits for Facebook Lead Ads API vary based on the specific endpoint, your app's access tier, and factors like number of active ads/audiences. Carefully monitor usage and implement best practices to avoid hitting limits.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the Facebook Lead Ads API:

Latest Version

The most recent version of the Facebook Marketing API, which includes the Lead Ads functionality, is v20.0.

Key Points

  • The Marketing API is a collection of Graph API endpoints and other features used for advertising across Meta's family of apps (Facebook, Instagram, Messenger, and WhatsApp).

  • Lead Ads are part of the Marketing API and provide a way to capture leads through Facebook ads.

  • To access lead data, you need either Page Admin access or flexible permissions granted by the Page Admin.

Accessing Lead Data

  1. You can retrieve leads using the following methods:

    • Bulk read with the Graph API
    • Webhooks for real-time updates
    • Leads Center in Meta Business Suite
  2. To integrate with CRM systems, you can use:

    • CRM Partners supporting lead ads
    • Custom integration using Webhooks and the Graph API
  3. To use the Lead Ads API, you need:

    • A Facebook Page
    • A Facebook app (can be any third-party app)
    • App Review approval with specific permissions
    • An Access Token

Best Practices

  • Use Page access tokens instead of User access tokens for better rate limits.
  • For frequent lead updates, use Webhooks instead of bulk reading.
  • Consider using the Conversions API integration to optimize for quality leads.

To stay updated on the latest changes and features, it's recommended to check the Changelog and Out-of-Cycle Changes documentation regularly.

How to get a Facebook Lead Ads developer account and API Keys?

  1. Create a Facebook Page for your business if you don't already have one.

  2. Create a Facebook app:

    • Go to developers.facebook.com and create a new app
    • Select the "Business" app type
    • Fill out the basic app details
  3. Set up Facebook Login in your app:

    • Add the Facebook Login product
    • Configure the OAuth settings
    • Add the required permissions: leads_retrieval, pages_manage_ads, etc.
  4. Get your app reviewed by Facebook:

    • Submit your app for review, requesting the leads_retrieval and pages_manage_ads permissions
    • Complete Business Verification if required
  5. Once approved, get an access token:

    • Use the Graph API Explorer to get a Page access token with the required permissions
  6. Set up a webhook endpoint:

    • Create a server endpoint to receive lead notifications
    • Subscribe to the leadgen webhook for your Page
  7. Implement the API integration:

    • Use the Graph API to retrieve lead details when you receive webhook notifications
    • Follow the Lead Ads Retrieval guide to process the lead data

What can you do with the Facebook Lead Ads API?

Based on the search results, here are the key data models you can interact with using the Facebook Lead Ads API:

Ad Account

  • Retrieve all ad accounts associated with a user
  • Access account-level insights and performance data

Campaigns

  • Create and manage ad campaigns
  • Retrieve campaign-level insights and performance data

Ad Sets

  • Create and manage ad sets within campaigns
  • Retrieve ad set level insights and performance data

Ads

  • Create and manage individual ads
  • Retrieve ad-level insights and performance data
  • Access ad creative elements and measurement information

Ad Creatives

  • Manage ad appearance and content
  • Create and access libraries of images and videos for ads

Custom Audiences

  • Create and manage custom audiences for targeting

Lead Forms

  • Create lead forms to use in lead ads
  • Associate forms with ads

Leads

  • Retrieve lead information submitted through lead ads
  • Access lead data in real-time using webhooks

Insights

  • Retrieve detailed performance metrics and insights across accounts, campaigns, ad sets, and ads
  • Customize insights with various parameters like date ranges, breakdowns, etc.

Users

  • Retrieve users associated with an ad account

Pages

  • Access pages and places that a user administers

Events

  • Retrieve promotable events associated with pages

Key capabilities for each data model:

  • Create, read, update and delete (CRUD) operations where applicable
  • Retrieve insights and performance data
  • Apply filters, sorting, and pagination
  • Access related objects (e.g. ads within an ad set)
  • Perform bulk operations in some cases

The API allows for programmatic management of the full advertising workflow on Facebook, from campaign creation to performance analysis. Proper permissions and access tokens are required to interact with these data models.