Skip to main content

The error

{
  "success": false,
  "data": {
    "message": "You do not have enough permissions to execute this request",
    "errorCode": "AB03"
  }
}
This means your API key is missing the required permission scope.

Find your scenario


Understand API key types

Before fixing the error, understand the two key types and how scopes work.

Workspace API keys vs Admin API keys

Scope: Single workspace onlySubtypes:
  • User — For UI/Playground operations
  • Service — For backend automations
Use for:
  • Completions and all data-plane operations
  • Prompts, configs, providers within the workspace
  • Cannot access other workspaces
Created in: Workspace Settings
Admin API keys access workspace-level resources (providers, configs, prompts, integrations) by passing workspace_id as a query parameter (for GET/list requests) or in the request body (for POST/PUT requests). Use a workspace UUID or slug. Workspace API keys are locked to their own workspace and can’t access other workspaces.
curl "https://api.portkey.ai/v1/configs?workspace_id=ws-abc123" \
  -H "x-portkey-api-key: YOUR_ADMIN_KEY"
Data-plane APIs (/v1/chat/completions, /v1/responses, etc.) require Workspace API keys. Org-level operations (audit logs, user management) require Admin API keys.

How permission scopes work

Every API key has permission scopes that control which operations it can perform. Scopes are granular — providers.list does not grant providers.read. Each action requires its own scope. Enable the specific scopes needed when creating or editing an API key:
Workspace API key permission scopes
Admin API key permission scopes

Playground and UI test requests

Most common cause of AB03. Start here if Playground, Prompt Studio, or Model Catalog test requests fail.

Why it happens

Playground, Prompt Studio, and Model Catalog test requests require a Workspace User API key. Service keys don’t work — the UI needs to authenticate your individual session.

Common triggers

  • Only Service API keys exist (no User key)
  • User API key is missing the completions.write scope
  • Multiple User API keys exist, and not all have required scopes

Fix

1

Open workspace API keys

Go to Settings > API Keys in your workspace.
2

Find or create a User API key

Look for an API key with type User. If none exists, create one.
3

Enable completions.write

Edit the User API key and enable:
  • Completions > write (required for all inference calls)
  • Any additional scopes needed (e.g., prompts.read, configs.read)
4

Refresh and retry

Refresh the page and retry your test request.
Multiple User keys? Ensure all User API keys have completions.write enabled — Portkey may use any of them for UI operations.

Completions API and data-plane operations

What you need to know

The completions.write scope gates all data-plane endpoints — not just chat completions.

Endpoints requiring completions.write

EndpointDescription
/v1/chat/completionsChat completions
/v1/completionsText completions
/v1/responsesResponses API
/v1/messagesAnthropic-style messages
/v1/embeddingsEmbeddings
/v1/images/generationsImage generation
/v1/images/editsImage editing
/v1/audio/speechText-to-speech
/v1/audio/transcriptionsAudio transcription
/v1/audio/translationsAudio translation
/v1/filesFile upload, list, get, delete
/v1/batchesBatch create, list, get, cancel
/v1/fine-tuning/jobsFine-tuning jobs
/v1/realtimeRealtime WebSocket
/v1/modelsList models (also works with virtual_keys.list)
/v1/prompts/:id/completionsPrompt completions
/v1/gateway/tokenizeTokenization

Why it happens

Your API key is missing the completions.write scope, or you’re using an Admin API key (Admin keys can’t call data-plane endpoints).

Fix

1

Use a Workspace API key

Data-plane APIs require Workspace API keys (User or Service). Admin keys don’t work.
2

Enable completions.write

Create or edit a Workspace API key and enable Completions > write.
3

Update your code

Replace the API key in your application:
from portkey_ai import Portkey

portkey = Portkey(
    api_key="YOUR_WORKSPACE_API_KEY",  # Must have completions.write scope
)

response = portkey.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}]
)

Listing available models

GET /v1/models requires either completions.write or virtual_keys.list.
Most inference keys already have completions.write, so listing models works automatically. Only add virtual_keys.list for keys that intentionally don’t have completions.write.

Admin API operations

The Admin API covers integrations, providers, users, workspaces, API key management, and other control-plane operations. Each operation requires specific scopes.
Common gotcha: Listing integrations and reading integration details require different scopes. list does not grant read.

Integrations (providers and models)

OperationEndpointRequired scope
List integrationsGET /v1/integrationsorganisation_integrations.list or workspace_integrations.list
Get integration detailsGET /v1/integrations/{slug}organisation_integrations.read or workspace_integrations.read
List models for a providerGET /v1/integrations/{slug}/modelsorganisation_integrations.read or workspace_integrations.read
Create integrationPOST /v1/integrationsorganisation_integrations.create or workspace_integrations.create
Update integrationPUT /v1/integrations/{slug}organisation_integrations.update or workspace_integrations.update
Delete integrationDELETE /v1/integrations/{slug}organisation_integrations.delete or workspace_integrations.delete

Users, workspaces, and API key management

OperationRequired key typeRequired scopes
Create/manage workspacesAdmin API keyworkspaces.create, workspaces.update, etc.
Invite/remove org usersAdmin API keyorganisation_users.create, organisation_users.delete, etc.
Manage workspace membersWorkspace API keyworkspace_users.create, workspace_users.update, etc.
Create/manage org API keysAdmin API keyorganisation_service_api_keys.*
Create/manage workspace API keysWorkspace API keyworkspace_service_api_keys.*, workspace_user_api_keys.*

Resource management (prompts, configs, guardrails, providers)

