Authentication
Every request to /api/v1/ carries a single header:
Authorization: Token <your-api-token>
That's the whole authentication story for getting started. No OAuth, no refresh tokens, no session cookies.
In three steps
- Generate a token — Sign in to the MyTrafficData web app → user menu → API Tokens → Generate. Copy the plaintext value the moment it's shown; it's masked afterwards and can't be recovered.
- Store the token — Put it in a secret manager (or
MYTD_TOKENenv var for a quick test). Never commit it. - Send the header —
Authorization: Token <your-api-token>on every request.
curl -H "Authorization: Token $MYTD_TOKEN" \
https://mytrafficdata.com/api/v1/traffic/sites
What can go wrong on the first try
| HTTP | Likely cause | Fix |
|---|---|---|
401 Authentication credentials were not provided. | Header missing or mistyped | Add Authorization: Token … |
401 Invalid token. | Token is wrong, or has been revoked/regenerated | Regenerate from the dashboard |
403 You do not have permission... | Account missing can_use_api permission | Contact your account administrator |
Want the full story?
For tokens shown only once, rotation, storage tips, and the can_use_api permission gate, see the deep page:
→ Concepts → Authentication & tokens
That page covers everything you need for production-ready integration. This page just gets you up and running.