Permit CLI
The Permit CLI is an open-source command-line tool that empowers developers to manage, test, and automate fine-grained access control across applications.
Designed with developer experience in mind, the CLI makes it easy to integrate Fine-Grained Authorization (FGA) and manage, test, and deploy access control logic across various systems, including OPA, OPAL, CEDAR, AVP, OpenFGA, and the Permit.io service.
What You Can Do with Permit CLI
- ⚙️ Create and manage authorization policies in projects and environments
- 🧪 Test and validate access control with audit log replays and end-to-end simulations
- 🚀 Run and interact with Policy Decision Points (PDPs) locally or remotely
- 🏗️ Automate policy operations in CI/CD with IaC and GitOps
- ✨ Generate policies from natural language using AI
- 🔐 Manage users, roles, and permissions directly from your terminal
:bulb: The CLI is fully open source and is built with Pastel, using TypeScript and a React-style architecture. Contributions welcome!
Installation
The Permit CLI is now available only via npm and requires a Node.js installation to run.
npm install -g @permitio/cli
Usage
All the commands in the CLI are available via the permit command in the following convention:
$ permit [command] [options]
For example:
$ permit pdp check --user user@permit.io --action list --resource transactions
Full Command-List
Below is a categorized overview of all available Permit CLI commands:
In-Depth Command Overview
Basic Commands: Authentication
permit login
You must log in to your Permit.io account to run commands.
The login command will take you to the browser to perform user authentication and then let you choose the workspace, project, and environment for future command runs.
Arguments (Optional):
--api-key <string> - store a Permit API key in your workstation keychain instead of running browser authentication
--workspace <string> - predefined workspace key to skip the workspace selection step
--region <us> - specify the Permit region to use (default: us). us is the only supported region.
Examples:
Login with the default region:
$ permit login
Region Support:
All Permit.io accounts are served from the US region (https://api.permit.io).
The EU region (eu) was retired on 2026-09-28. If you previously logged in with --region eu, or have PERMIT_REGION=eu set, the CLI stops with an error before making any request. To fix it, unset PERMIT_REGION and log in again:
$ unset PERMIT_REGION
$ permit logout
$ permit login
permit logout
This command will log you out of your Permit account and remove the stored key from your workspace.
Example:
$ permit logout
Basic Commands: Policy Decision Point (PDP) Operations
This collection of commands aims to improve the experience of working with the PDPs (Permit PDP or Open Policy Agent).
permit pdp run
Use this command to run a Permit PDP Docker container configured with your Permit.io account details. The command will start the container in detached mode and display the container ID and name.
Arguments (Optional):
--api-key <string> - use a specific API key instead of the stored one
--opa <number> - expose the OPA instance running in the PDP
--dry-run - print the Docker command without executing it
Examples:
Run the PDP container
$ permit pdp run
Run the PDP container with OPA exposed on port 8181
$ permit pdp run --opa 8181
Print the Docker command without running the container:
$ permit pdp run --dry-run
Run the PDP with a specific API key:
$ permit pdp run --api-key your_api_key
permit pdp check
Use this command to perform an authorization check against the PDP. The command will take the user, action, and resource (and some other enrichment arguments) as options and return the decision.
Arguments (Required):
--user <string> - the user ID to check the authorization for
--action <string> - the action to check the authorization for
--resource <string> - the resource to check the authorization for
Arguments (Optional):
--tenant <string> - the tenant to check the authorization for (default: default)
--pdpurl <string> - the PDP URL to check the authorization against (default: http://localhost:7676)
--user-attributes - additional user attributes to enrich the authorization check in the format: key1=value1,key2=value2
-resource-attributes - additional resource attributes to enrich the authorization check in the format key1=value1,key2=value2
Example:
$ permit pdp check --user eventHandler --action update --resource Widget:dashboard-1-widget
permit pdp stats
Use this command to view statistics about your PDP's performance and usage. This is useful for monitoring and debugging your PDP instance.
Arguments (Optional):
--project-key <string> - The project key
--environment-key <string> - the environment key
--stats-url <string> - the URL of the PDP service. Default to the cloud PDP
--api-key <string> - the API key for the Permit env, project, or Workspace
--top - run stats in top mode (default: false)
Example:
$ permit pdp stats
SDLC
Automate environment creation and management
Use CLI commands to create, copy, and manage environments
permit env create
This command creates a new environment in a specified project. This is useful for setting up new environments for development, testing, or production.
Arguments (Optional):
--api-key <string> - a Permit API key to authenticate the operation. If not provided, the command will use your stored credentials.
--name <string> - the name of the new environment (will prompt if not provided)
--env-key <string> - the key for the new environment (will be derived from name if not provided)
--description <string> - the description of the new environment
--customBranchName - customizes the GitOps branch name of this environment (default is set to the environment ID)
--jwks <string> - JSON Web Key Set (JWKS) for frontend login, in JSON format
--settings <string> - environment settings in JSON format
Examples:
$ permit env create --api-key permit_key --name "Staging" --description "Staging environment for testing"
You can also create a complex environment with all options:
$ permit env create --api-key permit_key --name "Development" --envKey "dev" --description "Dev environment" --customBranchName "dev-branch" --jwks '{"ttl": 3600}' --settings '{"debug": true}'
permit env copy
Developers and CI pipelines can use this command to enable secure blue-green deployment in the Software Development Lifecycle (SDLC). The command will get the source and destination environments as options and copy the policies from one to another.