basePath: /v1beta1
definitions:
  api.OpenApiBatchUpdateError:
    properties:
      code:
        description: Error code
        type: string
      message:
        description: Error message
        type: string
    type: object
  api.OpenApiBatchUpdateUserResult:
    properties:
      error:
        allOf:
        - $ref: '#/definitions/api.OpenApiBatchUpdateError'
        description: Error details if the update failed
      success:
        description: Whether the update was successful
        type: boolean
      userId:
        description: Unique identifier of the user
        type: string
    type: object
  api.OpenApiBatchUpdateUsersRsp:
    properties:
      results:
        description: List of batch update results
        items:
          $ref: '#/definitions/api.OpenApiBatchUpdateUserResult'
        type: array
    type: object
  api.OpenApiError:
    properties:
      code:
        description: Error code
        type: string
      error: {}
      msgPrefix:
        description: Error message prefix
        type: string
      status:
        description: HTTP status code
        type: integer
    type: object
  api.OpenApiInstanceRole:
    properties:
      rbacRole:
        description: Instance role
        enum:
        - cluster:admin
        - cluster:viewer
        example: cluster:admin
        type: string
      scopeId:
        description: Instance ID
        type: string
    type: object
  api.OpenApiInviteUserResult:
    properties:
      email:
        description: Email address of the invited user
        type: string
      userId:
        description: Unique identifier of the invited user
        type: string
    type: object
  api.OpenApiInviteUsersReq:
    properties:
      emails:
        description: Email addresses of the users to invite
        items:
          type: string
        type: array
      instanceRoles:
        description: Instance roles to assign to the invited users
        items:
          $ref: '#/definitions/api.OpenApiInstanceRole'
        type: array
      orgRole:
        allOf:
        - $ref: '#/definitions/api.OpenApiOrgRole'
        description: Organization role to assign to the invited users
      projectRoles:
        description: Project roles to assign to the invited users
        items:
          $ref: '#/definitions/api.OpenApiProjectRole'
        type: array
    required:
    - emails
    - orgRole
    type: object
  api.OpenApiInviteUsersRsp:
    properties:
      message:
        description: Response message
        type: string
      success:
        description: Whether the invitation was successful
        type: boolean
      users:
        description: List of invited user results
        items:
          $ref: '#/definitions/api.OpenApiInviteUserResult'
        type: array
    type: object
  api.OpenApiListUsersRsp:
    properties:
      nextPageToken:
        description: Token to retrieve the next page of results
        example: ""
        type: string
      totalSize:
        description: Total number of users matching the query
        example: 10
        type: integer
      users:
        description: List of users
        items:
          $ref: '#/definitions/api.OpenApiUser'
        type: array
    type: object
  api.OpenApiOrgRole:
    properties:
      rbacRole:
        description: Organization role
        enum:
        - org:owner
        - org:member
        - org:billing_admin
        - org:billing_viewer
        - org:audit_admin
        example: org:owner
        type: string
      scopeId:
        description: Organization ID
        type: string
    type: object
  api.OpenApiProjectRole:
    properties:
      rbacRole:
        description: Project role
        enum:
        - project:owner
        - project:dev
        - project:readonly
        - project:ctl_plane_viewer
        example: project:owner
        type: string
      scopeId:
        description: Project ID
        type: string
    type: object
  api.OpenApiUser:
    properties:
      email:
        description: Email address of the user
        example: user@example.com
        type: string
      firstName:
        description: First name of the user
        example: John
        type: string
      instanceRoles:
        description: Instance roles of the user
        items:
          $ref: '#/definitions/api.OpenApiInstanceRole'
        type: array
      inviteTime:
        description: Time when the user was invited
        example: "2024-01-01T00:00:00Z"
        type: string
      lastLoginTime:
        description: Time when the user last logged in
        example: "2024-01-01T00:00:00Z"
        type: string
      lastName:
        description: Last name of the user
        example: Doe
        type: string
      orgRole:
        allOf:
        - $ref: '#/definitions/api.OpenApiOrgRole'
        description: Organization role of the user
      projectRoles:
        description: Project roles of the user
        items:
          $ref: '#/definitions/api.OpenApiProjectRole'
        type: array
      status:
        description: Status of the user
        example: active
        type: string
      userId:
        description: Unique identifier of the user
        example: "123456"
        type: string
    type: object
  api.openApiBatchUpdateUserEntryDoc:
    properties:
      instanceRoles:
        description: Instance roles to update
        items:
          $ref: '#/definitions/api.OpenApiInstanceRole'
        type: array
      orgRole:
        allOf:
        - $ref: '#/definitions/api.OpenApiOrgRole'
        description: Organization role to update
      projectRoles:
        description: Project roles to update
        items:
          $ref: '#/definitions/api.OpenApiProjectRole'
        type: array
      userId:
        description: Unique identifier of the user
        type: string
    required:
    - userId
    type: object
  api.openApiBatchUpdateUsersReqDoc:
    properties:
      users:
        description: List of users to update
        items:
          $ref: '#/definitions/api.openApiBatchUpdateUserEntryDoc'
        type: array
    type: object
  api.openApiUpdateUserReqDoc:
    properties:
      instanceRoles:
        description: Instance roles to update
        items:
          $ref: '#/definitions/api.OpenApiInstanceRole'
        type: array
      orgRole:
        allOf:
        - $ref: '#/definitions/api.OpenApiOrgRole'
        description: Organization role to update
      projectRoles:
        description: Project roles to update
        items:
          $ref: '#/definitions/api.OpenApiProjectRole'
        type: array
    type: object
