How to create a Matomo auth token (token_auth)
You create tokens in Matomo under Administration → Personal → Security → Auth tokens: confirm your password, add a description, copy the token. Matomo shows it only once. The more important decisions are which user the token belongs to and what it's allowed to do, and that's what this guide covers.
What a token_auth is
A token_auth is a long random string that lets an app or script call the Matomo Reporting API instead of you logging in. iPhone apps, dashboards, spreadsheets and scripts all use one. A token can do whatever its user can do, so treat it like a password.
Since Matomo 4, every user can have several tokens, each with its own description. That's the feature to use: one token per app, revocable on its own.
Creating one
The exact screens differ a bit between Matomo 4, 5 and 6, and Matomo keeps them documented in its official FAQ How to get the token_auth. In short, as of November 2026:
- The token page is in your personal security settings, the same on self-hosted Matomo and Matomo Cloud.
- You confirm with your password and give the token a description.
- Matomo 5 and 6 add two optional settings: Only allow secure requests and an expiry date.
- Matomo 6 also lets you set a token access level (View, Write, Admin, Superuser) instead of inheriting all your user's rights.
- Copy the token right away into a password manager. If you lose it, create a new one.
Which access to give it
For reading statistics, view access is enough: visits, pages, sources, countries, devices, goals and (if enabled for the site) the visitor log. A token only sees the sites its user has access to.
| Use case | Access needed |
|---|---|
| Reading reports in an app or dashboard | View |
| Creating goals, segments or annotations via API | Write |
| Managing a site and its users | Admin |
| System settings, all sites | Superuser |
Least privilege, and why it matters under GDPR
Matomo data contains personal data: IP-derived locations, visit histories, sometimes user IDs. The GDPR's principles of data minimisation and integrity and confidentiality are a good reason to limit who and what can read it. In practice:
- Don't use a Superuser token for a reporting app. A leaked Superuser token exposes every site and every setting.
- Create a dedicated view-only user for apps and dashboards, with access to exactly the sites it needs, and let that user create the token. On Matomo 6, a View token from your own account does the same job.
- For agencies and clients: give each person their own user with view access to their sites, instead of sharing one token around. You can then see and revoke access per person.
This isn't legal advice, but it's the setup that's easiest to justify to a data protection officer. Matomo's GDPR guide covers the wider picture.
Should you tick "Only allow secure requests"?
With this option the token only works in the body of a POST request, never as a URL parameter. That keeps it out of server logs, proxy logs and browser histories, where URLs tend to end up.
- Turn it on for apps and scripts that use POST. Statomo sends every API call as POST, so secure-only tokens work.
- Leave it off for tools that put the token in GET URLs. Matomo's FAQ names WooCommerce, Matomo for WordPress and Looker Studio as examples; they fail to authenticate with a secure-only token.
Keeping tokens safe
- One token per app or device, with a clear description. Lose a phone, revoke one token, nothing else breaks.
- Revoke what you don't use. Delete old tokens in the Auth tokens list.
- Set an expiry date for tokens you hand to third parties or one-off projects.
- Never paste tokens into tickets, chats or repositories. If it happens, delete the token and create a new one.
- Use HTTPS only. Over plain HTTP the token can be read on the way.
Using the token in Statomo
Statomo, a native iPhone app for Matomo, offers two ways in:
- Username and password: sent once, only to your Matomo server, to create a token for this device. It appears in your Auth tokens list as "Statomo on" plus your iPhone's name. The password isn't stored.
- Access token: tap Use an Access Token instead, enter your server URL and paste the token. Use this with two-factor authentication, SSO, or a view-only user.
Either way the token sits in the iOS Keychain, and the app talks directly to your Matomo over HTTPS, with no Statomo account or server in between. Connection problems? See Connect your Matomo to your iPhone.
FAQ
Can I see an existing token again?
No. Matomo shows a token only once, right after creating it. Create a new one and delete the old one.
Does a token expire?
Only if you set an expiry date (Matomo 5 and 6). Otherwise it's valid until you delete it or the user is removed.
Is a view-only token enough for a Matomo app?
Yes, for reading statistics. Write or admin access is only needed to change things in Matomo.
Updated November 2026.