Huy
05/20/2026, 8:51 AMAsk Inkeep
05/20/2026, 8:51 AMAsk Inkeep
05/20/2026, 8:51 AMAsk Inkeep
05/20/2026, 8:51 AMdavid
05/20/2026, 8:56 AMHuy
05/20/2026, 8:58 AMHuy
05/20/2026, 8:58 AMdavid
05/20/2026, 9:12 AM{{projId}} and {{envId}} in your URL must match the project and environment your PDP is bound to — i.e. the env that owns the API key your PDP container was started with. If your PDP is running against environment A but you're querying stats for environment B, you'll get an empty array (no error). Easy way to sanity-check: open Permit dashboard → switch to the same env → confirm your PDP is listed/active there.
• {{apiKeyPermit}} scope. The stats API accepts any Environment API Key, but it returns PDPs for whatever `{{projId}}`/`{{envId}}` is in the path — those need to point to the env where the PDP actually lives. The key in the header just authenticates you; it doesn't auto-scope the query.
• Is the PDP actually reaching Permit cloud? Check the PDP container logs for the PDP ID is <uuid> line (it logs this on startup). If you don't see it, or you see auth/connection errors to the Permit backend, the PDP never successfully registered and won't show up in stats. Outbound egress to *.<http://permit.io|permit.io> needs to be open.
• Is the PDP recent enough? Older PDP versions (pre-0.2.x) didn't report into the stats API. If you're on a very old image, upgrade and restart.
• *Try the org-level endpoint as a sanity check.*`GET https://pdp-statistics.api.permit.io/v2/stats/{org_id}/pdps` lists every PDP across your whole org — if your PDP shows up there but not in the env-scoped call, that confirms it's a project/env mismatch in the URL.Huy
05/20/2026, 9:25 AMGET <https://pdp-statistics.api.permit.io/v2/stats/{org_id}/pdps> it return result but it is old pdp
'org_id': '1c42cdd96a4e4e5d83ab1db54a7766c8',
'project_id': 'e1361e7a8ff34886b1c453ad14dbb8ad',
'env_id': '20df7c9764a54f7b9de170804f7e88e1'Huy
05/20/2026, 9:28 AMdavid
05/20/2026, 9:29 AMproject_id: e1361e7a8ff34886b1c453ad14dbb8ad
• env_id: 20df7c9764a54f7b9de170804f7e88e1
• pdp_id: dc52de97-5353-4f07-b247-973d6fbeb535
But the org-wide stats response (/v2/stats/{orgId}/pdps) only shows PDPs under:
• project_id: 62a17c26-e831-41b7-8874-bed53abb9b6f
• env_id: f3404f33-3de3-4fc8-a685-42591608bc5c
Your currently-running PDP (dc52de97...) isn't in the org list at all. So when you called /v2/stats/{projId}/{envId}/pdps earlier and got data: [], that wasn't a bug — your {{projId}} / {{envId}} vars were pointing at the older project/env (the one matching the API key on the dashboard side), while the PDP is bound to a different one via the API key set on the PDP container (PDP_API_KEY env var).
Fix: make sure all three are aligned:
• The API key passed to the PDP container (PDP_API_KEY)
• The {{projId}} and {{envId}} you put in the stats URL
• The {{apiKeyPermit}} you use as the Bearer token
All three need to refer to the same project + environment. Easiest way: in the Permit dashboard, switch to the env you want to monitor, copy that env's API key, restart the PDP with it, and use that same env's project/env keys (or IDs) in the stats URL.
2. The 404 on /pdps/{{pdpId}} is expected given the above.
You queried /v2/stats/{{projId}}/{{envId}}/pdps/dc52de97-... but `{{projId}}`/`{{envId}}` were pointing at the other project/env where that PDP doesn't exist — hence the "PDP with id ... was not found". Once you align the project/env in the URL with the project/env the PDP is actually bound to, that lookup will return 200 and you'll then be able to query the messages endpoint with ?state=assumed_lost for that env to track lost messages.
Quick sanity check after you fix the alignment: hit /v2/stats/{projId}/{envId}/pdps again with the corrected vars — you should see dc52de97-5353-4f07-b247-973d6fbeb535 in the response with active: true.Huy
05/20/2026, 9:36 AMHuy
05/20/2026, 9:38 AMdavid
05/20/2026, 9:47 AMdavid
05/20/2026, 9:59 AMHuy
05/20/2026, 10:01 AMHuy
05/20/2026, 10:02 AMdavid
05/20/2026, 10:04 AMdocker logs permit-pdp > pdp.log 2>&1
wc -l pdp.log
tail -200 pdp.log
docker exec permit-pdp curl -s <http://localhost:8181/health>
docker exec permit-pdp curl -s <http://localhost:7000/healthy>Huy
05/20/2026, 10:07 AMdavid
05/20/2026, 10:35 AMHuy
05/21/2026, 11:21 AM