> ## 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.

# إنشاء نوع إيصال

> يسجل نوع إيصال مخصصًا باستخدام مخطط JSON للتحقق من صحة الحمولة.

ينشئ نوع إيصال مخصص للمستأجر مع مخطط JSON للتحقق من صحة الحمولة. الأنواع المحددة بواسطة النظام الأساسي (`payment_receipt`, `security_event_receipt`, `delivery_receipt`, `compliance_receipt`, `custom_receipt`) للقراءة فقط ولا يمكن تجاوزها أو استبدالها.

يتم عزل الأنواع المخصصة للمستأجر المصادق عليه بواسطة أمان مستوى الصف. لا يمكن للمستأجرين الآخرين رؤية أو استخدام أنواعك المخصصة.

## نص الطلب

| الحقل | النوع | مطلوب | الوصف |
| - | - | - | - |
| `name` | string | نعم | معرّف فريد بصيغة snake\_case (مثال: `invoice_receipt`). يجب ألا يتعارض مع أسماء أنواع المنصات. |
| `display_name` | string | نعم | تسمية قابلة للقراءة البشرية تظهر في واجهة مستخدم وحدة التحكم. |
| `version` | string | لا | سلسلة SemVer (افتراضيًا `1.0.0`). أنشئ إصدارات متعددة لإدارة تطور المخطط. |
| `schema` | object | نعم | مخطط JSON صالح (مسودة 2020-12) يصف بنية `payload` المطلوبة. |
| `description` | string | لا | وصف نصي عادي للتوثيق. |

### متطلبات المخطط

يجب أن يكون الحقل `schema` مخطط JSON صالحًا (مسودة 2020-12). قم بتضمين مصفوفة `required` لفرض حقول الحمولة الإلزامية عند سك العملة.

```json theme={null}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": ["invoice_number", "amount", "currency"],
  "properties": {
    "invoice_number": { "type": "string" },
    "amount":         { "type": "integer", "description": "Amount in smallest currency unit" },
    "currency":       { "type": "string", "minLength": 3, "maxLength": 3 }
  },
  "additionalProperties": false
}
```

### تحديد الإصدارات

أنشئ إصدارات متعددة من نفس النوع عن طريق تمرير قيم `version` مختلفة (`1.0.0`، `2.0.0`، إلخ). تقوم الإيصالات دائمًا بتثبيت الإصدار في وقت السك، لذا لا تتأثر الإيصالات الموجودة عند تقديم إصدار جديد.

لإهمال إصدار قديم، استخدم `PATCH /v1/receipt-types/{name}` مع `{"status": "deprecated"}`.

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


## OpenAPI

````yaml ar/mint-openapi.yaml POST /v1/receipt-types
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/receipt-types:
    post:
      tags:
        - Receipts
      summary: إنشاء نوع إيصال
      description: يسجل نوع إيصال مخصصًا باستخدام مخطط JSON للتحقق من صحة الحمولة.
      operationId: receiptTypes.create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                description:
                  nullable: true
                  type: string
                display_name:
                  type: string
                  description: اسم مقروء بشريًا
                name:
                  type: string
                  description: اسم نوع الإيصال القابل للقراءة آليًا
                schema:
                  description: مخطط JSON للتحقق من صحة الحمولة
                version:
                  type: string
              type: object
              required:
                - name
                - display_name
                - schema
      responses:
        '201':
          description: تم إنشاء نوع الإيصال
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                  display_name:
                    type: string
                  schema:
                    type: object
                  created_at:
                    type: string
        '401':
          description: المصادقة مطلوبة
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - APIKey: []
components:
  schemas:
    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.