Skip to main content
Version: 2.0.0

Overview

A large majority of API calls to work with the Permit API require you to provide the project id and environment id. This quick guide will explain how you can get yours.

Get project id or key

Follow this link to get your API_SECRET_KEY.
Once you have your API_SECRET_KEY, you can use it to get your project id or key.
Make sure you copied the API_SECRET_KEY that belongs to an environment that is under the project you want to get the id for.

Get project object

curl 'https://api.permit.io/v2/projects' \
-H 'authorization: Bearer API_SECRET_KEY'

The return project object will look like this:

{
"key": "project_key",
"urn_namespace": null,
"id": "3c4244c7bcab4c97990e5bc724dxxxx",
"organization_id": "903ebc2765b848289d6dfbd3c21xxxx",
"created_at": "2023-02-28T10:07:44+00:00",
"updated_at": "2023-06-22T08:46:42+00:00",
"name": "Project Name",
"description": "",
"settings": {
"abacEnabled": true
},
"active_policy_repo_id": null
},

You can extract either the id or key from the project object.

Get Environment id or key

Use the same API_SECRET_KEY you used to get the project id or key.
Use the project id or key you got from the previous step.

Get environment object

curl 'https://api.permit.io/v2/projects/project_id_or_key/envs' \
-H 'authorization: Bearer API_SECRET_KEY'

The return environment object will look like this:

{
"key": "env_key",
"id": "20cce46340594f98b03c2189e40cxxxx",
"organization_id": "903ebc2765b848289d6dfbd3c21exxxx",
"project_id": "3c4244c7bcab4c97990e5bc724daxxxx",
"created_at": "2023-05-16T12:47:10+00:00",
"updated_at": "2023-05-16T12:47:10+00:00",
"name": "Env Name",
"description": null,
"custom_branch_name": null,
"jwks": null,
"settings": null,
"email_configuration": null
},

You can extract either the id or key from the environment object.