Prefect Teams API

The Teams API from Prefect — 5 operation(s) for teams.

OpenAPI Specification

prefect-teams-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Prefect Cloud Account Billing Teams API
  description: Prefect Cloud REST API documentation.
  version: 0.8.4
tags:
- name: Teams
paths:
  /api/accounts/{account_id}/teams/:
    post:
      tags:
      - Teams
      summary: Create Team
      description: 'Create or update a team''s metadata.


        Required account permissions: `create:team`'
      operationId: create_team_api_accounts__account_id__teams__post
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TeamCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/teams/{id}:
    get:
      tags:
      - Teams
      summary: Read Team
      description: 'Get a team by id.


        Required account permissions: `read:team`'
      operationId: read_team_api_accounts__account_id__teams__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
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Teams
      summary: Update Team
      description: '


        Required account permissions: `update:team`'
      operationId: update_team_api_accounts__account_id__teams__id__put
      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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TeamUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Teams
      summary: Delete Team
      description: 'Delete a team by id.


        Required account permissions: `delete:team`'
      operationId: delete_team_api_accounts__account_id__teams__id__delete
      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
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/teams/filter:
    post:
      tags:
      - Teams
      summary: Read Teams
      description: 'Query for teams.


        Required account permissions: `read:team`'
      operationId: read_teams_api_accounts__account_id__teams_filter_post
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_read_teams_api_accounts__account_id__teams_filter_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TeamResponse'
                title: Response Read Teams Api Accounts  Account Id  Teams Filter Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/teams/{id}/members:
    put:
      tags:
      - Teams
      summary: Upsert Team Members
      description: 'Upsert team memberships.


        Required account permissions: `update:team`'
      operationId: upsert_team_members_api_accounts__account_id__teams__id__members_put
      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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_upsert_team_members_api_accounts__account_id__teams__id__members_put'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/teams/{team_id}/members/{actor_id}:
    delete:
      tags:
      - Teams
      summary: Remove Team Member
      description: 'Remove a member from a team.


        Required account permissions: `update:team`'
      operationId: remove_team_member_api_accounts__account_id__teams__team_id__members__actor_id__delete
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: team_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Team Id
      - name: actor_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Actor Id
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BotFilterName:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: A list of bot names to include
        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: BotFilterName
    TeamFilterId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: Only include teams with one of these ids
      additionalProperties: false
      type: object
      title: TeamFilterId
    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
    TeamUpdate:
      properties:
        name:
          type: string
          maxLength: 5000
          title: Name
          description: The name of the team.
        description:
          anyOf:
          - type: string
            maxLength: 5000
          - type: 'null'
          title: Description
          description: An optional description of the team.
          default: ''
        workos_directory_group_id:
          anyOf:
          - type: string
            maxLength: 5000
          - type: 'null'
          title: Workos Directory Group Id
          description: The id of the WorkOS directory group that this team should be associated with.
      additionalProperties: false
      type: object
      required:
      - name
      title: TeamUpdate
      description: Data used by the api to update a team
    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
    Body_read_teams_api_accounts__account_id__teams_filter_post:
      properties:
        teams:
          $ref: '#/components/schemas/TeamFilter'
        users:
          $ref: '#/components/schemas/UserFilter'
        bots:
          $ref: '#/components/schemas/BotFilter'
        sort:
          anyOf:
          - $ref: '#/components/schemas/TeamSort'
          - type: 'null'
        limit:
          type: integer
          maximum: 200.0
          minimum: 0.0
          title: Limit
          default: 200
        offset:
          type: integer
          minimum: 0.0
          title: Offset
          default: 0
      type: object
      title: Body_read_teams_api_accounts__account_id__teams_filter_post
    TeamFilter:
      properties:
        id:
          anyOf:
          - $ref: '#/components/schemas/TeamFilterId'
          - type: 'null'
          description: Filter criteria for Team.id
        name:
          anyOf:
          - $ref: '#/components/schemas/TeamNameFilter'
          - type: 'null'
          description: Filter criteria for Team.name
        directory_id:
          anyOf:
          - $ref: '#/components/schemas/TeamFilterDirectoryId'
          - type: 'null'
          description: Filter criteria for Team.workos_directory_id
        workspace_id:
          anyOf:
          - $ref: '#/components/schemas/TeamFilterWorkspaceId'
          - type: 'null'
          description: Filter criteria for WorkspaceTeamAccess.workspace_id
        workspace_role_id:
          anyOf:
          - $ref: '#/components/schemas/TeamFilterWorkspaceRoleId'
          - type: 'null'
          description: Filter criteria for WorkspaceTeamAccess.workspace_role_id
        member_id:
          anyOf:
          - $ref: '#/components/schemas/TeamFilterMemberId'
          - type: 'null'
          description: Filter criteria for TeamMembership.actor_id
      additionalProperties: false
      type: object
      title: TeamFilter
    BotFilterId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: A list of bot ids to include
      additionalProperties: false
      type: object
      title: BotFilterId
    TeamFilterMemberId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: Only include teams with a member matching one of these actor ids
      additionalProperties: false
      type: object
      title: TeamFilterMemberId
    TeamMemberResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: The actor id.
        handle:
          type: string
          title: Handle
          description: The actor handle.
        name:
          type: string
          title: Name
          description: The actor name.
        email:
          anyOf:
          - type: string
          - type: 'null'
          title: Email
          description: The actor email if they're a user, otherwise None.
        type:
          type: string
          enum:
          - user
          - service_account
          title: Type
          description: The actor type.
      type: object
      required:
      - id
      - handle
      - name
      - email
      - type
      title: TeamMemberResponse
      description: Describes a member of a team.
    TeamFilterWorkspaceId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: Only include teams with access to one of these workspace ids
      additionalProperties: false
      type: object
      title: TeamFilterWorkspaceId
    TeamResponse:
      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
        account_id:
          type: string
          format: uuid
          title: Account Id
          description: The account id associated with this team.
        name:
          type: string
          title: Name
          description: The name of the team.
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: An optional description of the team.
          default: ''
        workos_directory_group_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Workos Directory Group Id
          description: The WorkOS directory group id.
        memberships:
          items:
            $ref: '#/components/schemas/TeamMemberResponse'
          type: array
          title: Memberships
          description: The members of the team.
        workspaces:
          items:
            $ref: '#/components/schemas/TeamWorkspaceAccess'
          type: array
          title: Workspaces
          description: The workspaces the team has access to.
      type: object
      required:
      - account_id
      - name
      title: TeamResponse
      description: Data returned by the API when reading a team.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BotFilter:
      properties:
        id:
          anyOf:
          - $ref: '#/components/schemas/BotFilterId'
          - type: 'null'
          description: Filter criteria for Bot.id
        name:
          anyOf:
          - $ref: '#/components/schemas/BotFilterName'
          - type: 'null'
          description: Filter criteria for Bot.name
      additionalProperties: false
      type: object
      title: BotFilter
    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`.
    TeamSort:
      type: string
      enum:
      - NAME_ASC
      - NAME_DESC
      - CREATED_ASC
      - CREATED_DESC
      title: TeamSort
      description: Sort options for teams
    TeamFilterWorkspaceRoleId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: Only include teams with one of these workspace role ids
      additionalProperties: false
      type: object
      title: TeamFilterWorkspaceRoleId
    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
    TeamFilterDirectoryId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: Only include teams with one of these directory ids
      additionalProperties: false
      type: object
      title: TeamFilterDirectoryId
    TeamWorkspaceAccess:
      properties:
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
          description: The workspace id.
        workspace_handle:
          type: string
          title: Workspace Handle
          description: The workspace handle.
        workspace_role_id:
          type: string
          format: uuid
          title: Workspace Role Id
          description: The workspace role id held by the team.
        workspace_role_name:
          type: string
          title: Workspace Role Name
          description: The workspace role name held by the team.
      type: object
      required:
      - workspace_id
      - workspace_handle
      - workspace_role_id
      - workspace_role_name
      title: TeamWorkspaceAccess
      description: Describes the access a team has to a workspace.
    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`.
    TeamCreate:
      properties:
        name:
          type: string
          maxLength: 5000
          title: Name
          description: The name of the team.
        description:
          anyOf:
          - type: string
            maxLength: 5000
          - type: 'null'
          title: Description
          description: An optional description of the team.
          default: ''
      additionalProperties: false
      type: object
      required:
      - name
      title: TeamCreate
      description: Data used by the api to create a new team
    TeamNameFilter:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: Only include teams matching these names
        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: TeamNameFilter
    TeamMembershipCreate:
      properties:
        member_id:
          type: string
          format: uuid
          title: Member Id
          description: The id of the user or service account to add to the team.
        member_type:
          type: string
          enum:
          - user
          - service_account
          title: Member Type
          description: The type of member to add to the team.
      additionalProperties: false
      type: object
      required:
      - member_id
      - member_type
      title: TeamMembershipCreate
    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`.
    Body_upsert_team_members_api_accounts__account_id__teams__id__members_put:
      properties:
        members:
          items:
            $ref: '#/components/schemas/TeamMembershipCreate'
          type: array
          title: Members
      type: object
      required:
      - members
      title: Body_upsert_team_members_api_accounts__account_id__teams__id__members_put