Control Plane
- Configs
- Virtual Keys
- API Keys
- Analytics [BETA]
- Users
- User Invites
- Workspaces
- Workspace Members
Data Plane
- Feedback
- Guardrails
- Logs
OpenAPI
List API Key
GET
/
api-keys
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY",
)
# List API keys
api_keys = portkey.api_keys.list(
workspace_id="WORKSPACE_SLUG"
)
print(api_keys)
{
"total": 2,
"object": "list",
"data": [
{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"key": "Xk*******S4",
"name": "Development API Key",
"description": "API key for development environment",
"type": "organisation-service",
"organisation_id": "a1b2c3d4-e5f6-4a5b-8c7d-9e0f1a2b3c4d",
"workspace_id": "ws-myworkspace",
"user_id": "c3d4e5f6-a7b8-6c7d-0e1f-2a3b4c5d6e7f",
"status": "active",
"created_at": "2023-09-15T10:30:00Z",
"last_updated_at": "2023-09-15T10:30:00Z",
"creation_mode": "ui",
"rate_limits": [
{
"type": "requests",
"unit": "rpm",
"value": 100
}
],
"usage_limits": {
"credit_limit": 10,
"periodic_reset": "monthly",
"alert_threshold": 8
},
"reset_usage": 0,
"scopes": [
"completions.write"
],
"defaults": {
"metadata": {
"environment": "development",
"team": "backend"
},
"config_id": "config-abc"
},
"alert_emails": [
"[email protected]"
],
"object": "api-key"
}
]
}
Authorizations
Response
200 - application/json
OK
Available options:
list
Available options:
organisation-service
, workspace-service
, workspace-user
Available options:
active
, exhausted
Available options:
ui
, api
, auto
Credit Limit. Used for tracking usage
Required range:
x >= 1
Alert Threshold. Used for alerting when usage reaches more than this
Required range:
x >= 1
Reset the usage periodically.
Available options:
monthly
Available options:
api-key
Was this page helpful?
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY",
)
# List API keys
api_keys = portkey.api_keys.list(
workspace_id="WORKSPACE_SLUG"
)
print(api_keys)
{
"total": 2,
"object": "list",
"data": [
{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"key": "Xk*******S4",
"name": "Development API Key",
"description": "API key for development environment",
"type": "organisation-service",
"organisation_id": "a1b2c3d4-e5f6-4a5b-8c7d-9e0f1a2b3c4d",
"workspace_id": "ws-myworkspace",
"user_id": "c3d4e5f6-a7b8-6c7d-0e1f-2a3b4c5d6e7f",
"status": "active",
"created_at": "2023-09-15T10:30:00Z",
"last_updated_at": "2023-09-15T10:30:00Z",
"creation_mode": "ui",
"rate_limits": [
{
"type": "requests",
"unit": "rpm",
"value": 100
}
],
"usage_limits": {
"credit_limit": 10,
"periodic_reset": "monthly",
"alert_threshold": 8
},
"reset_usage": 0,
"scopes": [
"completions.write"
],
"defaults": {
"metadata": {
"environment": "development",
"team": "backend"
},
"config_id": "config-abc"
},
"alert_emails": [
"[email protected]"
],
"object": "api-key"
}
]
}