Portkey Workspaces API

Create and manage workspaces.

OpenAPI Specification

portkey-workspaces-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Portkey Analytics > Graphs Workspaces API
  description: The Portkey REST API. Please see https://portkey.ai/docs/api-reference for more details.
  version: 2.0.0
  termsOfService: https://portkey.ai/terms
  contact:
    name: Portkey Developer Forum
    url: https://portkey.wiki/community
  license:
    name: MIT
    url: https://github.com/Portkey-AI/portkey-openapi/blob/master/LICENSE
servers:
- url: https://api.portkey.ai/v1
  description: Portkey API Public Endpoint
security:
- Portkey-Key: []
tags:
- name: Workspaces
  description: Create and manage workspaces.
paths:
  /admin/workspaces:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_CONTROL_PLANE_URL
      description: Self-Hosted Control Plane URL
    post:
      tags:
      - Workspaces
      summary: Create Workspace
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                defaults:
                  type: object
                  properties:
                    metadata:
                      type: object
                      additionalProperties:
                        type: string
                users:
                  type: array
                  items:
                    type: string
                usage_limits:
                  type: array
                  items:
                    $ref: '#/components/schemas/UsageLimits'
                rate_limits:
                  type: array
                  items:
                    $ref: '#/components/schemas/RateLimits'
              example:
                name: My Workspace
                description: My Description
                defaults:
                  metadata:
                    environment: production
                    foo: bar
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Add a workspace\nworkspace = portkey.admin.workspaces.create(\n    name='WORKSPACE_NAME_0909',\n    description=\"WORKSPACE_DESCRIPTION\",\n    defaults={\n        \"metadata\": {\n            \"environment\": \"production\",\n            \"foo\": \"bar\"\n        }\n    }\n)\n\nprint(workspace)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst workspace=await portkey.admin.workspaces.create({\n    name: 'WORKSPACE_NAME_0909',\n    description: \"WORKSPACE_DESCRIPTION\",\n    defaults: {\n        metadata: {\n          environment: \"production\",\n          foo: \"bar\"\n        }\n      }\n})\nconsole.log(workspace);\n"
      - lang: curl
        label: Default
        source: "curl -X POST https://api.portkey.ai/v1/admin/workspaces \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"name\": \"WORKSPACE_NAME_0909\",\n    \"description\": \"WORKSPACE_DESCRIPTION\",\n    \"defaults\": {\n        \"metadata\": {\n            \"environment\": \"production\",\n            \"foo\": \"bar\"\n        }\n    }\n}'\n"
      - lang: curl
        label: Self-Hosted
        source: "curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"name\": \"WORKSPACE_NAME_0909\",\n    \"description\": \"WORKSPACE_DESCRIPTION\",\n    \"defaults\": {\n        \"metadata\": {\n            \"environment\": \"production\",\n            \"foo\": \"bar\"\n        }\n    }\n}'\n"
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Add a workspace\nworkspace = portkey.admin.workspaces.create(\n    name='WORKSPACE_NAME_0909',\n    description=\"WORKSPACE_DESCRIPTION\",\n    defaults={\n        \"metadata\": {\n            \"environment\": \"production\",\n            \"foo\": \"bar\"\n        }\n    }\n)\n\nprint(workspace)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst workspace = await portkey.admin.workspaces.create({\n    name: 'WORKSPACE_NAME_0909',\n    description: \"WORKSPACE_DESCRIPTION\",\n    defaults: {\n        metadata: {\n            environment: \"production\",\n            foo: \"bar\"\n        }\n    }\n})\n\nconsole.log(workspace)\n"
    get:
      tags:
      - Workspaces
      summary: Get All Workspaces
      parameters:
      - name: page_size
        in: query
        schema:
          type: integer
        example: '1'
      - name: current_page
        in: query
        schema:
          type: integer
        example: '0'
      - name: name
        in: query
        schema:
          type: string
        example: workspace
        description: Workspace name to filter results, case sensitive
      - name: exact_name
        in: query
        schema:
          type: string
        description: Workspace name filter with strict check
      - name: status
        in: query
        schema:
          type: string
          enum:
          - active
          - archived
        example: active,archived
        description: Workspace status to filter results, comma separated
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceList'
              example:
                total: 2
                object: list
                data:
                - id: test-prod-ws-12345
                  name: Test prod workspace
                  description: This is a production workspace
                  created_at: '2023-07-13 13:51:27'
                  last_updated_at: '2023-07-13 14:51:27'
                  object: workspace
                - id: test-prod-ws-12345
                  name: Test prod workspace
                  description: This is a production workspace
                  created_at: '2023-07-13 13:51:27'
                  last_updated_at: '2023-07-13 14:51:27'
                  object: workspace
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# List workspaces\nworkspaces = portkey.admin.workspaces.list()\n\nprint(workspaces)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst workspaces=await portkey.admin.workspaces.list({})\nconsole.log(workspaces);\n"
      - lang: curl
        label: Default
        source: 'curl -X GET https://api.portkey.ai/v1/admin/workspaces

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces

          '
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# List workspaces\nworkspaces = portkey.admin.workspaces.list()\n\nprint(workspaces)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst workspaces=await portkey.admin.workspaces.list({})\nconsole.log(workspaces);\n"
  /admin/workspaces/{workspaceId}:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_CONTROL_PLANE_URL
      description: Self-Hosted Control Plane URL
    put:
      tags:
      - Workspaces
      summary: Update Workspace
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                defaults:
                  type: object
                  properties:
                    metadata:
                      type: object
                      additionalProperties:
                        type: string
                    input_guardrails:
                      type: array
                      items:
                        type: string
                    output_guardrails:
                      type: array
                      items:
                        type: string
                usage_limits:
                  type: array
                  items:
                    $ref: '#/components/schemas/UsageLimits'
                rate_limits:
                  type: array
                  items:
                    $ref: '#/components/schemas/RateLimits'
              example:
                name: My Workspace
                description: My Description
                defaults:
                  metadata:
                    foo: bar
      parameters:
      - name: workspaceId
        in: path
        schema:
          type: string
        required: true
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                type: object
              example: {}
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Update workspace\nworkspace = portkey.admin.workspaces.update(\n    workspace_id='WORKSPACE_ID',\n    name='WORKSPACE 0909',\n    description='This is a test description',\n    defaults={\n        \"x\": \"y\"\n    }\n)\n\nprint(workspace)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst workspace=await portkey.admin.workspaces.update({\n    workspaceId: 'WORKSPACE_ID',\n    name: 'WORKSPACE 0909',\n    description: 'This is a test description',\n    defaults: {\n        x: \"y\"\n    }\n})\nconsole.log(workspace);\n"
      - lang: curl
        label: Default
        source: 'curl -X PUT "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \

          -H "x-portkey-api-key: PORTKEY_API_KEY" \

          -H "Content-Type: application/json" \

          -d ''{"name":"WORKSPACE 0909","description":"This is a test description","defaults":{"x":"y"}}''

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X PUT "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \

          -H "x-portkey-api-key: PORTKEY_API_KEY" \

          -H "Content-Type: application/json" \

          -d ''{"name":"WORKSPACE 0909","description":"This is a test description","defaults":{"x":"y"}}''

          '
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Update workspace\nworkspace = portkey.admin.workspaces.update(\n    workspace_id='WORKSPACE_ID',\n    name='WORKSPACE 0909',\n    description='This is a test description',\n    defaults={\n        x: \"y\"\n    }\n)\n\nprint(workspace)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst workspace=await portkey.admin.workspaces.update({\n    workspaceId: 'WORKSPACE_ID',\n    name: 'WORKSPACE 0909',\n    description: 'This is a test description',\n    defaults: {\n        x: \"y\"\n    }\n})\nconsole.log(workspace);\n"
    get:
      tags:
      - Workspaces
      summary: Get workspace
      parameters:
      - name: workspaceId
        in: path
        schema:
          type: string
        required: true
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceWithUsers'
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Get workspace details\nworkspace = portkey.admin.workspaces.retrieve(\n    workspace_id='WORKSPACE_SLUG'\n)\n\nprint(workspace)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst workspace=await portkey.admin.workspaces.retrieve({\n    workspaceId: 'WORKSPACE_SLUG',\n})\nconsole.log(workspace);\n"
      - lang: curl
        label: Default
        source: 'curl -X GET "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X GET "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    baseUrl=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Get workspace details\nworkspace = portkey.admin.workspaces.retrieve(\n    workspace_id='WORKSPACE_SLUG'\n)\n\nprint(workspace)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst workspace=await portkey.admin.workspaces.retrieve({\n    workspaceId: 'WORKSPACE_SLUG',\n})\nconsole.log(workspace);\n"
    delete:
      tags:
      - Workspaces
      summary: Delete a workspace
      parameters:
      - name: workspaceId
        in: path
        schema:
          type: string
        required: true
      responses:
        '200':
          description: OK
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Delete workspace\nresult = portkey.admin.workspaces.delete(\n    workspace_id='WORKSPACE_SLUG'\n)\n\nprint(result)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst workspace=await portkey.admin.workspaces.delete({\n    workspaceId: 'WORKSPACE_SLUG',\n})\nconsole.log(workspace);\n"
      - lang: curl
        label: Default
        source: 'curl -X DELETE "https://api.portkey.ai/v1/admin/workspaces/{workspaceId}" \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X DELETE "SELF_HOSTED_CONTROL_PLANE_URL/admin/workspaces/{workspaceId}" \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Delete workspace\nresult = portkey.admin.workspaces.delete(\n    workspace_id='WORKSPACE_SLUG'\n)\n\nprint(result)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst workspace=await portkey.admin.workspaces.delete({\n    workspaceId: 'WORKSPACE_SLUG',\n})\nconsole.log(workspace);\n"
  /scim/workspaces:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_CONTROL_PLANE_URL
      description: Self-Hosted Control Plane URL
    get:
      tags:
      - Workspaces
      summary: List SCIM Group to Workspace Mappings
      description: 'List all mappings between SCIM groups and workspaces for the organisation.

        Optionally filter by workspace, SCIM group, or role.

        '
      parameters:
      - name: workspace_id
        in: query
        required: false
        schema:
          type: string
        description: Filter mappings by workspace ID or slug.
      - name: scim_group_id
        in: query
        required: false
        schema:
          type: string
        description: Filter mappings by SCIM group ID.
      - name: role
        in: query
        required: false
        schema:
          type: string
          enum:
          - admin
          - member
          - manager
        description: Filter mappings by role.
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                type: object
                properties:
                  mappings:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Unique ID of the SCIM workspace mapping.
                        workspace_id:
                          type: string
                          description: ID of the mapped workspace.
                        scim_group:
                          type: string
                          description: Display name of the SCIM group.
                        scim_group_id:
                          type: string
                          description: ID of the SCIM group.
                        role:
                          type: string
                          enum:
                          - admin
                          - member
                          - manager
                          description: Role assigned to group members in the workspace.
                  total_count:
                    type: integer
                    description: Total number of mappings returned.
              example:
                mappings:
                - id: d290f1ee-6c54-4b01-90e6-d701748f0851
                  workspace_id: ws_my-workspace
                  scim_group: Engineering Team
                  scim_group_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                  role: member
                total_count: 1
      x-code-samples:
      - lang: curl
        label: Default
        source: 'curl -X GET https://api.portkey.ai/v1/scim/workspaces \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: curl
        label: Filter by workspace
        source: 'curl -X GET "https://api.portkey.ai/v1/scim/workspaces?workspace_id=ws_my-workspace" \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/scim/workspaces \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
    post:
      tags:
      - Workspaces
      summary: Create SCIM Group to Workspace Mapping
      description: "Create a mapping between a SCIM group and a workspace. \nYou can either reference an existing SCIM group by ID, or provide a group name \nto pre-create the SCIM group before the IdP provisions it.\n"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - workspace_id
              - role
              properties:
                workspace_id:
                  type: string
                  description: ID or slug (ws_ prefix) of the workspace to map the SCIM group to.
                role:
                  type: string
                  enum:
                  - admin
                  - member
                  - manager
                  description: Role assigned to group members in the workspace.
                scim_group_id:
                  type: string
                  description: ID of an existing SCIM group. Required if scim_group_name is not provided.
                scim_group_name:
                  type: string
                  description: Display name for the SCIM group. If the group doesn't exist, it will be created. Required if scim_group_id is not provided. Must not match the pattern-based auto-provisioning format (e.g. ws-name-role-admin).
              oneOf:
              - required:
                - scim_group_id
              - required:
                - scim_group_name
            examples:
              pre_create_group:
                summary: Pre-create a SCIM group and map it
                value:
                  scim_group_name: Engineering Team
                  workspace_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                  role: admin
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScimWorkspaceMapping'
      x-code-samples:
      - lang: curl
        label: Default
        source: "curl -X POST https://api.portkey.ai/v1/scim/workspaces \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"scim_group_name\": \"Engineering Team\",\n    \"workspace_id\": \"ws_my-workspace\",\n    \"role\": \"member\"\n}'\n"
      - lang: curl
        label: With existing group
        source: "curl -X POST https://api.portkey.ai/v1/scim/workspaces \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"scim_group_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"workspace_id\": \"ws_my-workspace\",\n    \"role\": \"admin\"\n}'\n"
      - lang: curl
        label: Self-Hosted
        source: "curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/scim/workspaces \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"scim_group_name\": \"Engineering Team\",\n    \"workspace_id\": \"ws_my-workspace\",\n    \"role\": \"member\"\n}'\n"
  /scim/workspaces/{scimWorkspaceGroupId}:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_CONTROL_PLANE_URL
      description: Self-Hosted Control Plane URL
    delete:
      tags:
      - Workspaces
      summary: Delete SCIM Group to Workspace Mapping
      description: Remove a SCIM group to workspace mapping. This archives the mapping but does not delete the SCIM group or workspace.
      parameters:
      - name: scimWorkspaceGroupId
        in: path
        required: true
        schema:
          type: string
        description: ID of the SCIM workspace mapping to delete
      responses:
        '200':
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                example:
                  success: true
      x-code-samples:
      - lang: curl
        label: Default
        source: 'curl -X DELETE https://api.portkey.ai/v1/scim/workspaces/MAPPING_ID \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X DELETE SELF_HOSTED_CONTROL_PLANE_URL/scim/workspaces/MAPPING_ID \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
components:
  schemas:
    WorkspaceWithUsers:
      type: object
      properties:
        id:
          type: string
          example: ws-test-a-174eb1
        slug:
          type: string
          example: ws-test-a-174eb1
        name:
          type: string
          example: New Workspace
        description:
          type: string
          nullable: true
          example: null
        created_at:
          type: string
          format: date-time
          example: 2024-07-30 13:27:29+00:00
        last_updated_at:
          type: string
          format: date-time
          example: 2024-07-30 13:27:29+00:00
        defaults:
          type: object
          nullable: true
          properties:
            metadata:
              type: object
              additionalProperties:
                type: string
              example:
                foo: bar
            is_default:
              type: integer
              example: 0
            input_guardrails:
              type: array
              items:
                type: string
            output_guardrails:
              type: array
              items:
                type: string
            object:
              type: string
              enum:
              - workspace
        users:
          type: array
          items:
            type: object
            $ref: '#/components/schemas/WorkspaceMember'
        usage_limits:
          type: array
          items:
            $ref: '#/components/schemas/UsageLimits'
        rate_limits:
          type: array
          items:
            $ref: '#/components/schemas/RateLimits'
    ScimWorkspaceMapping:
      type: object
      properties:
        id:
          type: string
          description: Unique ID of the mapping
        workspace_id:
          type: string
          description: ID of the mapped workspace
        scim_group:
          type: string
          description: Display name of the SCIM group
        role:
          type: string
          enum:
          - admin
          - member
          - manager
          description: Role assigned to group members
        scim_group_id:
          type: string
          description: ID of the SCIM group
      example:
        id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        workspace_id: ws-12345
        scim_group: Engineering Team
        role: member
        scim_group_id: d290f1ee-6c54-4b01-90e6-d701748f0851
    WorkspaceList:
      type: object
      properties:
        total:
          type: integer
          example: 2
        object:
          type: string
          enum:
          - list
        data:
          type: array
          items:
            $ref: '#/components/schemas/Workspace'
    Workspace:
      type: object
      properties:
        id:
          type: string
          example: ws-test-a-174eb1
        slug:
          type: string
          example: ws-test-a-174eb1
        name:
          type: string
          example: New Workspace
        description:
          type: string
          nullable: true
          example: null
        created_at:
          type: string
          format: date-time
          example: 2024-07-30 13:27:29+00:00
        last_updated_at:
          type: string
          format: date-time
          example: 2024-07-30 13:27:29+00:00
        defaults:
          type: object
          nullable: true
          properties:
            metadata:
              type: object
              additionalProperties:
                type: string
              example:
                foo: bar
            is_default:
              type: integer
              example: 0
            object:
              type: string
              enum:
              - workspace
        usage_limits:
          type: array
          items:
            $ref: '#/components/schemas/UsageLimits'
        rate_limits:
          type: array
          items:
            $ref: '#/components/schemas/RateLimits'
    WorkspaceMember:
      type: object
      properties:
        object:
          type: string
          example: workspace-user
          enum:
          - workspace-user
        id:
          type: string
          format: uuid
          example: 66dc015d-0270-11f1-8eec-0e27d7367989
        first_name:
          type: string
          example: John
        last_name:
          type: string
          example: Doe
        org_role:
          type: string
          example: admin
          enum:
          - admin
          - member
          - owner
        role:
          type: string
          example: admin
          enum:
          - admin
          - member
          - manager
        created_at:
          type: string
          format: date-time
          example: '2026-03-09T07:55:25.000Z'
        last_updated_at:
          type: string
          format: date-time
          example: '2026-03-09T07:55:25.000Z'
        status:
          type: string
          example: active
          enum:
          - active
        workspace_id:
          type: string
          format: uuid
          example: bf276bb9-4cef-4d87-b69b-b23a6ed6b1dd
        email:
          type: string
          format: email
          example: john.doe@example.com
        scopes:
          type: array
          items:
            type: string
          example:
          - organisations.read
          - organisation_users.read
          - workspaces.read
          - logs.list
          - logs.view
          - prompts.create
          - prompts.read
          - prompts.list
          - configs.create
          - configs.read
          - configs.list
          - virtual_keys.create
          - virtual_keys.read
          - virtual_keys.list
          - workspace_users.create
          - workspace_users.read
          - workspace_users.list
          - generations.create
        settings:
          type: object
          nullable: true
          example: null
    UsageLimits:
      type: object
      properties:
        credit_limit:
          type: integer
          description: Credit Limit. Used for tracking usage
          minimum: 1
          default: null
        type:
          type: string
          description: Type of credit limit
          enum:
          - cost
          - tokens
        alert_threshold:
          type: integer
          description: Alert Threshold. Used for alerting when usage reaches more than this
          minimum: 1
          default: null
        periodic_reset:
          type: string
          description: Reset the usage periodically.
          enum:
          - monthly
          - weekly
          nullable: true
          example: monthly
        periodic_reset_days:
          type: integer
          description: Reset the usage counter every N days (1-365). Mutually exclusive with periodic_reset.
          minimum: 1
          maximum: 365
          nullable: true
          example: 30
        next_usage_reset_at:
          type: string
          format: date-time
          description: ISO 8601 datetime for the next scheduled usage reset. Auto-computed from periodic_res

# --- truncated at 32 KB (47 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/portkey/refs/heads/main/openapi/portkey-workspaces-api-openapi.yml