Getting started¶
1. Your credentials¶
You receive four secrets from the course staff. Export them in your shell (never commit them):
export META_ACCESS_TOKEN="EAAB..."
export TIKTOK_ACCESS_TOKEN="..."
export GOOGLE_ACCESS_TOKEN="ya29...."
export GOOGLE_DEVELOPER_TOKEN="..."
Each platform expects its credential in a different place:
| Platform | Where the credential goes |
|---|---|
| Meta | query parameter access_token= (or Authorization: Bearer) |
| TikTok | HTTP header Access-Token: |
| Google Ads | HTTP header Authorization: Bearer and header developer-token: (and login-customer-id: 9990001111) |
2. First call on each platform¶
curl -s "https://graph.huydata.com/v21.0/me/adaccounts?fields=id,name,account_id&access_token=$META_ACCESS_TOKEN"
curl -s -H "Access-Token: $TIKTOK_ACCESS_TOKEN" \
"https://business-api.huydata.com/open_api/v1.3/oauth2/advertiser/get/"
curl -s -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \
-H "developer-token: $GOOGLE_DEVELOPER_TOKEN" -H "login-customer-id: 9990001111" \
"https://googleads.huydata.com/v18/customers:listAccessibleCustomers"
Each returns the 10 accounts (one per game) you are allowed to query. Everything else starts from an account id.
3. Reading the docs¶
Each platform section follows the same order: authentication → account → campaign → ad set/ad group → ad → reporting → paging → errors. Read the reporting and errors pages carefully: they explain how dates, countries and numbers are encoded, how to page through large results and what a rate-limit response looks like.
4. Postman collection¶
Import ads_sandbox.postman_collection.json, fill in the
collection variables with your tokens and try every request before writing code.
5. Verify your numbers against Ads Manager¶
https://ads-manager.huydata.com shows the same data in each platform's reporting interface (log in with any of your tokens). Compare its Totals row with your pipeline before you trust your own numbers; see Ads Manager for the column-to-field mapping.
6. Rules of the sandbox¶
- 60 requests per minute per token and platform. Back off when told to.
- Report dates are available from 00:10 UTC of the next day. Yesterday is the newest date you can fetch.
- Installs and purchases for the last 3 report dates are still changing. Re-fetch them.
- Tokens are personal. Usage is logged per token.