Troubleshooting
401 Unauthorized on every call
Walk through these in order:
- Token expired. Re-fetch from
TOKEN_URL. Confirm with theexpires_infield that you are not reusing a token past its lifetime. - Wrong
client_idorclient_secret. Cross-check the values against what Persium gave you. A trailing newline or stray space in the secret is the single most common cause. - Wrong realm. Confirm the
TOKEN_URLmatches the realm Persium issued for you — there are separate realms for staging and production. - Client not provisioned yet. If you got credentials less than an hour ago, give Persium an hour to finish provisioning. After that, contact support.
403 Forbidden on every call
Your client is registered but disabled. Persium disables clients for specific reasons (suspected leak, contract expired, billing). Contact support to find out why and to re-enable.
404 Not Found for a station you know exists
The station belongs to a different organisation. M2M credentials are scoped to exactly one organisation; you cannot reach another organisation's data even if you know its UUIDs.
Confirm what your scope is via GET /me (look at organisation_uuid),
then verify the station appears in GET /stations.
Measurements endpoint returns an empty data array
Most common causes:
- Time window too narrow. Widen
start_time/end_time. - Wrong time zone. Persium expects UTC. Make sure your timestamps
use the
Zsuffix or an explicit offset. - Station hasn't reported. Sanity-check by calling
/measurements/latestfirst. If that returns nothing, the station itself is silent.
Rate limit / throttling errors
You shouldn't see rate limits if you cache tokens correctly (see Authentication). If you do:
- Audit your token cache. Fetching a token per API call will trip Keycloak's per-client rate limit fast.
- Slow down your polling — pulling measurements every second per station is rarely justified. Most use cases poll every 1–5 minutes.
What to include when you contact support
To get help fast, send:
- Your
client_id(never the secret). - The endpoint you called, including query parameters.
- The full response body and HTTP status.
- The approximate UTC timestamp of the call.
- What you expected versus what you got.
Email: support@persium.example.com.