> ## Documentation Index
> Fetch the complete documentation index at: https://portkey-docs-feat-alice-guardrail-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# API Keys (AuthN and AuthZ)

> Discover how Admin and Workspace API Keys are used to manage access and operations in Portkey.

## API Keys

Portkey uses two types of API keys to manage access to resources and operations: **Admin API Keys** and **Workspace API Keys**. These keys play crucial roles in authenticating and authorizing various operations within your [organization](/product/enterprise-offering/org-management/organizations) and [workspaces](/api-reference/admin-api/control-plane/workspaces/create-workspace).

### Admin API Keys

Admin API Keys operate at the organization level and provide broad access across all workspaces within an organization.

Key features of Admin API Keys:

* Created and managed by organization owners and admins
* Provide access to organization-wide operations
* Can perform actions across all workspaces in the organization
* Used for administrative tasks and integrations that require broad access
* When making updates to entities, can specify a workspace\_id to target specific workspaces

Admin API Keys should be carefully managed and their use should be limited to necessary administrative operations due to their broad scope of access.

#### Admin API Key Permission Scopes

<AccordionGroup>
  <Accordion title="Organization Management" icon="building">
    | Scope | Description |
    | - | - |
    | `organisation_users.create` | Create new users in the organization |
    | `organisation_users.read` | View organization user details |
    | `organisation_users.update` | Modify organization user settings |
    | `organisation_users.delete` | Remove users from the organization |
    | `organisation_users.list` | List all organization users |
    | `organisation_service_api_keys.create` | Create new organization service API keys |
    | `organisation_service_api_keys.update` | Modify organization service API keys |
    | `organisation_service_api_keys.read` | View organization service API key details |
    | `organisation_service_api_keys.delete` | Delete organization service API keys |
    | `organisation_service_api_keys.list` | List all organization service API keys |
    | `audit_logs.list` | Access system-wide audit logs |
  </Accordion>

  <Accordion title="Workspace Management" icon="folder-tree">
    | Scope | Description |
    | - | - |
    | `workspaces.create` | Create new workspaces |
    | `workspaces.read` | View workspace details |
    | `workspaces.update` | Modify workspace settings |
    | `workspaces.delete` | Delete workspaces |
    | `workspaces.list` | List all workspaces |
    | `workspace_service_api_keys.create` | Create new workspace service API keys |
    | `workspace_service_api_keys.update` | Modify workspace service API keys |
    | `workspace_service_api_keys.read` | View workspace service API key details |
    | `workspace_service_api_keys.delete` | Delete workspace service API keys |
    | `workspace_service_api_keys.list` | List all workspace service API keys |
    | `workspace_user_api_keys.create` | Create new workspace user API keys |
    | `workspace_user_api_keys.update` | Modify workspace user API keys |
    | `workspace_user_api_keys.read` | View workspace user API key details |
    | `workspace_user_api_keys.delete` | Delete workspace user API keys |
    | `workspace_user_api_keys.list` | List all workspace user API keys |
    | `workspace_users.create` | Create new workspace users |
    | `workspace_users.read` | View workspace user details |
    | `workspace_users.update` | Update workspace user settings |
    | `workspace_users.delete` | Remove users from workspace |
    | `workspace_users.list` | List workspace users |
  </Accordion>

  <Accordion title="Resource Management" icon="screwdriver-wrench">
    | Scope | Description |
    | - | - |
    | `prompts.create` | Create new prompt templates |
    | `prompts.read` | View prompt template details |
    | `prompts.update` | Modify existing prompt templates |
    | `prompts.delete` | Delete prompt templates |
    | `prompts.list` | List available prompt templates |
    | `prompts.publish` | Publish prompt templates |
    | `configs.create` | Create new configurations |
    | `configs.update` | Update existing configurations |
    | `configs.delete` | Delete configurations |
    | `configs.read` | View configuration details |
    | `configs.list` | List available configurations |
    | `virtual_keys.create` | Create new virtual keys |
    | `virtual_keys.update` | Update existing virtual keys |
    | `virtual_keys.delete` | Delete virtual keys |
    | `virtual_keys.duplicate` | Duplicate existing virtual keys |
    | `virtual_keys.read` | View virtual key details |
    | `virtual_keys.list` | List available virtual keys |
    | `virtual_keys.copy` | Copy virtual keys between workspaces |
  </Accordion>

  <Accordion title="Analytics and Logs" icon="chart-line">
    | Scope | Description |
    | - | - |
    | `analytics.view` | Access analytics data |
    | `logs.export` | Export logs to external systems |
    | `logs.list` | List available logs |
    | `logs.view` | View log details |
  </Accordion>
</AccordionGroup>

### Workspace API Keys

