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

# تعيين دور

> إنشاء تعيين دور الحساب

<script src="/locale-bridge.js" />


## OpenAPI

````yaml /openapi.ar.json POST /v1/public/accounts/{account_id}/auth/role-assignments
openapi: 3.1.0
info:
  title: Code API (Public)
  version: 1.0.0
servers:
  - url: https://api.hybridbox.io
security: []
paths:
  /v1/public/accounts/{account_id}/auth/role-assignments:
    post:
      tags:
        - public-accounts
        - public-account-auth
      summary: إنشاء تعيين دور الحساب
      description: قم بإنشاء مهمة دور على نطاق الحساب.
      operationId: >-
        create_public_account_role_assignment_v1_public_accounts__account_id__auth_role_assignments_post
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            format: uuid
            title: Account Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleAssignmentRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleAssignmentResponse'
          description: ''
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: خطأ في التحقق
      security:
        - PublicBearerAuth: []
components:
  schemas:
    RoleAssignmentRequest:
      description: طلب مخطط لإنشاء تعيين دور جديد.
      properties:
        resource_id:
          description: معرف موارد نطاق المهمة
          format: uuid
          title: معرّف المورد
          type: string
        resource_type:
          $ref: '#/components/schemas/ResourceType'
          description: نوع مورد نطاق التعيين
        role_key:
          $ref: '#/components/schemas/RoleKey'
          description: مفتاح الدور المحدد بالكود
        subject_id:
          description: معرّف مستخدم أو مجموعة أو حساب خدمة
          minLength: 1
          title: معرّف الموضوع
          type: string
        subject_type:
          $ref: '#/components/schemas/SubjectType'
          description: 'نوع موضوع تعيين الدور: user أو group أو service_account'
      required:
        - subject_type
        - subject_id
        - role_key
        - resource_type
        - resource_id
      title: RoleAssignmentRequest
      type: object
    RoleAssignmentResponse:
      properties:
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: تاريخ الإنشاء
        expanded_capability_keys:
          items:
            type: string
          title: مفاتيح القدرة الموسعة
          type: array
        id:
          format: uuid
          title: المعرّف
          type: string
        resource_id:
          format: uuid
          title: معرّف المورد
          type: string
        resource_type:
          title: نوع المورد
          type: string
        revoked_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: وقت الإلغاء
        role_key:
          title: مفتاح الدور
          type: string
        subject_id:
          title: معرّف الموضوع
          type: string
        subject_type:
          title: نوع الموضوع
          type: string
      required:
        - id
        - subject_type
        - subject_id
        - role_key
        - resource_type
        - resource_id
        - expanded_capability_keys
      title: RoleAssignmentResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: التفاصيل
          type: array
      title: HTTPخطأ تحقق
      type: object
    ResourceType:
      description: أنواع مورد التفويض ونطاقه.
      enum:
        - client
        - account
        - workspace
        - domain
        - dns_record
        - mailbox
        - redirect
        - forwarding
        - credential
        - tenant
        - route
        - proxy
      title: ResourceType
      type: string
    RoleKey:
      description: معرفات دور مستقرة قابلة لإعادة الاستخدام.
      enum:
        - viewer
        - editor
        - domain_manager
        - manager
        - dns_manager
        - ip_manager
        - billing_viewer
        - billing_admin
        - credential_manager
      title: RoleKey
      type: string
    SubjectType:
      description: أنواع موضوع التفويض.
      enum:
        - user
        - group
        - service_account
      title: SubjectType
      type: string
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: الموقع
          type: array
        msg:
          title: الرسالة
          type: string
        type:
          title: نوع الخطأ
          type: string
      required:
        - loc
        - msg
        - type
      title: خطأ تحقق
      type: object
  securitySchemes:
    PublicBearerAuth:
      bearerFormat: JWT or Hybridbox Service account token
      description: >-
        Public API bearer credential sent as `Authorization: Bearer <token>`.
        Use either an OAuth access token or a Hybridbox Service account token.
      scheme: bearer
      type: http

````