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

# 分配组织服务用户

> 将组织角色分配给服务用户。

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

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


## OpenAPI

````yaml zh/v3-openapi.yaml POST /v3/enterprise/organizations/{org_id}/members/service-users/{service_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/organizations/{org_id}/members/service-users/{service_user_id}:
    post:
      tags:
        - service_users
      summary: 分配组织服务用户
      description: 将组织角色分配给服务用户。
      operationId: >-
        handle_assign_organization_service_user_role_v3_enterprise_organizations__org_id__members_service_users__service_user_id__post
      parameters:
        - description: 组织 ID（前缀：org-）
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
        - description: 服务用户 ID（前缀：service-user-）
          in: path
          name: service_user_id
          required: true
          schema:
            example: service-user-abc123def456
            title: Service User Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceUserUpdateRoleRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceUser'
          description: 成功响应
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 验证错误
components:
  schemas:
    ServiceUserUpdateRoleRequest:
      properties:
        role_id:
          title: Role Id
          type: string
      required:
        - role_id
      title: ServiceUserUpdateRoleRequest
      type: object
    ServiceUser:
      properties:
        deleted_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Deleted At
        expires_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expires At
        name:
          title: Name
          type: string
        role_assignments:
          items:
            $ref: '#/components/schemas/RoleAssignment'
          title: Role Assignments
          type: array
        service_user_id:
          title: Service User Id
          type: string
      required:
        - service_user_id
        - name
        - expires_at
        - deleted_at
        - role_assignments
      title: ServiceUser
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      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

````