Hello,

I didn’t use my Twitter ads API integration for a while. After upgrading to the latest version v11 the list of accounts is empty and when I request my account I see the error message Forbidden:

{'code': 'NOT_FOUND', 'message': 'Account 18ce5596fiz was not found'}

I use python cdk like this:

client = Client(
    twitterconfig.TWITTER_ADS_CONSUMER_KEY,
    twitterconfig.TWITTER_ADS_CONSUMER_SECRET,
    twitterconfig.TWITTER_ADS_ACCESS_KEY,
    twitterconfig.TWITTER_ADS_ACCESS_KEY_SECRET,
)

account = client.accounts('18ce5596fiz')

Can you help me to understand what is wrong?

Thanks,
Oleksandr

Hi @getabit ,

Can you provide the full API request that you tried? As well as your app ID?

@Jasl692

App ID: 18870480

Request:
GET /11/accounts/18ce5596fiz

headers: {“user-agent”: “twitter-ads version: 11.0.0 platform: Python 3.7 (CPython/linux)”, “Accept-Encoding”: “gzip, deflate”, “Accept”: “/”, “Connection”: “keep-alive”, “Authorization”: “OAuth oauth_nonce="126160533642266903471670491399", oauth_timestamp="1670491399", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="E…E", oauth_token="3965588871-M…Y", oauth_signature="0LgO9nSwMw9%4BpgFp%2BQLUtCHhzkw%3D"”}

Response:
StatusCode: 403

Payload:
‘{“errors”:[{“code”:“NOT_FOUND”,“message”:“Account 18ce5596fiz was not found”}],“request”:{“params”:{}}}’

Request:
GET /11/accounts

headers: {“user-agent”: “twitter-ads version: 11.0.0 platform: Python 3.7 (CPython/linux)”, “Accept-Encoding”: “gzip, deflate”, “Accept”: “/”, “Connection”: “keep-alive”, “Authorization”: “OAuth oauth_nonce="21280100576202722851670492747", oauth_timestamp="1670492648", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="E…E", oauth_token="3365588882-M…Y", oauth_signature="XSACOVsBzIk%2BgzzguCWLyyTlW39%3D"”}

Response:
StatusCode: 200

Payload:
‘{“request”:{“params”:{}},“next_cursor”:null,“data”:}’

Thank you. I’m seeing app ID 18870480 does not have Ads API access, and the endpoint you’re trying to call is an Ads API account endpoint. I also found another app ID 18885214 that belongs to your company, and this app has Ads API access but only for analytics, so will also be unable to call that account endpoint.

You can apply for the other Ads API for one of your apps here Advertising API License Agreement | Docs | Twitter Developer Platform and once it’s approved, you can try again.

@Jasl692

Thank you for your explanation but I still don’t understand a few things.

  1. In my developer portal, I see only 1 project with Acc Id 18870480.
    I can’t see app ID 18885214.
    How is it possible?

  2. You mentioned that app ID 18885214 has access to analytics. This is exactly what I want - to fetch campaign analytics. If my account already has access to analytics why do I still see the error?

Request
GET /11/stats/accounts/18ce5596fiz/active_entities?entity=CAMPAIGN&start_time=2022-12-01&end_time=2022-12-08

Headers: {“user-agent”: “twitter-ads version: 11.0.0 platform: Python 3.7 (CPython/linux)”, “Accept-Encoding”: “gzip, deflate”, “Accept”: “/”, “Connection”: “keep-alive”, “Authorization”: “OAuth oauth_nonce="45193129450978433721670601630", oauth_timestamp="1670601630", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="XXXXXXXXXXXXXX", oauth_token="XXXXXXX-XXXXXXXXXXX", oauth_signature="XXXXXXXXXXX%3D"”}

Response:
StatusCode: 403

Payload:
‘{“errors”:[{“code”:“NOT_FOUND”,“message”:“Account 18ce5596fiz was not found”}],“request”:{“params”:{}}}’

The same for this endpoint:
GET ‘/11/stats/accounts/18ce5596fiz?metric_groups=BILLING&start_time=2022-12-01&end_time=2022-12-08&granularity=DAY&entity=CAMPAIGN&placement=ALL_ON_TWITTER&entity_ids=31904655’

Please confirm that the only way to restore access to campaign analytics is to apply for Ads API again

Thank you!

Thanks for providing the info @getabit.

The app 18885214 is probably owned by another user i.e. your colleague, and hence you don’t see it in your own developer portal. You may want to check internally who owns this app. I can confirm that this app ID’s record on our file is owned by a user with @getbits.app email domain.

The endpoint you’re trying to hit is an analytics endpoint yes, which requires Ads API access. Ads API access is given on an app basis, and not a company/account basis. So currently only 18885214 has the Ads API access. It’s best you communicate internally to consolidate your twitter apps for easier management of such accesses.