host: iam.tidbapi.com
info:
  contact: {}
  description: This is the members related API.
  title: Account System Members OPENAPI
  version: v1beta1
paths:
  /members:
    get:
      consumes:
      - application/json
      description: List members in the organization with optional filters for email,
        roles, statuses, project and instance.
      parameters:
      - description: Page size
        in: query
        name: pageSize
        type: integer
      - description: Page token for pagination
        in: query
        name: pageToken
        type: string
      - description: Filter by email
        in: query
        name: email
        type: string
      - collectionFormat: multi
        description: Filter by roles
        in: query
        items:
          enum:
          - org:owner
          - org:member
          - org:billing_admin
          - org:billing_viewer
          - org:audit_admin
          - project:owner
          - project:dev
          - project:readonly
          - project:ctl_plane_viewer
          - cluster:admin
          - cluster:viewer
          type: string
        name: roles
        type: array
      - collectionFormat: multi
        description: Filter by statuses
        in: query
        items:
          enum:
          - Active
          - Pending
          type: string
        name: statuses
        type: array
      - description: Order by field and direction, e.g. 'email desc'
        enum:
        - email asc
        - email desc
        - invite_time asc
        - invite_time desc
        - login_time asc
        - login_time desc
        in: query
        name: orderBy
        type: string
      - description: Filter by project ID
        in: query
        name: projectId
        type: string
      - description: Filter by instance ID
        in: query
        name: instanceId
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.OpenApiListUsersRsp'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "403":
          description: Forbidden
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "500":
          description: Internal Server Error
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: List members
      tags:
      - Member
    post:
      consumes:
      - application/json
      description: Invite one or more members to the organization with specified org,
        project and instance roles.
      parameters:
      - description: invite members request
        in: body
        name: body
        required: true
        schema:
          $ref: '#/definitions/api.OpenApiInviteUsersReq'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.OpenApiInviteUsersRsp'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "403":
          description: Forbidden
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "500":
          description: Internal Server Error
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Invite members
      tags:
      - Member
  /members/{user_id}:
    delete:
      consumes:
      - application/json
      description: Remove a member from the organization. The member will lose all
        roles within the org.
      parameters:
      - description: User ID
        in: path
        name: user_id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "403":
          description: Forbidden
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "500":
          description: Internal Server Error
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Delete a member
      tags:
      - Member
    patch:
      consumes:
      - application/json
      description: Update a member's org role, project roles and instance roles. Project
        roles and instance roles are fully replaced when provided.
      parameters:
      - description: User ID
        in: path
        name: user_id
        required: true
        type: string
      - description: update member request
        in: body
        name: body
        required: true
        schema:
          $ref: '#/definitions/api.openApiUpdateUserReqDoc'
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "403":
          description: Forbidden
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "500":
          description: Internal Server Error
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Update a member
      tags:
      - Member
  /members/{user_id}/resendInvitation:
    post:
      consumes:
      - application/json
      description: Resend invitation email to a member who has not yet accepted the
        invitation.
      parameters:
      - description: User ID
        in: path
        name: user_id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "403":
          description: Forbidden
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "500":
          description: Internal Server Error
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Resend invitation
      tags:
      - Member
  /members/batchUpdate:
    post:
      consumes:
      - application/json
      description: Batch update multiple members' org, project and instance roles
        in a single request (max 100 users per request).
      parameters:
      - description: batch update members request
        in: body
        name: body
        required: true
        schema:
          $ref: '#/definitions/api.openApiBatchUpdateUsersReqDoc'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.OpenApiBatchUpdateUsersRsp'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "403":
          description: Forbidden
          schema:
            $ref: '#/definitions/api.OpenApiError'
        "500":
          description: Internal Server Error
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Batch update members
      tags:
      - Member
swagger: "2.0"
