Search code examples
apitwitter

Twitter Ads Api - Objects ID System (numeral / string)


I'm using Twitter ads api (example request: https://ads-api.twitter.com/8/accounts/{{account-id}}/campaigns), and I'm having trouble understanding why I get various objects IDs (campaign ID, Item Line ID, Ad ID, etc) from the API as a short string, for example: "ahab1" or "cahy5", and in their management system in the website I can see those IDs as numbers, for example: 61066011.

It's really confusing.

Does anyone know why it is so? It seems that the short strings I get from the api could probably not be globally unique, as they seem too short. And besides, it's hard to know if I'm fetching the right information this way. I thought maybe they are encoded, but I don't think it's base64 encoded. Thanks.


Solution

  • On the Ads API all IDs (except for user_id and tweet_id) are base-36 encoded. On the Ads UI however these entities are represented in base-10. More details can be found here