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

# تسجيل وكيل

> تسجيل هوية وكيل آلي جديدة مع زوج مفاتيح تشفير وأذونات محددة النطاق

# تسجيل وكيل

`POST /v1/agents`

يسجل هوية وكيل آلي جديدة للمستأجر المصادق عليه. تنشئ المنصة زوج مفاتيح Ed25519 للوكيل، وتخصص معرف وكيل متوافق مع MAIP، وتسجل المفتاح الأولي في دفتر سجل تاريخ المفاتيح. تبدأ الوكلاء المسجلون حديثًا بحالة `active` ودرجة ثقة أولية تبلغ `0.500`.

> [!NOTE]
>
> يعتمد عدد الوكلاء الذين يمكنك تسجيلهم على خطة الفوترة الخاصة بك. إذا كنت
> تجاوز حد خطتك، تُرجع واجهة برمجة التطبيقات `402 Payment Required`. اتصل بالمبيعات
> لحدود وكيل مستوى المؤسسة.

### المصادقة

يتطلب رأس `X-API-Key` أو رمز Bearer JWT. يتم اشتقاق مساحة العمل من بيانات الاعتماد الموثقة؛ لا ترسل `X-Tenant-ID`.

### الاستجابة

**id** `string`

المفتاح الأساسي UUID الداخلي.

**agent\_id** `string`

معرف وكيل متوافق مع MAIP بالتنسيق `maip:<tenant8>:<ulid>`. استخدم هذه القيمة
في جميع استدعاءات API اللاحقة التي تشير إلى هذا الوكيل.

**tenant\_id** `string`

معرف UUID للمستأجر المالك.

**agent\_type** `string`

نوع الوكيل المسجل.

**display\_name** `string`

اسم الوكيل المقروء بشريًا.

**description** `string`

وصف الوكيل، إذا تم توفيره.

**trust\_level** `string`

مستوى الثقة الأولي. يبدأ الوكلاء المسجلون حديثًا عند `"authenticated"`.

**trust\_score** `number`

درجة الثقة الرقمية (0.0 إلى 1.0). يبدأ الوكلاء المسجلون حديثًا عند `0.500`.

**status** `string`

حالة دورة حياة الوكيل. دائمًا `"active"` عند الإنشاء.

**public\_key** `string`

مفتاح Ed25519 العام المشفر بـ Base64url الذي تم إنشاؤه لهذا الوكيل. قم بتخزين هذا
بأمان للتحقق من التوقيع.

**key\_id** `string`

معرف فريد لمفتاح توقيع الوكيل. مشار إليه في الإيصالات و
الشهادات.

**scopes** `string[]`

النطاقات الفعالة المخصصة للوكيل.

**metadata** `object`

كائن البيانات الوصفية، إذا تم توفيره.

**delegation\_depth** `number`

عمق سلسلة التفويض الحالي. دائمًا `0` للوكلاء المسجلين مباشرة.
الحد الأقصى للعمق هو `8` لكل بروتوكول MAIP.

**created\_by\_user\_id** `string`

معرف UUID للمستخدم الذي سجل الوكيل، إذا تم المصادقة عبر رمز المستخدم.

**expires\_at** `string`

طابع زمني للانتهاء، إذا تم تعيينه.

**created\_at** `string`

طابع زمني لإنشاء ISO 8601.

**updated\_at** `string`

طابع زمني لآخر تحديث ISO 8601.

### مثال

```bash theme={null}
curl -X POST https://api.truthlocks.com/v1/agents \
  -H "X-API-Key: tl_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "agent_type": "llm",
    "display_name": "Customer Support Bot",
    "description": "Handles Tier-1 customer support inquiries via chat",
    "scopes": ["data:read", "tool:search.web", "!data:delete"],
    "metadata": {
      "team": "support",
      "model": "claude-3.5-sonnet",
      "environment": "production"
    }
  }'
```


## OpenAPI

````yaml ar/mint-openapi.yaml POST /v1/agents
openapi: 3.0.3
info:
  title: Truthlocks API
  description: >
    Truthlocks هي بنية تحتية عالمية للتحقق من المستندات وبيانات الاعتماد والأصول
    الرقمية.يحدد هذا المواصفات واجهة برمجة التطبيقات (API) الأساسية للتفاعل مع
    خدمات Truthlocks.


    ## عناوين URL الأساسية

    - **الإنتاج**: `https://api.truthlocks.com`

    - **البيئة التجريبية (Sandbox)**: `https://sandbox-api.truthlocks.com`


    ## المصادقة

    - **مفاتيح API**: استخدم رأس `X-API-Key` للعمليات من جهاز إلى جهاز

    - **رموز Bearer**: استخدم `Authorization: Bearer <jwt>` للعمليات التي يبدأها
    المستخدم


    ## هوية المستأجر

    في بيئة الإنتاج، تُستمد هوية المستأجر من السياق المصادق عليه (مفتاح API أو
    JWT).

    يتم تجاهل رأس `X-Tenant-ID` في بيئة الإنتاج لمنع الانتحال.
  version: 1.0.0
  contact:
    name: Truthlocks Support
    url: https://truthlocks.com/support
    email: support@truthlocks.com
