Create a Portkey API key for auth. Org keys grant broader access; workspace keys are scoped. WARNING: The key secret is returned ONCE in the tool result and will be visible in MCP transcripts and LLM context — store it securely immediately. Using the key grants access immediately according to its...
AI agents use create_api_key to create or update resources in Portkey Admin — usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your Portkey Admin environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name for the API key |
type | string | Yes | Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped |
scopes | array | Yes | Permission scopes for the key (e.g., ['logs.read', 'analytics.read']) |
user_id | string | — | User ID (required for user sub-type keys) |
sub_type | string | Yes | Sub-type: 'user' for user-associated keys or 'service' for service accounts |
expires_at | string | — | Expiration date in ISO 8601 format |
description | string | — | Optional description for the key |
alert_emails | array | — | Email addresses for alerts |
credit_limit | number | — | Credit limit for usage |
workspace_id | string | — | Workspace ID (required for workspace-type keys) |
rate_limit_rpm | number | — | Rate limit in requests per minute |
alert_threshold | number | — | Alert threshold percentage (0-100) |
Parameters from the server's own tool schema.
An AI agent can call create_api_key faster than any human can review — one bad instruction and it creates or modifies resources in Portkey Admin by the hundred, each call as confident as the last.
Risk signalsHigh parameter count (14 properties)
Attacks that exploit this kind of access
Create a Portkey API key for auth. Org keys grant broader access; workspace keys are scoped. WARNING: The key secret is returned ONCE in the tool result and will be visible in MCP transcripts and LLM context — store it securely immediately. Using the key grants access immediately according to its scopes, defaults, and limits. Workspace keys require workspace_id and user keys require user_id. It is categorised as a Write tool in the Portkey Admin MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.
create_api_key accepts 12 parameters: name, type, scopes, user_id, sub_type, expires_at, description, alert_emails, credit_limit, workspace_id, rate_limit_rpm, alert_threshold. Required: name, type, scopes, sub_type. The full parameter table on this page comes from the server's own tool schema.
Register the Portkey Admin MCP server in PolicyLayer and add a rule for create_api_key: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Portkey Admin. Nothing to install.
create_api_key is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.
Yes. Add a rate_limit block to the create_api_key rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for create_api_key. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
create_api_key is provided by the Portkey Admin MCP server (CodesWhat/portkey-admin-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.