Prefect Workspace User Access API

Manage users' access to a Workspace.

OpenAPI Specification

prefect-workspace-user-access-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Prefect Cloud Account Billing Workspace User Access API
  description: Prefect Cloud REST API documentation.
  version: 0.8.4
tags:
- name: Workspace User Access
  description: Manage users' access to a Workspace.
  externalDocs:
    description: 'Manage workspaces: control access'
    url: https://docs.prefect.io/v3/manage/cloud/workspaces#control-access
paths:
  /api/accounts/{account_id}/workspaces/{workspace_id}/user_access/:
    post:
      tags:
      - Workspace User Access
      summary: Upsert Workspace User Access
      description: 'Upsert a workspace user access


        Required workspace scopes: `manage_workspace_users`'
      operationId: upsert_workspace_user_access_api_accounts__account_id__workspaces__workspace_id__user_access__post
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/WorkspaceUserAccessCreate'
              - type: array
                items:
                  $ref: '#/components/schemas/WorkspaceUserAccessCreate'
              title: Workspace User Accesses
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/WorkspaceUserAccessResponse'
                - type: array
                  items:
                    $ref: '#/components/schemas/WorkspaceUserAccessResponse'
                title: Response Upsert Workspace User Access Api Accounts  Account Id  Workspaces  Workspace Id  User Access  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/user_access/filter:
    post:
      tags:
      - Workspace User Access
      summary: Read Workspace User Accesses
      description: 'Query for workspace user accesses


        Required workspace scopes: `see_workspace_users`'
      operationId: read_workspace_user_accesses_api_accounts__account_id__workspaces__workspace_id__user_access_filter_post
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_read_workspace_user_accesses_api_accounts__account_id__workspaces__workspace_id__user_access_filter_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkspaceUserAccessResponse'
                title: Response Read Workspace User Accesses Api Accounts  Account Id  Workspaces  Workspace Id  User Access Filter Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/user_access/{id}:
    get:
      tags:
      - Workspace User Access
      summary: Read Workspace User Access
      description: 'Read a workspace user access


        Required workspace scopes: `see_workspace_users`'
      operationId: read_workspace_user_access_api_accounts__account_id__workspaces__workspace_id__user_access__id__get
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Id
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceUserAccessResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Workspace User Access
      summary: Delete Workspace User Access
      description: 'Delete a workspace user access by id.


        This route will also conditionally delete the user''s account membership if:

        - account membership of the actor has `Collaborator` role

        - the actor has no more workspace accesses under the account


        Required workspace scopes: `manage_workspace_users`'
      operationId: delete_workspace_user_access_api_accounts__account_id__workspaces__workspace_id__user_access__id__delete
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Id
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UserFilter:
      properties:
        id:
          anyOf:
          - $ref: '#/components/schemas/UserFilterId'
          - type: 'null'
          description: Filter criteria for User.id
        email:
          anyOf:
          - $ref: '#/components/schemas/UserFilterEmail'
          - type: 'null'
          description: Filter criteria for UserEmail.email
        handle:
          anyOf:
          - $ref: '#/components/schemas/UserFilterHandle'
          - type: 'null'
          description: Filter criteria for User.handle
        name:
          anyOf:
          - $ref: '#/components/schemas/UserFilterName'
          - type: 'null'
          description: Filter criteria for User.first_name or User.last_name
      additionalProperties: false
      type: object
      title: UserFilter
    Body_read_workspace_user_accesses_api_accounts__account_id__workspaces__workspace_id__user_access_filter_post:
      properties:
        limit:
          type: integer
          maximum: 200.0
          minimum: 0.0
          title: Limit
          default: 200
        offset:
          type: integer
          minimum: 0.0
          title: Offset
          default: 0
        workspace_accesses:
          anyOf:
          - $ref: '#/components/schemas/WorkspaceActorAccessFilter'
          - type: 'null'
        users:
          anyOf:
          - $ref: '#/components/schemas/UserFilter'
          - type: 'null'
        sort:
          anyOf:
          - $ref: '#/components/schemas/WorkspaceUserAccessSort'
          - type: 'null'
      type: object
      title: Body_read_workspace_user_accesses_api_accounts__account_id__workspaces__workspace_id__user_access_filter_post
    WorkspaceUserAccessResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        created:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Created
        updated:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
          description: The workspace id
        workspace_role_id:
          type: string
          format: uuid
          title: Workspace Role Id
          description: The workspace role id
        actor_id:
          type: string
          format: uuid
          title: Actor Id
          description: actor_id of user assigned a workspace access
        user_id:
          type: string
          format: uuid
          title: User Id
          description: id of user assigned a workspace access
        first_name:
          type: string
          title: First Name
          description: first name of user assigned a workspace access
        last_name:
          type: string
          title: Last Name
          description: last name of user assigned a workspace access
        email:
          type: string
          title: Email
          description: email of user assigned a workspace access
        handle:
          type: string
          title: Handle
          description: unique handle of user assigned a workspace access
      additionalProperties: false
      type: object
      required:
      - workspace_id
      - workspace_role_id
      - actor_id
      - user_id
      - first_name
      - last_name
      - email
      - handle
      title: WorkspaceUserAccessResponse
      description: Data returned by the API after creating a new user workspace access
    WorkspaceActorAccessFilter:
      properties:
        workspace_role_id:
          anyOf:
          - $ref: '#/components/schemas/WorkspaceActorAccessFilterWorkspaceRoleId'
          - type: 'null'
          description: Filter criteria for WorkspaceActorAccess.workspace_role_id
        actor_id:
          anyOf:
          - $ref: '#/components/schemas/WorkspaceActorAccessFilterActorId'
          - type: 'null'
          description: Filter criteria for WorkspaceActorAccess.actor_id
      additionalProperties: false
      type: object
      title: WorkspaceActorAccessFilter
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    UserFilterEmail:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: A list of user emails to include
          examples:
          - - marvin@prefect.example
            - marvin.jr@prefect.example
        like_:
          anyOf:
          - type: string
          - type: 'null'
          title: Like
          description: A case-insensitive partial match. For example,  passing 'marvin' will match 'marvin@prefect.example', 'sad-Marvin@prefect.example', and 'marvin-robot@prefect.example'.
          examples:
          - marvin
      additionalProperties: false
      type: object
      title: UserFilterEmail
      description: Filter by `UserEmail.email`.
    WorkspaceUserAccessSort:
      type: string
      enum:
      - CREATED_ASC
      - CREATED_DESC
      - NAME_ASC
      - NAME_DESC
      - EMAIL_ASC
      - EMAIL_DESC
      - HANDLE_ASC
      - HANDLE_DESC
      title: WorkspaceUserAccessSort
      description: Sort options for workspace user accesses
    UserFilterId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: A list of user ids to include
        not_any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Not Any
          description: A list of user ids to exclude
      additionalProperties: false
      type: object
      title: UserFilterId
    WorkspaceActorAccessFilterWorkspaceRoleId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: Only include workspace accesses with one of these workspace role ids
      additionalProperties: false
      type: object
      title: WorkspaceActorAccessFilterWorkspaceRoleId
    WorkspaceUserAccessCreate:
      properties:
        user_id:
          type: string
          format: uuid
          title: User Id
          description: id of user to create a workspace access for
        workspace_role_id:
          type: string
          format: uuid
          title: Workspace Role Id
          description: The workspace role id
      additionalProperties: false
      type: object
      required:
      - user_id
      - workspace_role_id
      title: WorkspaceUserAccessCreate
      description: Data used by the api to create workspace actor access
    WorkspaceActorAccessFilterActorId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: Only include workspace accesses with one of these actor ids
      additionalProperties: false
      type: object
      title: WorkspaceActorAccessFilterActorId
    UserFilterName:
      properties:
        like_:
          anyOf:
          - type: string
          - type: 'null'
          title: Like
          description: A case-insensitive partial match on first_name or last_name. For example, passing 'marvin' will match users with 'marvin' in their first or last name.
          examples:
          - marvin
      additionalProperties: false
      type: object
      title: UserFilterName
      description: Filter by `User.first_name` or `User.last_name`.
    UserFilterHandle:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: A list of user handles to include
          examples:
          - - marvin-ops
            - ceo-marvin
            - marvin-engineering
        like_:
          anyOf:
          - type: string
          - type: 'null'
          title: Like
          description: A case-insensitive partial match. For example,  passing 'marvin' will match 'marvin-ops', 'ceo-marvin', and 'marvin-engineering'.
          examples:
          - marvin
      additionalProperties: false
      type: object
      title: UserFilterHandle
      description: Filter by `User.handle`.