Use the Permit API and SDK
Connect your application to Permit with the API and SDK: get an API key, install and initialize the SDK, and make your first API call.
Our API & SDK Reference
The API reference documents every endpoint.
Obtain your API key
Your application authenticates with Permit.io using an environment API key.
- Open the Permit Dashboard and go to the Projects screen.
- Select the desired Project and Environment.
- On the environment card, click the
in the top-right corner.
- Choose Copy API Key from the dropdown menu.

You can also copy the API key of the active environment from User Menu Icon > Copy Environment Key.

The API key you copy from the user menu belongs to the active environment in the sidebar. If you switch the active environment and click Copy Environment Key again, you copy a different API key: the key of the newly active environment.
Installing the SDK
Install the Permit SDK in your project. In your terminal, run:
Importing the Permit SDK
Import the Permit SDK. The library wraps the Permit API and the permission checks.
Initializing the Permit object
Initialize the Permit object, your main interface to Permit.
Pass the API key you copied from the Permit dashboard. The SDK uses it to authenticate with the Permit API.
To make the SDK emit logs, add this to your Permit instance:
log: {
level: "debug";
}
To make the SDK throw errors on a timeout or network error, add this to your Permit instance:
throwOnError: true;
Get the project and environment id
Most API calls need your project ID and
environment ID.
To get them, fetch the API Key Scope of your key:
The response looks like this:
Perform your first call to Permit
Make your first API call: create a role with permissions.
This example creates a Manager role with these permissions on an account resource:
- Permission to
read - Permission to
delete
The result:

What did you learn?
In this guide, you've learned how to:
- Fetch your API key.
- Initialize a Permit Object using the
permitiolibrary. - Run your first API call and thus create a new role with permissions.
What's next? 🎉
- Sync your first user into Permit
- Create a new tenant
- Learn about multi tenant authorization
Nice work! Onto the next one.