Search code examples
facebook-graph-apifacebook-appsfacebook-access-tokenfacebook-java-api

Unable to get ad insights in Facebook's Marketing API


As described in the marketing API, I have registered an app got my app key and and id, generated a token with ads permissions, list pages permission as well. The app is not yet submitted for approval.

When I try to get the list of ad accountsz linked to 'me' it returns the array of all ad accounts.

But when I select any of the business accounts (other than my personal Facebook account) and try to retrieve the ads insights API throws exception saying: but when I try to get the insights, using the python SDK, I get the same error, ex: (#273) This Ads API call requires the user to be admin of the ad account. User is not admin on ad account .

What is surprising is when I use the similar sample page from Facebook-Developers to get insights, it is able to retrieve the ads data for the same account, with my own login itself. Why would my app be unable to do so? Is there any such limitation for apps not reviewed?

Update: I seem to have admin access to the ad account as well. Here are some screenshots. (Unless its my dumb day I think something else is going on, but its my fist time with an API like this, so I cant be sure!;) )

Screenshots: GraphAPI Explrer with API call, App Settings, AdAccount Settings


Solution

  • Based on the discussion on question and experience I now have:

    • API user needs to be an admin of the ad account and of the app if you wish to use the API.
    • The ad account needs to be specifically added to the app, in app settings. In developer access an app can only have access to a maximum of 5 ad accounts.
    • Error messages in Facebook API are misleading more often than not. Fix anything marked in yellow or red anywhere in the portal, to be sure.
    • Do read about limits of every API before you use it, all API have different limits and your application design needs to take those into account.

    As for the question, yes the issue was the text in red, as pointed out by @CBroe, although the error message was off by a mile and issue occurred only when using our own app.