Create a workspace API key
admin.api_keys.create(APIKeyCreateParams**kwargs) -> APIKeyCreateResponse
POST/compute/v1/admin/api-keys
Create a workspace API key
Parameters
name: str
API key name
minLength1
maxLength255
IP addresses allowed to use this key (IPv4 or IPv6). An empty array (the default) means all IPs are allowed.
expires_in_days: Optional[int]
Days until the key expires. Omit for a key that does not expire.
minimum1
maximum365
workspace_id: Optional[str]
Workspace ID to scope this key to. Omit for default workspace.
Returns
Create a workspace API key
import os
from boltz_api import Boltz
client = Boltz(
api_key=os.environ.get("BOLTZ_API_KEY"), # This is the default and can be omitted
)
api_key = client.admin.api_keys.create(
name="x",
)
print(api_key.key){
"key": "key",
"key_details": {
"id": "id",
"allowed_ips": [
"string"
],
"created_at": "2019-12-27T18:11:19.117Z",
"expires_at": "2019-12-27T18:11:19.117Z",
"is_active": true,
"key_prefix": "key_prefix",
"key_type": "workspace",
"last_used_at": "2019-12-27T18:11:19.117Z",
"livemode": true,
"name": "name",
"workspace_id": "workspace_id"
}
}Returns Examples
{
"key": "key",
"key_details": {
"id": "id",
"allowed_ips": [
"string"
],
"created_at": "2019-12-27T18:11:19.117Z",
"expires_at": "2019-12-27T18:11:19.117Z",
"is_active": true,
"key_prefix": "key_prefix",
"key_type": "workspace",
"last_used_at": "2019-12-27T18:11:19.117Z",
"livemode": true,
"name": "name",
"workspace_id": "workspace_id"
}
}