pythonfacebook-ads-apifacebook-business-sdk

How can I get Facebook's python business SDK to use the latest Ads API version (v13.0)?


When I call the Ads API I get the following error message telling me that I'm calling a deprecated version of the Ads API:

"message": "(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v13.0."

Here's the code that returns the error:

from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.customaudience import CustomAudience
from facebook_business.api import FacebookAdsApi

access_token = '123456678910'
id =  'act_12345678910'

FacebookAdsApi.init(access_token=access_token)

fields = [
]
params = {
    'name': 'My new Custom Audience',
    'subtype': 'CUSTOM',
    'description': 'People who purchased on my website',
    'customer_file_source': 'USER_PROVIDED_ONLY',
}

AdAccount(id).create_custom_audience(
    fields=fields,
    params=params,
)

Is there a way to configure the SDK to use the latest version of the Ads API?


Solution

  • There is an API config file which you can update found in:

    <VIRTUAL_ENV>/facebook_business/apiconfig.py

    which contains:

    ads_api_config = {
      'API_VERSION': 'v12.0',
      'SDK_VERSION': 'v12.0.1',
      'STRICT_MODE': False
    }