How to retrieve facebook user's ads account id?

facebook, facebook-ads-api, facebook-graph-api

Solution

Provided your app has access to the Ads API and you have the `ads_management` Permission you can retrieve the list of Advertising Accounts with a call to `/<USER ID>/adaccounts`

The response is an array of `adaccount` objects, documented here: https://developers.facebook.com/docs/reference/ads-api/adaccount/

Problem

In my app I want to create Facebook ads on behalf of a user. How do I discover via API if he has a FB Ads account and what's his Ads account id?

Original source