docker run -it \ -p 7766:7000 \ --env _PDP_ORG...
# permit-saas
p
docker run -it \ -p 7766:7000 \ --env _PDP_ORG_API_KEY_=<YOUR_ORG_API_KEY> \ --env _PDP_ACTIVE_PROJECT_=<YOUR_PROJECT_ID_OR_KEY> \ --env _PDP_ACTIVE_ENV_=<YOUR_ENVIRONMENT_ID_OR_KEY> \ --env _PDP_DEBUG_=True \ permitio/pdp-v2:latest can anyone help me to set up these keys , i tried to set these up, its showing incorrect
a
Hi @Pratham Khodwe, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
To set up the PDP with an Organization API Key, you need to provide specific environment variables (1) : 1. ​*PDP_ORG_API_KEY*​: Your Organization API Key 2. ​*PDP_ACTIVE_PROJECT*​: Your Project ID or Key 3. ​*PDP_ACTIVE_ENV*​: Your Environment ID or Key Here's the correct Docker command :
Copy code
docker run -it \
 -p 7766:7000 \
 --env PDP_ORG_API_KEY=<YOUR_ORG_API_KEY> \
 --env PDP_ACTIVE_PROJECT=<YOUR_PROJECT_ID_OR_KEY> \
 --env PDP_ACTIVE_ENV=<YOUR_ENVIRONMENT_ID_OR_KEY> \
 --env PDP_DEBUG=True \
 permitio/pdp-v2:latest
When using an Organization API Key, you must set both
PDP_ACTIVE_ENV
and
PDP_ACTIVE_PROJECT
environment variables with the ID or Key of the environment and project you want to use . Alternatively, you can use a Project API Key with this configuration :
Copy code
docker run -it \
 -p 7766:7000 \
 --env PDP_PROJECT_API_KEY=<YOUR_PROJECT_API_KEY> \
 --env PDP_ACTIVE_ENV=<YOUR_ENVIRONMENT_ID_OR_KEY> \
 --env PDP_DEBUG=True \
 permitio/pdp-v2:latest
Or use the standard Environment API Key (simplest option) :
Copy code
docker run -it \
 -p 7766:7000 \
 --env PDP_API_KEY=<YOUR_API_KEY> \
 --env PDP_DEBUG=True \
 permitio/pdp-v2:latest