ResourceScope pattern
Promptsprompts.create / read / update / delete / list / publish / render
Configsconfigs.create / read / update / delete / list
Guardrailsguardrails.create / read / update / delete / list
Providersproviders.create / read / update / delete / list and virtual_keys.create / read / update / delete / list / copy / duplicate
Policiespolicies.create / read / update / delete / list
“Virtual Keys” are now called Providers in the UI. API scopes still use both virtual_keys.* and providers.* — both may be needed depending on the operation.

Fix

Edit the API key and add the required scopes. When in doubt, use Select All to grant all permissions.
Plan restriction: Some Admin API endpoints (like programmatic API key creation) require Enterprise plans. If scopes are correct but requests still fail, verify your plan includes Admin API access.

Logs, feedback, analytics, and audit logs

OperationRequired scopeRequired key type
View analyticsanalytics.viewWorkspace or Admin
View log detailslogs.viewWorkspace or Admin
List logslogs.listWorkspace or Admin
Export logslogs.exportWorkspace or Admin
List audit logsaudit_logs.listAdmin API key only
Audit logs require an Admin API key. Workspace keys can’t access audit logs regardless of scopes. Ensure the Admin key has audit_logs.list enabled.

MCP servers and integrations

OperationRequired scope
Createmcp_servers.create
Readmcp_servers.read
Updatemcp_servers.update
Deletemcp_servers.delete
Listmcp_servers.list

General troubleshooting

If none of the above scenarios match, work through these checks:
TaskRequired key
Playground / UI test featuresWorkspace User API key
Completions from code/SDKWorkspace API key (User or Service)
Org settings, users, workspacesAdmin API key
Workspace resources (configs, prompts, etc.)Workspace API key, or Admin API key with workspace_id
Audit logsAdmin API key
Each operation requires its own scope. Common mistakes:
  • Having list but not read (or vice versa)
  • Having read but not write or create
  • Missing completions.write for inference calls
RoleAccess
Org OwnerFull access to org and all workspaces
Org AdminFull access except billing
Org MemberRead-only on org resources
Workspace AdminFull workspace operations
Workspace ManagerFull workspace operations (except admin-only settings)
Workspace MemberRead + create/update prompts, configs
  • Wrong key type — Using Admin key for completions, or Service key for Playground
  • Plan restriction — Some Admin API endpoints require Enterprise plans
  • Stale session — Log out and back in, or clear browser cache
  • Multiple User API keys — All User keys need the required scopes
Wrong workspace can look like a permission error. Many endpoints return AB03 when a resource (config, provider, prompt, API key) doesn’t exist in the workspace. The fix isn’t changing scopes — it’s using the correct workspace. Verify the resource exists in the correct workspace, or use an Admin API key with the workspace_id parameter.
Org security settings override scopes. Organization admins can restrict members from viewing API keys, providers, or configs via Admin Settings > Security. When active, affected users get AB03 even with correct scopes and key type. Check with your org admin if everything looks correct but you still see the error.

5. Still stuck?

Contact [email protected] with:
  • Workspace ID
  • Full error response (including request_id)
  • Endpoint called
  • API key type (Admin / Workspace User / Workspace Service)

Complete scope reference

Organization management
ScopeDescription
organisation_users.create / read / update / delete / listManage org users
organisation_service_api_keys.create / read / update / delete / listManage org service API keys
audit_logs.listView audit logs
Workspace management
ScopeDescription
workspaces.create / read / update / delete / listManage workspaces
workspace_service_api_keys.create / read / update / delete / listManage workspace service API keys
workspace_user_api_keys.create / read / update / delete / listManage workspace user API keys
workspace_users.create / read / update / delete / listManage workspace users
Integrations
ScopeDescription
workspace_integrations.create / read / update / delete / listManage workspace integrations
organisation_integrations.create / read / update / delete / listManage org integrations
organisation_mcp_integrations.create / read / update / delete / listManage org MCP integrations
workspace_mcp_integrations.create / read / update / delete / listManage workspace MCP integrations
mcp_servers.create / read / update / delete / listManage MCP servers
Resources
ScopeDescription
providers.create / read / update / delete / listManage providers
virtual_keys.create / read / copy / update / delete / list / duplicateManage providers (legacy scope name)
plugins.create / update / listManage plugins
policies.create / read / update / delete / listManage policies
prompts.create / read / update / delete / list / publishManage prompts
configs.create / read / update / delete / listManage configs
guardrails.create / read / update / delete / listManage guardrails
Monitoring
ScopeDescription
analytics.viewView analytics
logs.view / list / write / exportManage logs
Inference (data plane)
ScopeDescription
mcp.invokeInvoke MCP tools
completions.writeAll data-plane operations (chat completions, responses, files, batches, fine-tuning, realtime, etc.)
Workspace management
ScopeDescription
workspaces.read / update / listView/update workspace
workspace_service_api_keys.create / read / update / delete / listManage workspace service API keys
workspace_user_api_keys.create / read / update / delete / listManage workspace user API keys
workspace_users.create / read / update / delete / listManage workspace users
Integrations
ScopeDescription
organisation_integrations.listList org integrations
organisation_mcp_integrations.listList org MCP integrations
workspace_integrations.create / read / update / delete / listManage workspace integrations
workspace_mcp_integrations.create / read / update / delete / listManage workspace MCP integrations
mcp_servers.create / read / update / delete / listManage MCP servers
Resources
ScopeDescription
providers.create / read / update / delete / listManage providers
virtual_keys.create / read / copy / update / delete / list / duplicateManage providers (legacy scope name)
policies.create / read / update / delete / listManage policies
prompts.create / read / update / delete / list / publish / renderManage prompts
configs.create / read / update / delete / listManage configs
guardrails.create / read / update / delete / listManage guardrails
Monitoring
ScopeDescription
analytics.viewView analytics
logs.view / list / write / exportManage logs

Last modified on February 17, 2026