Use API
You can manage most of Permit's functionality from the web application.
That being said, you may want to use the API from time to time.
This can be achieved with Postman or any other REST client as well as with CLI tools like curl.
Get your API Key
In order to call the API, you will need to get the API key from the Permit Dashboard. Go to the Settings -> API Keys screen.
You can either reveal and copy an existing API key or create a new key by clicking on Create Key.
There are 3 types of API Keys:
- Organization API Keys can act on your entire Permit Organization (i.e: workspace) and access all projects and environment within that workspace.
- Project API Keys can access a single project and all the environments that belong to that project.
- Environment API Keys can access a single environment. Only this type of API key can be used by the PDP container.
API Docs
The API docs are available at https://api.permit.io/v2/redoc
Using Postman
You can download Postman and use it to experiment with the API.
You need to provide the API Key you got from permit in the Authorization header.
Select bearer token in the authentication type and paste your API Key there.
Using CURL
You can use the curl command line tool to use or test the API.
You need to provide the API Key you got from permit in the Authorization header.
Get all users
Run it with the following command to get all the users in your organization:
curl -H "Authorization: Bearer <API Key>" https://api.permit.io/v2/facts/{projectKey}/{environmentKey}/users
Get all tenants
Use this command to get all your tenants:
curl -H "Authorization: Bearer <API Key>" https://api.permit.io/v2/facts/{projectKey}/{environmentKey}/tenants