This self-service model allows developers to programmatically generate task-specific keys for CLI and IDE scans via the Public API. By using a Primary API key as a master credential, developers can provision restricted-access keys, such as read-only for local scans, without requiring administrative permissions in the UI. This approach maintains tenant security by ensuring all scans follow the principle of least privilege.
Prerequisite: You must have sufficient administrative permissions within your tenant to create new roles and manage API keys.
IMPORTANT: When generating an API key, ensure you select the Standard security level. CLI scans will fail if the security level of the API key is set to Advanced.
If the user creating the Primary Key is an Instance Admin or Account Admin, follow the simplified workflow (Path A). Otherwise, follow the full flow (Path B).
Path A: Admin flow
Follow this procedure if you have Instance Admin or Account Admin privileges. Because you already hold tenant-wide permissions, you do not need to assign CLI roles to your user account via User Groups. You can skip those steps (required for non-admins) and attach the default CLI roles directly to the API key.
Create a Public API (PAPI) Edit role (no default exists for this). Refer to the Public API (PAPI) Edit row in Create custom roles below for more information.
Proceed directly to the Generate and use API keys section below to provision your Primary Key.
Path B: Non-admin flow
The following procedure is required for non-admin users, because the built-in CLI and CLI Read Only roles are not visible in the API Keys screen for non-admins.
Create custom roles
Navigate to your role management settings in the tenant to generate the following three roles with these exact permission sets.
Role name | Required permission and description |
|---|---|
CLI Read-Only Custom | CLI Tools View: Grants permission to run CLI scans and view output locally without uploading results to the tenant |
CLI Write Custom | CLI Tools View/Edit: Grants permission to run CLI scans and upload/manage results within the tenant |
Public API (PAPI) Edit | Public API View/Edit: Grants the administrative permission required to programmatically generate and manage new API keys |
Assign roles to a privileged user
To establish a Primary key holder, you must grant a specific privileged user the permissions from all three custom roles. Because the UI allows only one role to be assigned directly to a user, you must use User Groups to grant multiple roles simultaneously.
Create user groups: Create three separate User Groups in your tenant, assigning one of the custom roles to each group.
Add user to groups: Add the designated privileged user to all three of these User Groups.
Verify accumulated permissions: Edit the primary user and ensure that the User Groups field includes the three User Groups.
This user now has the combined authority to generate the Primary API Key required to set up programmatic key generation.
Verify API key status
To ensure the keys are configured correctly, privileged users can verify their status by navigating to → . Locate the generated key in the API Keys inventory and confirm that the Role column reflects the specific custom role assigned rather than a broad administrative role.
Reference
For more information about generating API Keys, refer to Manage API keys.