krushit
krushit

Reputation: 5

not getting ad_id, campaign_id, adset_id for live leads in <FORM_ID>/leads ( Meta Retrieving lead / Ads / Meta API )

I'm encountering an issue while retrieving lead data via the Graph API for live leads (not test leads). Despite explicitly requesting fields like ad_id, campaign_id, and adset_id, the API response only includes basic lead fields but omits all ad-related fields.

I am calling retrieve leads graph API for forms, graph_url/version/<Form_ID>/leads?fields=ad_id,field_data,form_id,is_organic,platform,created_time,adset_id,ad_name,adset_name,campaign_id,campaign_name

but it doesn't return ad_id, campaign_id or adset_id etc. it only returns:

{
  "field_data": [
     ...
  ],
  "form_id": "48495496xxxxxx",
  "is_organic": false,
  "platform": "ig",
  "created_time": "2025-02-16T19:50:03+0000",
  "id": "285646074598xxxxx"
}

these leads are not from testing or debug tool, these are live leads i am trying to fetch,

few more things I tried: calling /<leadgen_id> endpoint with same fileds. but that also does not return ad_id, campaign_id or adset_id.

Use of webhooks, webhooks are already integrated and in use and it receive ad_id and form_id, but some leads are never sent via webhook, which is why we are using the API as a fallback.

Access token permissions: These are the permissions granted to access_token,

pages_show_list
ads_management
ads_read
leads_retrieval
pages_read_engagement
pages_manage_metadata
pages_manage_ads

Ad_accounts are seperate from page, user or access_token user does not have permission on ad_accounts only on Page, that's why we are fetching leads from form. and I belive this might be the reason not getting ad_id and campaign, as these are the assets connected to ad_account can someone help what can be workaround in this situation.

If someone has any solution or suggestion, please provide.

Upvotes: 0

Views: 15

Answers (0)

Related Questions