Hello! I'm having some trouble making sense of thi...
# permit-saas
i
Hello! I'm having some trouble making sense of this: I created an api key through the
v2/api-key
endpoint
Copy code
{
  ...
  "object_type": "env",
  "access_level": "read",
  "owner_type": "pdp_config"
}
it works fine and I get an api key however, if I try to use it on the /v2/pdps/me/config it returns an error with a message: "The requested data could not be found, we could not find 'pdpconfig' with the given filters: ..." am I doing something wrong?
a
Hi @Iker Lissarrague, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
The issue is that when you create an API key with
owner_type: "pdp_config"
, the system expects this API key to be associated with an ​*existing PDP configuration*​ (1) . The
/v2/pdps/me/config
endpoint is specifically designed to get configuration for an ​*already authenticated PDP container*​ (2) . When you manually create an API key via the
/v2/api-key
endpoint with
owner_type: "pdp_config"
, you're creating the key but not the underlying PDP config record that it should be linked to. This is why you're getting the "could not find 'pdpconfig'" error. The typical flow is: 1. First, a PDP configuration gets created (this happens automatically when you deploy a PDP container or can be managed through the PDP configs endpoints) (3) 2. That PDP config has an associated API key generated for it (4) 3. The PDP uses that API key to authenticate and fetch its configuration via
/v2/pdps/me/config
(2) To resolve this, you should either: • Use the environment-level API key instead (get it via
/v2/api-key/{proj_id}/{env_id}
) (5) , which doesn't require a PDP config association • Or create the API key through the proper PDP conf
To learn more, see the sources I considered: [[1] POST /v2/api-key](https://api.permit.io/v2/redoc#tag/API-Keys/operation/create_api_key) [[2] permitio/permit-ruby/docs/PolicyDecisionPointsApi.md](https://github.com/permitio/permit-ruby/blob/main/docs/PolicyDecisionPointsApi.md) [[3] GET /v2/pdps/{proj_id}/{env_id}/configs](https://api.permit.io/v2/redoc#tag/Policy-Decision-Points/operation/list_pdp_configs) [[4] Configurations](https://docs.permit.io/concepts/pdp/configuration) [[5] GET /v2/api-key/{proj_id}/{env_id}](https://api.permit.io/v2/redoc#tag/API-Keys/operation/get_environment_api_key)
d
Hi @Iker Lissarrague the Bot gave a good answer 🙂
thanks 1
a
Thanks for the feedback, glad I was helpful.
i
The typical flow is:
1. First, a PDP configuration gets created (this happens automatically when you deploy a PDP container or can be managed through the PDP configs endpoints) (3)
2. That PDP config has an associated API key generated for it (4)
3. The PDP uses that API key to authenticate and fetch its configuration via
/v2/pdps/me/config
(2)
I'm having some trouble understanding this, isn't it necessary to pass in a
PDP_API_KEY
to even get the PDP container running?
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
e
Hey @Iker Lissarrague Thank you for reaching out! The issue is that
/v2/pdps/me/config
only works with an API key that has the right permissions to back a PDP. The key you created has
"access_level": "read"
, which doesn't qualify — that's why you're getting the "pdpconfig not found" error. You also don't need to set
owner_type
yourself; the system handles that for you. To get a working PDP key, either: 1. Grab the environment API key from the Permit dashboard (Projects → Environments → API Key) — simplest option. 2. Or create one via API with:
Copy code
{
  "organization_id": "...",
  "project_id": "...",
  "environment_id": "...",
  "object_type": "env",
  "access_level": "write"
}
Either of those will work as your
PDP_API_KEY
when running the PDP container. Hope that clears it up!
thanks 1