---
title: 'Meta Lead Ads API: Webhook, Graph API & CAPI lead_id Guide'
description: 'Pull Meta Lead Ads via leadgen webhooks and Graph API, fix CRM Lead Access permission traps, and send qualified stages back via CAPI with unhashed lead_id.'
canonical: 'https://plainrouter.com/library/meta-lead-ads-api'
format: Guide
last_updated: '2026-12-04'
---

The Meta Lead Ads API lets you pull Facebook and Instagram Instant Form submissions directly into your backend or CRM in real time instead of downloading CSVs or paying per-task middleware fees. When paired with [Meta Conversions API for CRM](</library/meta-crm-conversion-leads>), you also send qualified pipeline stages back to Meta using the exact 15-to-17-digit lead\_id so delivery optimizes for real buyers instead of low-intent form fills.

## How the Meta Lead Ads API retrieval flow works

Meta does not include contact PII inside the webhook notification itself. Real-time Lead Ads ingestion is always a two-step handshake:

- **1\. Receive the leadgen webhook notification: **Subscribe your Meta App to the Page webhook field leadgen. When someone submits an Instant Form, Meta POSTs a lightweight JSON event containing page\_id, form\_id, ad\_id, created\_time, and leadgen\_id.
- **2\. Verify X-Hub-Signature-256 and fetch full lead fields: **Verify the HMAC-SHA256 signature against your App Secret, acknowledge with HTTP 200 quickly, and issue a server-side GET /\{leadgen\_id\} call to Graph API with a Page Access Token to retrieve field\_data (email, phone, full\_name, custom answers).
- **3\. Store leadgen\_id in your CRM: **Save the exact leadgen\_id string on the CRM contact record. You will pass that value back to Meta as user\_data.lead\_id when the lead reaches Qualified, Demo Booked, or Closed Won.

## Required permissions and access pitfalls

Most broken Lead Ads API integrations stall on permissions or Business Manager Lead Access settings rather than code bugs:

- **leads\_retrieval + pages\_manage\_ads + pages\_read\_engagement: **Standard Graph API permissions required on your System User or Page token to read Instant Form payloads.
- **CRM Lead Access Manager assignment: **Even with valid OAuth permissions, if the Facebook Page has customized Lead Access in Business Settings \> Integrations \> Leads Access, your System User or app must be explicitly assigned CRM access or GET /\{leadgen\_id\} returns an empty or permission error.
- **90-day retention window: **Meta only retains Instant Form lead payloads in Graph API for 90 days. Always persist lead fields and leadgen\_id in your own database upon webhook arrival.

## Minimal Node.js example: verify leadgen webhook and fetch fields

`` import crypto from 'node:crypto';

export function verifyMetaWebhook(rawBody, sigHeader, appSecret) {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', appSecret)
    .update(rawBody)
    .digest('hex');
  return sigHeader && crypto.timingSafeEqual(
    Buffer.from(sigHeader), Buffer.from(expected)
  );
}

export async function fetchLead(leadgenId, pageAccessToken) {
  const url = `https://graph.facebook.com/v22.0/${leadgenId}?fields=id,created_time,ad_id,form_id,field_data`;
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${pageAccessToken}` },
  });
  if (!res.ok) throw new Error(`Lead fetch failed: ${res.status}`);
  return res.json();
} ``

## Closing the loop: send CRM stages back via Meta CAPI (lead\_id)

Pulling leads is only half the loop. Without sending downstream CRM stages back to Meta, Lead Ads campaigns optimize for cheap clicks and spam submissions. Send qualified stages back via Conversions API with action\_source set to system\_generated and the original lead\_id (unhashed\!):

` {
  "data": [
    {
      "event_name": "QualifiedLead",
      "event_time": 1764840000,
      "event_id": "crm_lead_9981_qualified",
      "action_source": "system_generated",
      "custom_data": {
        "event_source": "crm",
        "lead_event_source": "HubSpot"
      },
      "user_data": {
        "lead_id": "123456789012345",
        "em": ["<lowercase_sha256_email>"]
      }
    }
  ]
} `

Notice two critical formatting rules: keep lead\_id raw and unhashed (exact numeric string from Meta), and hash email/phone with lowercase SHA-256. You can verify your CRM CAPI JSON before sending with the free [Meta CAPI Payload Validator](</tools/meta-capi-payload-validator>) and check match-key coverage in the [Meta EMQ Checker](</tools/meta-emq-checker>).

## Frequently asked questions

### Why does my Meta Lead Ads webhook receive nothing after subscribing?

Check three things in order: confirm the Page is subscribed to your app via POST /\{page\_id\}/subscribed\_apps?subscribed\_fields=leadgen, confirm your app is in Live mode (not Development mode for non-admin testers), and test with Meta's Lead Ads Testing Tool (developers.facebook.com/tools/lead-ads-testing).

### Can I poll /\{form\_id\}/leads instead of using webhooks?

Yes, as a backup reconciliation job to catch any missed webhook deliveries. Keep polling intervals conservative and read X-Business-Use-Case-Usage headers so you do not trip Meta Marketing API rate limits.

### Should user\_data.lead\_id be SHA-256 hashed in Conversions API?

No. Like fbc and fbp, Meta's lead\_id is a Meta-issued identifier and must be sent raw and unhashed inside user\_data alongside hashed customer fields such as em and ph.

### How does Plainrouter help teams running Meta Lead Ads and CAPI?

Plainrouter gives your team first-party conversion pipelines with per-event Meta delivery logs, independent arrival counts, and governed [Meta Ads MCP](</solutions/meta-ads-mcp>) so Claude, Codex, or Cursor can audit lead-to-revenue performance and propose ad changes under Ask, Custom, or Full workspace controls.

## Related guides and tools

- [Meta Ads API: Marketing API setup, access and limits](</library/meta-ads-api>): complete guide to tokens, permissions, and app review.
- [Meta lead ads: connect Facebook leads to your CRM](</library/meta-crm-conversion-leads>): marketer and CRM walkthrough for Conversion Leads optimization.
- [Meta Ads API rate limits](</library/meta-ads-api-rate-limits>): read X-Business-Use-Case-Usage headers and stop Error 17, 80004, and 613 loops.
- [Meta CAPI Payload Validator](</tools/meta-capi-payload-validator>): free browser-local validator for CRM and website CAPI JSON payloads.
