API Keys
Update API Key
API Reference
Virtual Keys
API Keys
Analytics [BETA]
- Summary
- Groups Paginated Data
- Graphs - Time Series Data
User Invites
Workspaces
Workspace Members
OpenAPI
Update API Key
PUT
/
api-keys
/
{id}
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY",
)
# Update the API key
updated_api_key = portkey.api_keys.update(
id="API_KEY_ID",
name="API_KEY_NAME_0909",
rate_limits=[
{
"type": "requests",
"unit": "rpm",
"value": 100
}
],
scopes=[
"organisation_users.create", "organisation_users.read", "organisation_users.update",
"organisation_users.delete", "organisation_users.list",
"organisation_service_api_keys.create", "organisation_service_api_keys.update",
"organisation_service_api_keys.read", "organisation_service_api_keys.delete",
"organisation_service_api_keys.list", "workspaces.delete", "workspaces.create",
"workspaces.read", "workspaces.update", "workspaces.list", "logs.export",
"logs.list", "logs.view", "configs.create", "configs.update", "configs.delete",
"configs.read", "configs.list", "virtual_keys.create", "virtual_keys.update",
"virtual_keys.delete", "virtual_keys.duplicate", "virtual_keys.read",
"virtual_keys.list", "virtual_keys.copy", "workspace_service_api_keys.create",
"workspace_service_api_keys.delete", "workspace_service_api_keys.update",
"workspace_service_api_keys.read", "workspace_service_api_keys.list",
"workspace_user_api_keys.create", "workspace_user_api_keys.delete",
"workspace_user_api_keys.update", "workspace_user_api_keys.read",
"workspace_user_api_keys.list", "workspace_users.create", "workspace_users.read",
"workspace_users.update", "workspace_users.delete", "workspace_users.list",
"analytics.view"
]
)
print(updated_api_key)
{}
Authorizations
Path Parameters
Body
application/json
Example:
"Development API Key"
Example:
"API key for development environment"
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
Example:
{
"credit_limit": 10,
"periodic_reset": "monthly",
"alert_threshold": 8
}
Example:
["completions.write"]
Response
200 - application/json
OK
The response is of type object
.
Was this page helpful?
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY",
)
# Update the API key
updated_api_key = portkey.api_keys.update(
id="API_KEY_ID",
name="API_KEY_NAME_0909",
rate_limits=[
{
"type": "requests",
"unit": "rpm",
"value": 100
}
],
scopes=[
"organisation_users.create", "organisation_users.read", "organisation_users.update",
"organisation_users.delete", "organisation_users.list",
"organisation_service_api_keys.create", "organisation_service_api_keys.update",
"organisation_service_api_keys.read", "organisation_service_api_keys.delete",
"organisation_service_api_keys.list", "workspaces.delete", "workspaces.create",
"workspaces.read", "workspaces.update", "workspaces.list", "logs.export",
"logs.list", "logs.view", "configs.create", "configs.update", "configs.delete",
"configs.read", "configs.list", "virtual_keys.create", "virtual_keys.update",
"virtual_keys.delete", "virtual_keys.duplicate", "virtual_keys.read",
"virtual_keys.list", "virtual_keys.copy", "workspace_service_api_keys.create",
"workspace_service_api_keys.delete", "workspace_service_api_keys.update",
"workspace_service_api_keys.read", "workspace_service_api_keys.list",
"workspace_user_api_keys.create", "workspace_user_api_keys.delete",
"workspace_user_api_keys.update", "workspace_user_api_keys.read",
"workspace_user_api_keys.list", "workspace_users.create", "workspace_users.read",
"workspace_users.update", "workspace_users.delete", "workspace_users.list",
"analytics.view"
]
)
print(updated_api_key)
{}