Workspace API Keys are scoped to a specific workspace and are used for operations within that workspace only.

Key features of Workspace API Keys:

* Two types: Service Account and User
  * Service Account: Used for automated processes and integrations
  * User: Associated with individual user accounts for personal access
* Scoped to a single workspace by default
* Can only execute actions within the workspace they belong to
* Used for most day-to-day operations and integrations within a workspace
* Completion APIs are always scoped by workspace and can only be accessed using Workspace API Keys
* Can be created and managed by workspace managers

Workspace API Keys provide a more granular level of access control, allowing you to manage permissions and resource usage at the project or team level.

#### Workspace API Key Permission Scopes

<AccordionGroup>
  <Accordion title="Workspace Management" icon="folder-tree">
    | Scope | Description |
    | - | - |
    | `workspaces.read` | View workspace details |
    | `workspaces.update` | Modify workspace settings |
    | `workspaces.list` | List available workspaces |
    | `workspace_service_api_keys.create` | Create new workspace service API keys |
    | `workspace_service_api_keys.update` | Modify workspace service API keys |
    | `workspace_service_api_keys.read` | View workspace service API key details |
    | `workspace_service_api_keys.delete` | Delete workspace service API keys |
    | `workspace_service_api_keys.list` | List all workspace service API keys |
    | `workspace_user_api_keys.create` | Create new workspace user API keys |
    | `workspace_user_api_keys.update` | Modify workspace user API keys |
    | `workspace_user_api_keys.read` | View workspace user API key details |
    | `workspace_user_api_keys.delete` | Delete workspace user API keys |
    | `workspace_user_api_keys.list` | List all workspace user API keys |
    | `workspace_users.create` | Create new workspace users |
    | `workspace_users.read` | View workspace user details |
    | `workspace_users.update` | Update workspace user settings |
    | `workspace_users.delete` | Remove users from workspace |
    | `workspace_users.list` | List workspace users |
  </Accordion>

  <Accordion title="LLM Operations" icon="robot">
    | Scope | Description |
    | - | - |
    | `completions.write` | Create and manage completions (includes /chat/completions, /completions, /images, /audio) |
    | `prompts.create` | Create new prompt templates |
    | `prompts.read` | View prompt template details |
    | `prompts.update` | Modify existing prompt templates |
    | `prompts.delete` | Delete prompt templates |
    | `prompts.list` | List available prompt templates |
    | `prompts.publish` | Publish prompt templates |
    | `prompts.render` | Render prompt templates |
  </Accordion>

  <Accordion title="Resources" icon="server">
    | Scope | Description |
    | - | - |
    | `configs.create` | Create new configurations |
    | `configs.update` | Update existing configurations |
    | `configs.delete` | Delete configurations |
    | `configs.read` | View configuration details |
    | `configs.list` | List available configurations |
    | `virtual_keys.create` | Create new virtual keys |
    | `virtual_keys.update` | Update existing virtual keys |
    | `virtual_keys.delete` | Delete virtual keys |
    | `virtual_keys.duplicate` | Duplicate existing virtual keys |
    | `virtual_keys.read` | View virtual key details |
    | `virtual_keys.list` | List available virtual keys |
    | `virtual_keys.copy` | Copy virtual keys between workspaces |
  </Accordion>

  <Accordion title="Analytics and Logs" icon="chart-line">
    | Scope | Description |
    | - | - |
    | `analytics.view` | Access analytics data |
    | `logs.export` | Export logs to external systems |
    | `logs.list` | List available logs |
    | `logs.view` | View log details |
    | `logs.write` | Create and modify logs |
  </Accordion>
</AccordionGroup>

## Using API Key Scopes

When creating or updating API keys, you can define specific permission scopes based on your security requirements:

Both types of API keys play important roles in Portkey's security model, enabling secure and efficient access to resources while maintaining proper separation of concerns between organization-wide administration and workspace-specific operations.

### Related Topics

<Card title="Organizations" href="/product/enterprise-offering/org-management/organizations" />

<Card title="Workspaces" href="/api-reference/admin-api/control-plane/workspaces/create-workspace" />

<Card title="User Roles & Permissions" href="/product/enterprise-offering/org-management/user-roles-and-permissions" />


## Related topics

- [Workspaces](/virtual_key_old/product/enterprise-offering/org-management/workspaces.md)
- [User Roles & Permissions](/virtual_key_old/product/enterprise-offering/org-management/user-roles-and-permissions.md)
- [Configure API Key Access Permissions for Workspaces](/virtual_key_old/product/administration/configure-api-key-access-permissions.md)
- [Error AB03: You do not have enough permissions](/help-center/you-do-not-have-enough-permissions.md)
- [Org Management](/virtual_key_old/product/enterprise-offering/org-management.md)
