Twiter ads api error

python
ads

#1

*Error:**TwythonError: Twitter API returned a 400 (Bad Request), This audience type requires an audience value

The error occurs when i change the audience type from ALL_ON_TWITTER to ORGANIC Where the api documentation has audience types All_ON_TWITTER & ORGANIC

from twython import Twython
import json
APP_KEY = ''
APP_SECRET = '
'
OAUTH_TOKEN = ''
OAUTH_TOKEN_SECRET = '
'
twitter = Twython(APP_KEY, APP_SECRET,OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
account_id = '*'
t = twitter.request(‘https://ads-api.twitter.com/1/insights/accounts/{}/?
audience_type=ORGANIC’.format(account_id))
#https://ads-api.twitter.com/1/insights/accounts/ACCOUNT_ID/available_audiences
print t


#2

Hello!

When you are making a call to that endpoint and setting audience_type=ORGANIC, we require the audience type value to be part of the API request. See documentation here (control-f for ‘audience_value’) -> https://dev.twitter.com/ads/reference/get/insights/accounts/account_id

In order to see all available audiences for a given account and find the audience_value. See documentation -> https://dev.twitter.com/ads/reference/get/insights/accounts/account_id/available_audiences

Thank you!