POST
/
admin
/
workspaces
from portkey_ai import Portkey

# Initialize the Portkey client
portkey = Portkey(
    api_key="PORTKEY_API_KEY",
)

# Add a workspace
workspace = portkey.admin.workspaces.create(
    name='WORKSPACE_NAME_0909',
    description="WORKSPACE_DESCRIPTION",
    defaults={
        "metadata": {
            "environment": "production",
            "foo": "bar"
        }
    }
)

print(workspace)
{
  "id": "ws-test-a-174eb1",
  "slug": "ws-test-a-174eb1",
  "name": "New Workspace",
  "description": null,
  "created_at": "2024-07-30T13:27:29.000Z",
  "last_updated_at": "2024-07-30T13:27:29.000Z",
  "defaults": {
    "metadata": {
      "foo": "bar"
    },
    "is_default": 0,
    "object": "workspace"
  }
}

Authorizations

x-portkey-api-key
string
header
required

Body

application/json
name
string
description
string
defaults
object
users
string[]

Response

200 - application/json
OK
id
string
Example:

"ws-test-a-174eb1"

slug
string
Example:

"ws-test-a-174eb1"

name
string
Example:

"New Workspace"

description
string | null
Example:

null

created_at
string
Example:

"2024-07-30T13:27:29.000Z"

last_updated_at
string
Example:

"2024-07-30T13:27:29.000Z"

defaults
object | null