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

# إنشاء قالب تصميم خاص بالمستخدم

> POST /qr-assets/design-template/

يحفظ قالب تصميم جديدًا لفئة QR أو نموذج، على مضيف **Management API** (‏`api.scanova.io`‏)، مع المصادقة باستخدام مفتاح Management API الخام الخاص بك.

```
POST https://api.scanova.io/qr-assets/design-template/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
```

<ParamField body="name" type="string" required>
  اسم القالب، بحد أقصى 150 حرفًا.
</ParamField>

<ParamField body="resource_type" type="string" default="qr_category">
  ‏`qr_category` أو `form`.
</ParamField>

<ParamField body="category" type="integer">
  معرّف `QRCategory` الذي ينتمي إليه هذا القالب. **مطلوب** عندما تكون `resource_type` بقيمة `qr_category`؛ **يجب حذفه** عندما تكون `resource_type` بقيمة `form`.
</ParamField>

<ParamField body="design_info" type="object">
  بيانات تصميم JSON عشوائية.
</ParamField>

<ParamField body="gradient_type" type="string">
  نمط التدرج، مثل `linear`.
</ParamField>

<ParamField body="color_palette" type="string">
  لوحة الألوان، عادةً مُرمَّزة كسلسلة JSON.
</ParamField>

<ParamField body="font_styles" type="string">
  بيانات نمط الخط.
</ParamField>

<ParamField body="is_template" type="boolean" default="false">
  يضع علامة على هذا السجل كقالب قابل لإعادة الاستخدام بدلًا من حفظ لمرة واحدة.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.scanova.io/qr-assets/design-template/" \
    -H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Blue Gradient",
      "resource_type": "qr_category",
      "category": 3,
      "design_info": { "bg": "#0033ff" },
      "gradient_type": "linear",
      "is_template": true
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": 9,
    "name": "Blue Gradient",
    "resource_type": "qr_category",
    "category": 3,
    "design_info": { "bg": "#0033ff" },
    "gradient_type": "linear",
    "color_palette": null,
    "font_styles": null,
    "is_template": true,
    "info": null,
    "template_id": null
  }
  ```
</ResponseExample>

## قاعدة الاقتران بين `resource_type` و`category`

يكون `category` مطلوبًا مع `resource_type=qr_category` ومحظورًا مع `resource_type=form` — يفرض كل من المُسلسِل وقيد فحص في قاعدة البيانات هذه القاعدة، لذا لا يمكن أن يحدث انحراف. يُعاد `400` مع `{"category": "This field is required for qr_category templates."}` أو الرسالة العكسية إذا عكستهما.

## ذات صلة

* [سرد قوالب التصميم الخاصة بالمستخدم](/ar/api-reference/management-api/qr-assets/design-template-list) — الاطلاع على القوالب المحفوظة.
* [تحديث قالب تصميم خاص بالمستخدم](/ar/api-reference/management-api/qr-assets/design-template-update) — تعديل قالب موجود.
* [نظرة عامة على Management API](/ar/api-reference/management-api/overview) — مخطط المصادقة وقواعد الحصة المطبّقة على نقطة النهاية هذه.


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /qr-assets/design-template/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.scanova.io (QR codes, folders, tags, leads, forms, analytics, plans,
    shared users & roles), plus the token-creation and usage-stats endpoints
    used to authenticate against it. Every path and request/response shape below
    was verified live against a real API key and the actual running backend
    (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /qr-assets/design-template/:
    post:
      summary: Create a user design template
      description: >-
        `category` is required when `resource_type` is `qr_category`, and must
        be omitted (null) when `resource_type` is `form` — enforced by both the
        serializer and a DB check constraint.
      operationId: createUserDesignTemplate
      requestBody:
        content:
          application/json:
            example:
              name: Blue Gradient
              resource_type: qr_category
              category: 3
              design_info:
                bg: '#0033ff'
              gradient_type: linear
              is_template: true
      responses:
        '201':
          description: Template created.
          content:
            application/json:
              example:
                id: 9
                name: Blue Gradient
                resource_type: qr_category
                category: 3
                design_info:
                  bg: '#0033ff'
                gradient_type: linear
                color_palette: null
                font_styles: null
                is_template: true
                info: null
                template_id: abc123
        '400':
          description: >-
            `category` missing for a qr_category template, or provided for a
            form template.
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````