servers:
  - url: https://api.truthlocks.com
    description: واجهة برمجة تطبيقات الإنتاج
  - url: https://sandbox-api.truthlocks.com
    description: بيئة اختبار (Sandbox)
security:
  - APIKey: []
  - BearerAuth: []
tags:
  - name: Authentication
    description: إدارة مفاتيح ورموز API
  - name: Issuers
    description: تسجيل المصدر وإدارة الثقة
  - name: Keys
    description: إدارة المفاتيح التشفيرية لجهات الإصدار
  - name: Attestations
    description: دورة حياة الإشهاد (السك، الإلغاء، الاستبدال)
  - name: Verification
    description: حزم التحقق والإثبات للإشهاد
  - name: Governance
    description: سير عمل حوكمة المصدر (للمسؤول فقط)
  - name: Identity
    description: إدارة المنظمة والمستخدمين والأدوار
  - name: Audit
    description: استعلامات أحداث التدقيق
  - name: Tenant Console
    description: ملف تعريف المستأجر ونقاط نهاية دورة الحياة
  - name: Health
    description: نقاط نهاية صحة الخدمة وجاهزيتها
  - name: Risk
    description: استيعاب إشارة المخاطر واكتشاف الاحتيال
  - name: Risk Enforcement
    description: إجراءات إنفاذ المخاطر — الحظر والتحدي والحجر والتكوين
  - name: Billing
    description: إدارة الفوترة والاشتراكات والإضافات
  - name: Machine Identity
    description: >-
      بروتوكول هوية وكيل الآلة (MAIP) — تسجيل الوكيل، الجلسات، الثقة، الشهادة،
      الامتثال، التنسيق، والمراقبة
externalDocs:
  description: واجهة برمجة تطبيقات الشفافية للقراءة فقط (مواصفات خدمة منفصلة)
  url: >-
    https://github.com/truthlocks/truthlock/blob/main/docs/transparency/openapi.yaml
paths:
  /v1/agents:
    post:
      tags:
        - Machine Identity
      summary: تسجيل وكيل
      description: >-
        تسجيل هوية وكيل آلي جديدة. يعيد سجل الوكيل بما في ذلك مفتاح عام تم
        إنشاؤه ودرجة ثقة أولية.
      operationId: maip.agents.register
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                agent_type:
                  type: string
                  description: تصنيف الوكيل
                  enum:
                    - orchestrator
                    - worker
                    - inference
                    - pipeline
                    - service
                    - bot
                    - llm
                description:
                  type: string
                  description: وصف نصي حر لغرض الوكيل
                display_name:
                  type: string
                  description: اسم الوكيل المقروء بشريًا
                  maxLength: 256
                expires_at:
                  format: date-time
                  nullable: true
                  type: string
                metadata:
                  description: بيانات وصفية عشوائية على شكل مفتاح-قيمة
                scopes:
                  items:
                    type: string
                  type: array
                  description: نطاقات الأذونات الممنوحة للوكيل
              type: object
              required:
                - display_name
      responses:
        '201':
          description: تم تسجيل الوكيل
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MaipAgent'
        '400':
          description: خطأ في التحقق
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: المصادقة مطلوبة
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: تجاوز حد المعدل
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - APIKey: []
components:
  schemas:
    MaipAgent:
      type: object
      properties:
        id:
          type: string
          format: uuid
        agent_type:
          type: string
          enum:
            - orchestrator
            - worker
            - inference
            - pipeline
            - service
            - bot
            - llm
        display_name:
          type: string
          maxLength: 256
        description:
          type: string
        status:
          type: string
          enum:
            - active
            - suspended
            - revoked
        scopes:
          type: array
          items:
            type: string
        metadata:
          type: object
          additionalProperties: true
        trust_score:
          type: number
          format: float
          minimum: 0
          maximum: 1
        public_key:
          type: string
          description: المفتاح العام المشفر بـ Base64
        session_count:
          type: integer
        keys:
          type: array
          items:
            type: object
            properties:
              kid:
                type: string
              algorithm:
                type: string
              public_key:
                type: string
              status:
                type: string
                enum:
                  - active
                  - disabled
                  - expired
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ErrorEnvelope:
      type: object
      required:
        - code
        - message
        - http_status
      properties:
        code:
          type: string
          description: رمز خطأ قابل للقراءة آليًا
          enum:
            - AUTH_REQUIRED
            - AUTH_INVALID
            - PERMISSION_DENIED
            - TENANT_IDENTITY_UNVERIFIED
            - NOT_FOUND
            - VALIDATION_ERROR
            - CONFLICT
            - PAYLOAD_TOO_LARGE
            - RATE_LIMIT_EXCEEDED
            - QUOTA_EXCEEDED
            - SERVICE_UNAVAILABLE
            - INTERNAL_ERROR
        message:
          type: string
          description: رسالة خطأ مقروءة بشريًا
        http_status:
          type: integer
          description: رمز حالة HTTP
        retry_after_ms:
          type: integer
          description: عدد المللي ثانية للانتظار قبل إعادة المحاولة (لحدود المعدل)
        details:
          type: object
          description: سياق خطأ إضافي
      example:
        code: AUTH_REQUIRED
        message: Authentication required
        http_status: 401
  securitySchemes:
    APIKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: مفتاح API للمصادقة من جهاز إلى جهاز
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT للعمليات التي يبدأها المستخدم

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.