API Reference
Virtual Keys
Prompts
- POSTCreate Prompt
- GETList Prompts
- GETRetrieve Prompt
- PUTUpdate Prompt
- DELDelete Prompt
- PUTPublish Prompt
- GETList Prompt Versions
- GETRetrieve Prompt Version
- PUTUpdate Prompt Version
- Prompt Partials
- Prompt Labels
- Prompt Collections
API Keys
Analytics [BETA]
- Summary
- Groups Paginated Data
- Graphs - Time Series Data
User Invites
Workspaces
Workspace Members
Audit Logs
OpenAPI
Create API Key
POST
/
api-keys
/
{type}
/
{sub-type}
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY",
)
# Create a new API key
api_key = portkey.api_keys.create(
name="API_KEY_NAME_0909",
type="organisation",
sub_type="service",
workspace_id="WORKSPACE_ID",
scopes=[
"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.read",
"virtual_keys.list",
"virtual_keys.copy"
]
)
print(api_key)
{
"id": "183f497a-2a7f-4f47-992e-26213fa863we",
"key": "abssofjosfjs",
"object": "api-key"
}
Authorizations
Path Parameters
Available options:
organisation
, workspace
Available options:
user
, service
Body
application/json
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",
)
# Create a new API key
api_key = portkey.api_keys.create(
name="API_KEY_NAME_0909",
type="organisation",
sub_type="service",
workspace_id="WORKSPACE_ID",
scopes=[
"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.read",
"virtual_keys.list",
"virtual_keys.copy"
]
)
print(api_key)
{
"id": "183f497a-2a7f-4f47-992e-26213fa863we",
"key": "abssofjosfjs",
"object": "api-key"
}