Skip to main content

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

  1. Generate a token — Sign in to the MyTrafficData web app → user menu → API TokensGenerate. Copy the plaintext value the moment it's shown; it's masked afterwards and can't be recovered.
  2. Store the token — Put it in a secret manager (or MYTD_TOKEN env var for a quick test). Never commit it.
  3. Send the headerAuthorization: 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

HTTPLikely causeFix
401 Authentication credentials were not provided.Header missing or mistypedAdd Authorization: Token …
401 Invalid token.Token is wrong, or has been revoked/regeneratedRegenerate from the dashboard
403 You do not have permission...Account missing can_use_api permissionContact 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.