> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.select.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Set team memberships for a batch of users

> Set the explicit team memberships for one or more users.

For each listed user, removes all of their current explicit
(individually-assigned) team memberships across the organization, then grants
the specified role on each listed team. Memberships held through an SSO group
are never affected, and a user already in a listed team via SSO is skipped.
This is a full replacement, not an incremental add — any explicit membership
not present in this request is removed.



## OpenAPI

````yaml https://api.select.dev/v2/openapi.json post /teams/actions/batch-update-memberships
openapi: 3.1.0
info:
  title: SELECT API (v2)
  version: 0.1.0
servers:
  - url: https://api.select.dev/v2
    description: SELECT API v2
security: []
paths:
  /teams/actions/batch-update-memberships:
    post:
      tags:
        - teams
      summary: Set team memberships for a batch of users
      description: >-
        Set the explicit team memberships for one or more users.


        For each listed user, removes all of their current explicit

        (individually-assigned) team memberships across the organization, then
        grants

        the specified role on each listed team. Memberships held through an SSO
        group

        are never affected, and a user already in a listed team via SSO is
        skipped.

        This is a full replacement, not an incremental add — any explicit
        membership

        not present in this request is removed.
      operationId: >-
        batch_update_memberships_route_teams_actions_batch_update_memberships_post
      parameters:
        - name: x-tenant-id
          in: header
          required: true
          schema:
            type: string
            description: The organization ID the request is scoped to.
            title: X-Tenant-Id
          description: The organization ID the request is scoped to.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUpdateMembershipsV2'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListResponse_TeamMembersV2_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    BulkUpdateMembershipsV2:
      properties:
        email_addresses:
          items:
            type: string
          type: array
          maxItems: 100
          minItems: 1
          title: Email Addresses
          description: >-
            Users, by email, whose explicit team memberships are being set. Each
            user's existing explicit memberships across all teams are replaced
            by those in this request.
          x-doit-confidentiality: customer-data
          x-doit-pii: true
        team_memberships:
          items:
            $ref: '#/components/schemas/TeamMembershipUpdateV2'
          type: array
          maxItems: 100
          minItems: 1
          title: Team Memberships
          description: >-
            The teams each listed user should explicitly belong to, and the role
            to grant on each. Any team not listed is removed from every listed
            user's explicit memberships.
      additionalProperties: false
      type: object
      required:
        - email_addresses
        - team_memberships
      title: BulkUpdateMembershipsV2
    ListResponse_TeamMembersV2_:
      properties:
        items:
          items:
            $ref: '#/components/schemas/TeamMembersV2'
          type: array
          title: Items
        page_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Token
          description: Opaque cursor for the next page; empty/absent on the last page.
        row_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Row Count
          description: >-
            Best-effort total for the filtered result set; may be null when
            expensive.
      type: object
      required:
        - items
      title: ListResponse[TeamMembersV2]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TeamMembershipUpdateV2:
      properties:
        team_id:
          type: string
          title: Team Id
          description: The team to set membership on.
        role:
          $ref: '#/components/schemas/TeamRoleEnum'
          description: Role to grant each listed user on this team.
      additionalProperties: false
      type: object
      required:
        - team_id
        - role
      title: TeamMembershipUpdateV2
    TeamMembersV2:
      properties:
        team_id:
          type: string
          title: Team Id
          description: The team the memberships belong to.
        members:
          items:
            $ref: '#/components/schemas/TeamMemberV2'
          type: array
          title: Members
          description: Explicit memberships created on this team by the update.
      type: object
      required:
        - team_id
        - members
      title: TeamMembers
      description: >-
        The explicit memberships set on a single team by a batch membership
        update.
    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
    TeamRoleEnum:
      type: string
      enum:
        - editor
        - viewer
      title: TeamRoleEnum
      description: >-
        Defines the permission level of a user within a team:

        - EDITOR: Can manage team resources, create and modify shared items, and
        change settings

        - VIEWER: Can view team resources and have limited interaction
        capabilities
    TeamMemberV2:
      properties:
        id:
          type: string
          title: Id
          description: The unique identifier of this membership.
          readOnly: true
          x-terraform-computed: true
        type:
          $ref: '#/components/schemas/TeamMemberType'
          description: Whether the member is an individual user or an SSO group.
        identifier:
          type: string
          title: Identifier
          description: Email address for a user, or group name for an SSO group.
          x-doit-confidentiality: customer-data
          x-doit-pii: true
        role:
          $ref: '#/components/schemas/TeamRoleEnum'
          description: The member's role within the team.
        create_time:
          type: string
          title: Create Time
          description: When the member was added to the team — RFC 3339 UTC.
          readOnly: true
          x-terraform-computed: true
        etag:
          type: string
          title: Etag
          description: Opaque strong ETag for optimistic concurrency.
          readOnly: true
          x-terraform-computed: true
      type: object
      required:
        - id
        - type
        - identifier
        - role
        - create_time
        - etag
      title: TeamMember
      description: A user or SSO group granted membership on a team.
    TeamMemberType:
      type: string
      enum:
        - user
        - sso_group
      title: TeamMemberType
      description: Whether a team member is an individual user or an SSO group.
  securitySchemes:
    HTTPBearer:
      type: http
      description: Organization API key (sl_…).
      scheme: bearer

````