To help debug your issue, please share: 1. Which Workspace / Project / Env you are using 2. What calls you are performing (as SDK code or CURL) 3. Which PDP version you are running 4. Relevant logs from your PDP This will help our engineers investigate why your keys are showing as incorrect.
To learn more, see the sources I considered: [[1] Deploy Permit to Production](https://docs.permit.io/how-to/deploy/deploy-to-production)
o
The ai was mainly correct, also with most of the follow up questions did the suggestions helped you out ?
p
no it didnt help me , i am using these keys but it shows me errors while using the docker it is working when i am using the permit cloud
o
Please share the logs with errors you’re getting ?
p
"error":"ErrorCode: NotFound, ErrorType: api_error, Message: The resource was not found"
when i am just using the enviroment key its showing this
but when i am using the same env key with pdp_url as https://cloudpdp.api.permit.io its working
2025-08-07T174732.150558+0000 | uvicorn.protocols.http.httptools_impl | INFO | 127.0.0.1:56440 - "POST //allowed HTTP/1.1" 404 got this on docker
o
It looks like some misconfiguration of double / chars How did you configure your sdk?
If it work with the cloud pdp it probably means you are configuring using env api key and should use the normal PDP_API_KEY config
p
i am using using this command on docker docker run -it \ -p 7766:7000 \ --env _PDP_ORG_API_KEY_=<YOUR_ORG_API_KEY> \ --env _PDP_ACTIVE_PROJECT_=<YOUR_PROJECT_ID_OR_KEY> \ --env _PDP_ACTIVE_ENV_=<YOUR_ENVIRONMENT_ID_OR_KEY> \ --env _PDP_DEBUG_=True \ permitio/pdp-v2:latest with the keys from api secrets [2025-08-07T175233Z INFO watchdog] Starting process 'python3' with command line 'python3 -m uvicorn horizon.main:app --host 0.0.0.0 --port 7001' (start count: 1) [2025-08-07T175233Z INFO pdp_server] Server running on 0.0.0.0:7000, press Ctrl+C to stop 2025-08-07T175234.035050+0000 | 15 | horizon.startup.api_keys | INFO | Fetching Environment API Key from control plane: https://api.permit.io/v2/api-key/permit_key_wtYkeVWklV2sQURCe5dLt8KQYhqFjI2IRUgtZUrv4NAiCbQhkWDt58ZQMEeJ5lDebuI47wlaFaiRgcp6nuhbvk/permit_key_bTwQKREUqPePrHLuRltXxr4MbYKCkAgPyTk0IEMTqE7YuaANUxIg005tv5m0ZWbVLwdsrxwgWKjhsil9P3pcWj 2025-08-07T175234.896871+0000 | 15 | horizon.startup.api_keys |ERROR | No secret found in response from control plane 2025-08-07T175234.897289+0000 | 15 | horizon.startup.api_keys |ERROR | Failed to get Environment API Key: No active exception to reraise
o
Do you have in general any environment api key for the desired environment ?
p
can we connect on huddle .? help me out with this please hard to understand this on chat
o
Unfortunately I’m not available currently for huddle, do you want to schedule some time for Sunday ?
p
yes i have got the keys from the copy keys button on the UI
okayy , sunday would be too late need to dev this today
o
If you are just starting and exploring, I’ll suggest using the
PDP_API_KEY
env var with the env level key instead of the org level api key and the additional configuration. It will reduce the friction here, and it works for most cases
have you tried doing that ? Running the pdp using
Copy code
docker run -it \
  -p 7766:7000 \
  --env PDP_API_KEY=<YOUR_ENVIRONMENT_API_KEY> \
  --env PDP_DEBUG=True \
  permitio/pdp-v2:latest
p
yes i am using the pdk key only the key which i get from here then i used this here docker run -it \ -p 7766:7000 \ --env PDP_API_KEY=<YOUR_ENVIRONMENT_API_KEY> \ --env PDP_DEBUG=True \ permitio/pdp-v2:latest but it shows resource not found and 404 when i hit the sdk
o
Not sure I follow, I thought the issue is with the PDP not running. Can you attach a snippet of your permit client initialization and sdk call ?
p
my internal setup to call sdk.?
anyone else from your team is up for a 5 mins call.?
o
I’m not sure, it’s pretty late in my TZ. I’m anyway more than capable of answering your question, I’m mostly missing information here
p
Let me explain you the problem in depth 1. I was using pdp cloud, but the request used to take 800ms just for checking the permission. 2. Kirk suggested to have the pdp locally setup through the docker. 3. I pulled the image of permitio/pdp-v2:latest to my system 4. The docker command needed some api keys to run the pdp locally. I used the key
Settings
>
API Keys
>
Environment Keys
which was assigned to my project 5. So the image was running correctly but when I fired the my API to check user role it failed, showing resource not found. Which means it was not able to find the user. I figured it would required some Environment Key because I had 2 envs in my project and I am using dev environment.
6. When I added other keys like PDP keys and ENV Key and ORG KEy it was showing Environment Not found.
i.e invalid keys
o
Let’s try to minimize the variants here Run the PDP using Environment level api key taken from the UI with the command
Copy code
docker run -it \
  -p 7766:7000 \
  --env PDP_API_KEY=<YOUR_ENVIRONMENT_API_KEY> \
  --env PDP_DEBUG=True \
  permitio/pdp-v2:latest
After that attach a small code snippet of your permit client initialization and sdk call and the logs
p
Copy code
func NewPermit(config config.PermitConfig) *Client {
	apiClient := api.NewPermitApiClient(&config)
	enforcerClient := enforcement.NewPermitEnforcerClient(&config)
	return &Client{
		config:      config,
		Api:         apiClient,
		Elements:    apiClient.Elements,
		enforcement: enforcerClient,
	}
}
Copy code
// CheckPermission checks if a user has permission to perform an action on a resource
func (s *PermitService) CheckPermission(ctx context.Context, userID, action, resource, tenantID string) (bool, error) {
	// Create user for permission check with tenant context
	user := enforcement.UserBuilder(userID).Build()

	// Create action
	actionObj := enforcement.Action(action)

	// Create resource with tenant context
	resourceObj := enforcement.ResourceBuilder(resource).WithTenant(tenantID).Build()

	// Check permission
	allowed, err := s.Client.Check(user, actionObj, resourceObj)
	if err != nil {
		s.logger.Errorw("failed to check permission", "error", err, "user_id", userID, "action", action, "resource", resource, "tenant_id", tenantID)
		return false, fmt.Errorf("failed to check permission: %w", err)
	}

	s.logger.Infow("permission check result", "user_id", userID, "action", action, "resource", resource, "tenant_id", tenantID, "allowed", allowed)
	return allowed, nil
}
Copy code
permit:
  api_key: "" # Will be overridden by FLEXPRICE_PERMIT_API_KEY environment variable
  api_url: "<https://api.permit.io>"
  pdp_url: "<https://cloudpdp.api.permit.io>"
  environment: "dev"
  debug: false
  project_id: "default"
api_key is in my env using the enviremnet key
o
Have you tried following the guide here ? It seems like your client initialization is “manual” and not using the high level “constructor functions” Also what is your pdp_url when using a local pdp ?
And the logs of both your application and the pdp would help here 🙌
p
working now
thank you for the support
really appreciate it @Omer Zuarets
the issue was in initializition of client not sure how was it working for permit cloud
o
Happy it solved your issue, let us know if you have any other questions or issues 😇
❤️ 1
🙌 1