Facebook Ads API Data Scraping
The Facebook Marketing API is a Facebook API that allows you to run queries against your own Facebook business ad account. This can be very useful for anyone in paid marketing who needs an automated way to monitor ad campaigns & ad management.
You’re free to query the API directly and begin making API calls, but you may have an easier time using an already built client like the Python FacebookAdsAPI module (GitHub). While this module is great if you need a high amount of customization and are willing to write & maintain custom code, we’ll explain below how our service can help you extract CSV files from the API using our no-code platform.
User Access Token
You’ll need to generate an access token to query the API. You can do this under your Facebook Developer Apps where you’ll need to then go under
Marketing API >
Tools (left hand column) and generate a token with
read_insights ads management permissions.
Ad Insights API Queries
The easiest place to start is with the Ad Insights API, which we provide a Facebook Ad Insights Scraper for. You can review the instructions on the page (or query the raw endpoint directly), but you’ll need to provide an ad object ID (which can just be the account ID of the account that owns the Facebook Ads).
You’ll also want to pay attention to the fields parameter, where you can enter in a list of fields you want returned from the API. These will be nearly identical to the “columns” you see on the Facebook Ads Manager. Please refer to their available fields documentation for more information.