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

# GET 用户

> 按 ID 获取用户。返回直接分配的角色以及由 IDP 组派生的角色分配。

此端点返回指定 ID 的用户信息，包括直接分配的角色 (`role_assignments`) 以及从 IDP 组继承的角色分配 (`idp_role_assignments`) 。

<div id="permissions">
  ## 权限
</div>

需要一个在企业级具有 `ViewAccountMembership` 权限的服务用户。


## OpenAPI

````yaml zh/v3-openapi.yaml GET /v3/enterprise/members/users/{user_id}
openapi: 3.1.0
info:
  description: 采用 Service User 身份验证和 RBAC 的 Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/enterprise/members/users/{user_id}:
    get:
      tags:
        - users
      summary: GET 用户
      description: 按 ID 获取用户。返回直接分配的角色以及由 IDP 组派生的角色分配。
      operationId: handle_get_enterprise_user_v3_enterprise_members_users__user_id__get
      parameters:
        - description: 用户 ID
          in: path
          name: user_id
          required: true
          schema:
            title: User Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserWithIdpRoles'
          description: 成功响应
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 验证错误
components:
  schemas:
    UserWithIdpRoles:
      description: 同时具有直接角色分配和源自 IDP 组的角色分配的用户。
      properties:
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        idp_role_assignments:
          items:
            $ref: '#/components/schemas/IdpRoleAssignment'
          title: Idp Role Assignments
          type: array
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        role_assignments:
          items:
            $ref: '#/components/schemas/RoleAssignment'
          title: Role Assignments
          type: array
        user_id:
          title: User Id
          type: string
      required:
        - user_id
        - email
        - name
        - role_assignments
      title: UserWithIdpRoles
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    IdpRoleAssignment:
      description: 通过 IDP 组成员资格继承的角色分配。
      properties:
        idp_group_name:
          title: Idp Group Name
          type: string
        org_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Id
        role:
          $ref: '#/components/schemas/Role'
      required:
        - role
        - idp_group_name
      title: IdpRoleAssignment
      type: object
    RoleAssignment:
      properties:
        org_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Id
        role:
          $ref: '#/components/schemas/Role'
      required:
        - role
      title: RoleAssignment
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    Role:
      properties:
        role_id:
          title: Role Id
          type: string
        role_name:
          title: Role Name
          type: string
        role_type:
          enum:
            - enterprise
            - org
          title: Role Type
          type: string
      required:
        - role_name
        - role_id
        - role_type
      title: Role
      type: object
  securitySchemes:
    bearerAuth:
      description: 服务用户凭据（前缀：cog_）
      scheme: bearer
      type: http

````