Thanks for the question, @CROSSMEDIA_DUS. Glad to hear you are interested in using the Ads API to retrieve performance data.
When making a request to the Ads API, you need four pieces of information as you know:
- app-specific
- consumer key
- consumer secret
- user-specific
- access token
- access token secret
The first set is associated with the app and the second with the user. (To clarify, when I say “user” I’m referring to the Twitter @handle.) It sounds like you’ve already authenticated a user—the same user you use to access the ads manager UI—which is great.
When you make a request to the GET accounts endpoint, you will see all of the ad accounts the authenticated user has access to. This will be (1) the ads account the user owns and (2) any ads accounts that have granted access to the authenticated user. For example, I’m authenticated as @juanshishido and I see the following when I making a request to GET accounts:
$ twurl -H ads-api.twitter.com "/3/accounts"
{
"request": {
"params": {}
},
"next_cursor": null,
"data": [
{
"name": "Juan Shishido",
"business_name": null,
"timezone": "America/Los_Angeles",
"timezone_switch_at": "2016-07-06T07:00:00Z",
"id": "18ce54aymz3",
"created_at": "2016-04-08T03:36:02Z",
"salt": "1def870c146c80dc70e798edf3fdfbfc",
"updated_at": "2018-04-05T04:43:40Z",
"industry_type": null,
"business_id": null,
"approval_status": "ACCEPTED",
"deleted": false
},
{
"name": "API McTestface",
"business_name": null,
"timezone": "America/Los_Angeles",
"timezone_switch_at": "2016-07-21T07:00:00Z",
"id": "18ce54d4x5t",
"created_at": "2016-07-21T22:42:09Z",
"salt": "54cb7b5a34183f77d82dd6d0f4329691",
"updated_at": "2018-04-10T19:23:24Z",
"industry_type": null,
"business_id": null,
"approval_status": "ACCEPTED",
"deleted": false
}
]
}
The ads account I own is 18ce54aymz3, but I also have access to 18ce54d4x5t. These are the only ads accounts I can operate on.
Since we manage multiple accounts for different clients we actually need to access every ad account.
For this, we recommend that partners obtain each user’s OAuth tokens. This will follow the same 3-legged OAuth flow you’ve already implemented and successfully used. This is how you authenticated the user you use to access the ads manager UI.
If the way you’re set up doesn’t allow for this, you can ask the ads accounts to grant you—the authenticated user—access. This can only be done via the Twitter UI at ads.twitter.com. (That is how I got access to 18ce54d4x5t.)
To summarize, the two options for gaining access to an ads account are:
- Obtain the OAuth tokens
- Have the ads account grant you access
Note: Because most rate limiting happens at the token-level, if you use the second option, the rate limit allocation is shared.
For more information see our Obtaining Ads Account Access page.
Hope this helps clarify.
Thanks!