<!-- Canonical: https://docs.incele.ai/ar/%D9%85%D8%B1%D8%AC%D8%B9-api/ -->
# مرجع API

يستخدم REST مفاتيح bearer للحساب بصلاحيات محددة. يستخدم MCP رموز OAuth عبر https://api.incele.ai/mcp. تتطلب كل أداة لمساحة العمل workspaceId في المستوى الأعلى؛ ويختار REST المساحة في المسار. تأتي معرّفات العمليات ونطاقات الصلاحيات والحقول والمخططات أدناه من سجل API الحالي.

عنوان URL الأساسي: https://api.incele.ai

## المنتجات: عرض القائمة {#list-products}

`list_products` · `GET /v1/workspaces/{workspaceId}/products`

الصلاحية المطلوبة: `products:read`. هدف التفويض: `workspace`.

تشمل المنتجات غير النشطة، مع دعم تقسيم النتائج إلى صفحات والبحث والتصفية حسب الحالة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {},
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      }
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المنتج: قراءة {#get-product}

`get_product` · `GET /v1/workspaces/{workspaceId}/products/{id}`

الصلاحية المطلوبة: `products:read`. هدف التفويض: `workspace`.

تعيد منتجًا تابعًا لمساحة العمل المحددة، بما في ذلك المنتج غير النشط.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المنتج: إنشاء {#create-product}

`create_product` · `POST /v1/workspaces/{workspaceId}/products`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

الحقول: name وbrand وsku وbarcode وstock وstatus (ACTIVE/INACTIVE/DELETED) وdescription وinformation وimageIds وtagIds وsales. تُطبّق قواعد التحقق الخاصة بالنشاط.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "brand": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "sku": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "barcode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "stock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 999999
        },
        "status": {
          "type": "string",
          "enum": [
            "ACTIVE",
            "INACTIVE",
            "DELETED"
          ]
        },
        "description": {
          "default": "",
          "type": "string",
          "maxLength": 100000
        },
        "information": {
          "type": "string",
          "maxLength": 500000
        },
        "questionIds": {
          "minItems": 0,
          "maxItems": 5,
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "imageIds": {
          "default": [],
          "description": "Uploaded image identifiers in gallery order. Only the first five unique images are retained.",
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        },
        "tagIds": {
          "default": [],
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        },
        "sales": {
          "default": [],
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1
              },
              "link": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "name",
              "link"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "name",
        "brand",
        "sku",
        "barcode",
        "stock",
        "status",
        "description",
        "information",
        "imageIds",
        "tagIds",
        "sales"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المنتج: تحديث {#update-product}

`update_product` · `PUT /v1/workspaces/{workspaceId}/products/{id}`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

اقرأ المنتج أولًا، ثم أرسل جميع قيمه الحالية القابلة للتعديل. تستخدم الحقول نفسها في create_product.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "brand": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "sku": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "barcode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        },
        "stock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 999999
        },
        "status": {
          "type": "string",
          "enum": [
            "ACTIVE",
            "INACTIVE",
            "DELETED"
          ]
        },
        "description": {
          "default": "",
          "type": "string",
          "maxLength": 100000
        },
        "information": {
          "type": "string",
          "maxLength": 500000
        },
        "questionIds": {
          "minItems": 0,
          "maxItems": 5,
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "imageIds": {
          "default": [],
          "description": "Uploaded image identifiers in gallery order. Only the first five unique images are retained.",
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        },
        "tagIds": {
          "default": [],
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        },
        "sales": {
          "default": [],
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1
              },
              "link": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "name",
              "link"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "name",
        "brand",
        "sku",
        "barcode",
        "stock",
        "status",
        "description",
        "information",
        "imageIds",
        "tagIds",
        "sales"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المنتج: حذف نهائي {#delete-product}

`delete_product` · `DELETE /v1/workspaces/{workspaceId}/products/{id}`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

تحذف المنتج وارتباطاته نهائيًا.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المجموعات: عرض القائمة {#list-collections}

`list_collections` · `GET /v1/workspaces/{workspaceId}/collections`

الصلاحية المطلوبة: `collections:read`. هدف التفويض: `workspace`.

تدعم تقسيم النتائج إلى صفحات والبحث.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {},
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      }
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المجموعة: إنشاء {#create-collection}

`create_collection` · `POST /v1/workspaces/{workspaceId}/collections`

الصلاحية المطلوبة: `collections:write`. هدف التفويض: `workspace`.

الحقول: name وdescription وtagIds وimageId. أضف المنتجات بشكل منفصل باستخدام add_collection_product.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "description": {
          "default": "",
          "type": "string",
          "maxLength": 100000
        },
        "imageId": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            {
              "type": "null"
            }
          ]
        },
        "tagIds": {
          "default": [],
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        }
      },
      "required": [
        "name",
        "description",
        "tagIds"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المجموعة: تحديث {#update-collection}

`update_collection` · `PUT /v1/workspaces/{workspaceId}/collections/{id}`

الصلاحية المطلوبة: `collections:write`. هدف التفويض: `workspace`.

أرسل جميع القيم الحالية القابلة للتعديل.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "description": {
          "default": "",
          "type": "string",
          "maxLength": 100000
        },
        "imageId": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            {
              "type": "null"
            }
          ]
        },
        "tagIds": {
          "default": [],
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        }
      },
      "required": [
        "name",
        "description",
        "tagIds"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المجموعة: حذف نهائي {#delete-collection}

`delete_collection` · `DELETE /v1/workspaces/{workspaceId}/collections/{id}`

الصلاحية المطلوبة: `collections:write`. هدف التفويض: `workspace`.

الحذف نهائي.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الوسوم: عرض القائمة {#list-tags}

`list_tags` · `GET /v1/workspaces/{workspaceId}/tags`

الصلاحية المطلوبة: `tags:read`. هدف التفويض: `workspace`.

تدعم تقسيم النتائج إلى صفحات والبحث.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {},
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      }
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الوسم: إنشاء {#create-tag}

`create_tag` · `POST /v1/workspaces/{workspaceId}/tags`

الصلاحية المطلوبة: `tags:write`. هدف التفويض: `workspace`.

أرسل الحقل name.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الوسم: تحديث {#update-tag}

`update_tag` · `PUT /v1/workspaces/{workspaceId}/tags/{id}`

الصلاحية المطلوبة: `tags:write`. هدف التفويض: `workspace`.

أرسل جميع القيم الحالية القابلة للتعديل.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الوسم: حذف نهائي {#delete-tag}

`delete_tag` · `DELETE /v1/workspaces/{workspaceId}/tags/{id}`

الصلاحية المطلوبة: `tags:write`. هدف التفويض: `workspace`.

الحذف نهائي.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## المجموعة: قراءة {#get-collection}

`get_collection` · `GET /v1/workspaces/{workspaceId}/collections/{id}`

الصلاحية المطلوبة: `collections:read`. هدف التفويض: `workspace`.

تتضمن ارتباطات المجموعة بالمنتجات والوسوم.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الوسم: قراءة {#get-tag}

`get_tag` · `GET /v1/workspaces/{workspaceId}/tags/{id}`

الصلاحية المطلوبة: `tags:read`. هدف التفويض: `workspace`.

تعيد السجل المحدد.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## قوالب الموقع: عرض القائمة {#list-templates}

`list_templates` · `GET /v1/templates`

الصلاحية المطلوبة: `website:read`. هدف التفويض: `account`.

تعيد فقط قوالب المواقع العامة المتاحة لإنشاء مساحة عمل.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## قوالب موقع مساحة العمل: عرض القائمة {#list-workspace-templates}

`list_workspace_templates` · `GET /v1/workspaces/{workspaceId}/website/templates`

الصلاحية المطلوبة: `website:read`. هدف التفويض: `workspace`.

تعيد القوالب العامة والقوالب الخاصة المعيّنة لمساحة العمل المحددة. لا يؤدي منح الوصول إلى تغيير التصميم المحدد.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## منتجات المجموعة: عرض القائمة {#list-collection-products}

`list_collection_products` · `GET /v1/workspaces/{workspaceId}/collections/{id}/products`

الصلاحية المطلوبة: `collections:read`. هدف التفويض: `workspace`.

تعيد المنتجات المرتبطة بالمجموعة المحددة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "query": {
      "default": {},
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      }
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## منتجات المجموعة: إضافة {#add-collection-product}

`add_collection_product` · `POST /v1/workspaces/{workspaceId}/collections/{id}/products/{productId}`

الصلاحية المطلوبة: `collections:write`. هدف التفويض: `workspace`.

يجب أن ينتمي السجلان المرتبطان إلى مساحة العمل نفسها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "productId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "productId",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## وسم المنتج: إضافة {#add-product-tag}

`add_product_tag` · `POST /v1/workspaces/{workspaceId}/products/{id}/tags/{tagId}`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

يجب أن ينتمي السجلان المرتبطان إلى مساحة العمل نفسها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "tagId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "tagId",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## وسم المجموعة: إضافة {#add-collection-tag}

`add_collection_tag` · `POST /v1/workspaces/{workspaceId}/collections/{id}/tags/{tagId}`

الصلاحية المطلوبة: `collections:write`. هدف التفويض: `workspace`.

يجب أن ينتمي السجلان المرتبطان إلى مساحة العمل نفسها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "tagId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "tagId",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## منتجات المجموعة: إزالة الارتباط {#remove-collection-product}

`remove_collection_product` · `DELETE /v1/workspaces/{workspaceId}/collections/{id}/products/{productId}`

الصلاحية المطلوبة: `collections:write`. هدف التفويض: `workspace`.

يجب أن ينتمي السجلان المرتبطان إلى مساحة العمل نفسها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "productId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "productId",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## وسم المنتج: إزالة الارتباط {#remove-product-tag}

`remove_product_tag` · `DELETE /v1/workspaces/{workspaceId}/products/{id}/tags/{tagId}`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

يجب أن ينتمي السجلان المرتبطان إلى مساحة العمل نفسها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "tagId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "tagId",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## وسم المجموعة: إزالة الارتباط {#remove-collection-tag}

`remove_collection_tag` · `DELETE /v1/workspaces/{workspaceId}/collections/{id}/tags/{tagId}`

الصلاحية المطلوبة: `collections:write`. هدف التفويض: `workspace`.

يجب أن ينتمي السجلان المرتبطان إلى مساحة العمل نفسها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "tagId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "tagId",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## ملفات الوسائط: عرض القائمة {#list-media}

`list_media` · `GET /v1/workspaces/{workspaceId}/media`

الصلاحية المطلوبة: `media:read`. هدف التفويض: `workspace`.

تدعم تقسيم النتائج إلى صفحات ومعلومات الاستخدام والبحث.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {},
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      }
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## ملفات الوسائط: قراءة {#get-media}

`get_media` · `GET /v1/workspaces/{workspaceId}/media/{id}`

الصلاحية المطلوبة: `media:read`. هدف التفويض: `workspace`.

تعيد البيانات الوصفية لملف الوسائط المرفوع.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الصورة: رفع {#upload-media}

`upload_media` · `POST /v1/workspaces/{workspaceId}/media`

الصلاحية المطلوبة: `media:write`. هدف التفويض: `workspace`.

أرسل صورة بترميز base64 لا تتجاوز 3 MiB بعد فك الترميز. تعيد معرّف الوسائط لاستخدامه في imageIds. يدعم REST أيضًا الرفع متعدد الأجزاء عبر /v1/media/upload.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "fileName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "mimeType": {
      "type": "string",
      "enum": [
        "image/jpeg",
        "image/png",
        "image/webp",
        "image/gif",
        "image/avif"
      ]
    },
    "base64": {
      "type": "string",
      "minLength": 4,
      "maxLength": 4194304
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "fileName",
    "mimeType",
    "base64",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الصورة: استبدال {#replace-media}

`replace_media` · `PUT /v1/workspaces/{workspaceId}/media/{id}`

الصلاحية المطلوبة: `media:write`. هدف التفويض: `workspace`.

يُحتفظ بمعرّف الوسائط الحالي.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "fileName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "mimeType": {
      "type": "string",
      "enum": [
        "image/jpeg",
        "image/png",
        "image/webp",
        "image/gif",
        "image/avif"
      ]
    },
    "base64": {
      "type": "string",
      "minLength": 4,
      "maxLength": 4194304
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "fileName",
    "mimeType",
    "base64",
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## ملفات الوسائط: حذف نهائي {#delete-media}

`delete_media` · `DELETE /v1/workspaces/{workspaceId}/media/{id}`

الصلاحية المطلوبة: `media:write`. هدف التفويض: `workspace`.

تحذف ملف الوسائط المرفوع وجميع المراجع إليه.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مساحة العمل: قراءة {#get-workspace}

`get_workspace` · `GET /v1/workspaces/{workspaceId}/workspace`

الصلاحية المطلوبة: `workspace:read`. هدف التفويض: `workspace`.

تعيد ملف مساحة العمل المحددة وبيانات الاتصال بالنشاط وتعليمات الوكلاء.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مساحة العمل: تحديث {#update-workspace}

`update_workspace` · `PUT /v1/workspaces/{workspaceId}/workspace`

الصلاحية المطلوبة: `workspace:write`. هدف التفويض: `workspace`.

الحقول: name وsubDomain وbillingEmail وbillingPhone وbillingGsmCountryCode وhostedSitePublished. يتطلب بريد الفوترة رمز تحقق موجودًا. تُطبّق قواعد التحقق من النطاق الفرعي وفترات الانتظار. لا تشمل الصلاحية تفويض الملكية أو المحفظة أو سياسة الوصول.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 2,
          "maxLength": 80
        },
        "subDomain": {
          "type": "string",
          "minLength": 3,
          "maxLength": 32,
          "pattern": "^(?!-)[a-z0-9-]+(?<!-)$"
        },
        "billingEmail": {
          "type": "string",
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "billingEmailOtpCode": {
          "type": "string",
          "pattern": "^\\d{6}$"
        },
        "billingPhone": {
          "type": "string",
          "maxLength": 40
        },
        "billingGsmCountryCode": {
          "type": "string"
        },
        "hostedSitePublished": {
          "type": "boolean"
        },
        "chatIdleTimeoutSeconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الموقع: قراءة {#get-website}

`get_website` · `GET /v1/workspaces/{workspaceId}/website/{templateKey}`

الصلاحية المطلوبة: `website:read`. هدف التفويض: `workspace`.

اقرأ المحتوى القابل للتعديل والسمة والملفات والترجمات وتخطيط القالب ومخطط JSON قبل التحديث.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "templateKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "templateKey",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الموقع: تحديث {#update-website}

`update_website` · `PUT /v1/workspaces/{workspaceId}/website/{templateKey}`

الصلاحية المطلوبة: `website:write`. هدف التفويض: `workspace`.

استخدم editable وeditorSchema من استجابة get_website. تُستثنى حقول meta/template المخصصة للقراءة فقط. تُدعم التحديثات الجزئية وتُطبّق قواعد التحقق من القالب.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "templateKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "data": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "templateKey",
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مصادر المعرفة: عرض القائمة {#list-knowledge-sources}

`list_knowledge_sources` · `GET /v1/workspaces/{workspaceId}/knowledge`

الصلاحية المطلوبة: `knowledge:read`. هدف التفويض: `workspace`.

تعيد ملخصات المصادر الخاصة وحالة نشرها، مع بحث اختياري في النص الكامل. حمّل المسودات الكاملة باستخدام get_knowledge_source.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "search": {
      "type": "string",
      "maxLength": 200
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مصدر المعرفة: قراءة {#get-knowledge-source}

`get_knowledge_source` · `GET /v1/workspaces/{workspaceId}/knowledge/{id}`

الصلاحية المطلوبة: `knowledge:read`. هدف التفويض: `workspace`.

تعيد مسودة خاصة كاملة للمراجعة. تتطلب المالك الحالي ونطاق صلاحية صريحًا لقراءة المعرفة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الملف العام للنشاط التجاري: قراءة {#get-business-profile}

`get_business_profile` · `GET /v1/workspaces/{workspaceId}/business/profile`

الصلاحية المطلوبة: `knowledge:read`. هدف التفويض: `workspace`.

تعيد المسودة المستقلة للملف العام وحالة نشرها. لا تتضمن هوية الحساب أو الفوترة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الملف العام للنشاط التجاري: حفظ المسودة {#save-business-profile}

`save_business_profile` · `PUT /v1/workspaces/{workspaceId}/business/profile`

الصلاحية المطلوبة: `knowledge:write`. هدف التفويض: `workspace`.

تحفظ مسودة خاصة دون نشرها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "profile": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 2,
          "maxLength": 120
        },
        "description": {
          "type": "string",
          "maxLength": 4000
        },
        "supportEmail": {
          "default": "",
          "anyOf": [
            {
              "type": "string",
              "maxLength": 254,
              "format": "email",
              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            },
            {
              "type": "string",
              "const": ""
            }
          ]
        },
        "supportPhone": {
          "default": "",
          "type": "string",
          "maxLength": 50,
          "pattern": "^[+()\\d .-]*$"
        },
        "links": {
          "default": [],
          "maxItems": 8,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "url": {
                "type": "string",
                "maxLength": 1000,
                "format": "uri"
              }
            },
            "required": [
              "label",
              "url"
            ],
            "additionalProperties": false
          }
        },
        "locations": {
          "default": [],
          "maxItems": 10,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "maxLength": 100
              },
              "address": {
                "type": "string",
                "maxLength": 600
              },
              "hours": {
                "type": "string",
                "maxLength": 1000
              }
            },
            "required": [
              "name",
              "address",
              "hours"
            ],
            "additionalProperties": false
          }
        },
        "facts": {
          "default": [],
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "value": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              }
            },
            "required": [
              "label",
              "value"
            ],
            "additionalProperties": false
          }
        },
        "language": {
          "type": "string",
          "enum": [
            "en",
            "tr",
            "de",
            "es",
            "fr"
          ]
        }
      },
      "required": [
        "name",
        "description",
        "supportEmail",
        "supportPhone",
        "links",
        "locations",
        "facts",
        "language"
      ],
      "additionalProperties": false
    },
    "revision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "profile",
    "revision",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مصدر المعرفة: إنشاء {#create-knowledge-source}

`create_knowledge_source` · `POST /v1/workspaces/{workspaceId}/knowledge`

الصلاحية المطلوبة: `knowledge:write`. هدف التفويض: `workspace`.

تنشئ مسودة مقال أو أسئلة شائعة دون نشرها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "ARTICLE",
            "FAQ"
          ]
        },
        "title": {
          "type": "string",
          "minLength": 2,
          "maxLength": 160
        },
        "language": {
          "type": "string",
          "enum": [
            "en",
            "tr",
            "de",
            "es",
            "fr"
          ]
        },
        "question": {
          "default": "",
          "type": "string",
          "maxLength": 400
        },
        "body": {
          "type": "string",
          "minLength": 1
        },
        "keywords": {
          "default": [],
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "shareOriginal": {
          "default": false,
          "type": "boolean"
        }
      },
      "required": [
        "kind",
        "title",
        "language",
        "question",
        "body",
        "keywords",
        "shareOriginal"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مصدر المعرفة: تحديث {#update-knowledge-source}

`update_knowledge_source` · `PUT /v1/workspaces/{workspaceId}/knowledge/{id}`

الصلاحية المطلوبة: `knowledge:write`. هدف التفويض: `workspace`.

تستخدم المراجعة الحالية للمسودة. يبقى النص المنشور دون تغيير.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "data": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "ARTICLE",
            "FAQ"
          ]
        },
        "title": {
          "type": "string",
          "minLength": 2,
          "maxLength": 160
        },
        "language": {
          "type": "string",
          "enum": [
            "en",
            "tr",
            "de",
            "es",
            "fr"
          ]
        },
        "question": {
          "default": "",
          "type": "string",
          "maxLength": 400
        },
        "body": {
          "type": "string",
          "minLength": 1
        },
        "keywords": {
          "default": [],
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "shareOriginal": {
          "default": false,
          "type": "boolean"
        },
        "revision": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "kind",
        "title",
        "language",
        "question",
        "body",
        "keywords",
        "shareOriginal",
        "revision"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مصدر المعرفة: نشر صريح {#publish-knowledge-source}

`publish_knowledge_source` · `POST /v1/workspaces/{workspaceId}/knowledge/{id}/publish`

الصلاحية المطلوبة: `knowledge:publish`. هدف التفويض: `workspace`.

تتطلب إجراءً صريحًا على المصدر الذي تمت مراجعته وفق مراجعته الحالية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "revision": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "revision",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الملف العام للنشاط التجاري: نشر صريح {#publish-business-profile}

`publish_business_profile` · `POST /v1/workspaces/{workspaceId}/business/profile/publish`

الصلاحية المطلوبة: `knowledge:publish`. هدف التفويض: `workspace`.

تغيّر حالة النشر من خلال عملية صريحة فقط.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "revision": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "revision",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مصدر المعرفة: إلغاء النشر صراحة {#unpublish-knowledge-source}

`unpublish_knowledge_source` · `POST /v1/workspaces/{workspaceId}/knowledge/{id}/unpublish`

الصلاحية المطلوبة: `knowledge:publish`. هدف التفويض: `workspace`.

تتطلب إجراءً صريحًا على المصدر الذي تمت مراجعته وفق مراجعته الحالية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "revision": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "revision",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الملف العام للنشاط التجاري: إلغاء النشر صراحة {#unpublish-business-profile}

`unpublish_business_profile` · `POST /v1/workspaces/{workspaceId}/business/profile/unpublish`

الصلاحية المطلوبة: `knowledge:publish`. هدف التفويض: `workspace`.

تغيّر حالة النشر من خلال عملية صريحة فقط.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "revision": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "revision",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## مصدر المعرفة: حذف نهائي {#delete-knowledge-source}

`delete_knowledge_source` · `DELETE /v1/workspaces/{workspaceId}/knowledge/{id}`

الصلاحية المطلوبة: `knowledge:publish`. هدف التفويض: `workspace`.

تلغي النشر وتحذف المصدر نهائيًا. تُتتبّع الملفات الأصلية لتنظيفها بصورة خاصة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "revision": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "revision",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الحساب: قراءة {#get-account}

`get_account` · `GET /v1/account`

الصلاحية المطلوبة: `account:read`. هدف التفويض: `account`.

تعيد ملف حسابك والحد المسموح لإنشاء مساحات العمل.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## الحساب: تحديث {#update-account}

`update_account` · `PUT /v1/account`

الصلاحية المطلوبة: `account:write`. هدف التفويض: `account`.

اقرأ الملف أولًا. يتطلب تغيير البريد رمز تحقق تحصل عليه من لوحة التحكم. لا يمكن تغيير الأدوار أو حالة التحقق أو حدود مساحات العمل.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "email": {
          "type": "string",
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "emailOtpCode": {
          "type": "string",
          "pattern": "^\\d{6}$"
        },
        "phone": {
          "type": "string",
          "maxLength": 40
        },
        "language": {
          "default": "",
          "type": "string",
          "maxLength": 24
        }
      },
      "required": [
        "name",
        "email",
        "phone",
        "language"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}
```

## مساحات العمل: عرض القائمة {#list-workspaces}

`list_workspaces` · `GET /v1/workspaces`

الصلاحية المطلوبة: `workspaces:read`. هدف التفويض: `account`.

تعيد مساحات العمل النشطة التي تملكها وحد الإنشاء. استخدم أحد معرّفات المساحات المعادة في الأدوات اللاحقة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {
        "page": 1,
        "pageSize": 25
      },
      "type": "object",
      "properties": {
        "page": {
          "default": 1,
          "type": "integer",
          "minimum": 1,
          "maximum": 1000000
        },
        "pageSize": {
          "default": 25,
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      },
      "required": [
        "page",
        "pageSize"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "query"
  ],
  "additionalProperties": false
}
```

## مساحة العمل: إنشاء {#create-workspace}

`create_workspace` · `POST /v1/workspaces`

الصلاحية المطلوبة: `workspaces:write`. هدف التفويض: `account`.

تنشئ مساحة عمل برصيد صفر ضمن حد الملكية الذي يحدده المسؤول. اختر HOSTED بقالب من list_templates، أو ASSISTANT_ONLY مع templateKey=null إن كان مفعّلًا. حدّد قدرات Commerce/Knowledge صراحة. تتطلب المواقع المخصصة رقم هاتف وتُرسل إشعارًا إلى الفريق.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 2,
          "maxLength": 80
        },
        "subDomain": {
          "type": "string",
          "minLength": 3,
          "maxLength": 32,
          "pattern": "^(?!-)[a-z0-9-]+(?<!-)$"
        },
        "templateKey": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "support-v1",
                "support-v2",
                "support-v3",
                "support-v4",
                "ecommerce-v2",
                "ecommerce-v3",
                "ecommerce-v4",
                "cosmetics-v2",
                "beauty-v1",
                "beauty-v3",
                "beauty-v4",
                "yossco-v1",
                "textile-v1",
                "customized"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "experienceMode": {
          "default": "HOSTED",
          "type": "string",
          "enum": [
            "HOSTED",
            "ASSISTANT_ONLY"
          ]
        },
        "commerceEnabled": {
          "type": "boolean"
        },
        "knowledgeEnabled": {
          "type": "boolean"
        },
        "businessCategories": {
          "maxItems": 94,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ACCOUNTING",
              "ADVERTISING",
              "AGRICULTURE",
              "AI",
              "AIRLINES",
              "ANIMAL_CARE",
              "ANTIQUES",
              "ARCHITECTURE",
              "ARTS",
              "AUTOMOTIVE",
              "BAKERY",
              "BANKING",
              "BEAUTY",
              "BIOTECHNOLOGY",
              "BOOKS",
              "BUSINESS_SERVICES",
              "CAFE",
              "CHARITY",
              "CHEMICALS",
              "CHILDCARE",
              "CLEANING",
              "CLOTHING",
              "COMPUTERS",
              "CONSTRUCTION",
              "CONSULTING",
              "COSMETICS",
              "CRAFT_TRADE",
              "DENTAL",
              "DISTRIBUTION",
              "ECOMMERCE",
              "EDUCATION",
              "ELECTRONICS",
              "ENERGY",
              "ENGINEERING",
              "ENTERTAINMENT",
              "ENVIRONMENT",
              "EVENTS",
              "FISHING",
              "FITNESS",
              "FLORIST",
              "FOOD",
              "FORESTRY",
              "FURNITURE",
              "GAMING",
              "GIFTS",
              "GOVERNMENT",
              "GROCERY",
              "HAIR",
              "HARDWARE",
              "HEALTHCARE",
              "HOSPITALITY",
              "HOUSEHOLD",
              "IMPORT_EXPORT",
              "INSURANCE",
              "INTERIOR_DESIGN",
              "JEWELRY",
              "LEGAL",
              "LOGISTICS",
              "MANUFACTURING",
              "MARINE",
              "MEDIA",
              "MINING",
              "MUSEUMS",
              "MUSIC",
              "OFFICE",
              "OPTICS",
              "PACKAGING",
              "PARKING",
              "PERSONAL_SERVICES",
              "PET_RETAIL",
              "PHARMACY",
              "PHOTOGRAPHY",
              "PROPERTY",
              "PUBLISHING",
              "RECRUITMENT",
              "RELIGION",
              "RENTAL",
              "RESEARCH",
              "RESTAURANTS",
              "RETAIL",
              "SECURITY",
              "SHOES_BAGS",
              "SOFTWARE",
              "SPORTS",
              "STORAGE",
              "TELECOM",
              "TEXTILES",
              "TOBACCO",
              "TOYS",
              "TRANSPORT",
              "TRAVEL",
              "UNIVERSITIES",
              "WELLNESS",
              "OTHER"
            ]
          }
        },
        "phone": {
          "type": "string",
          "maxLength": 40
        },
        "hostedSitePublished": {
          "default": false,
          "type": "boolean"
        }
      },
      "required": [
        "name",
        "experienceMode",
        "businessCategories",
        "hostedSitePublished"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}
```

## ملاحظات العملاء: عرض القائمة {#list-feedbacks}

`list_feedbacks` · `GET /v1/workspaces/{workspaceId}/feedbacks`

الصلاحية المطلوبة: `workspace:read`. هدف التفويض: `workspace`.

تدعم تقسيم النتائج إلى صفحات والبحث والتصفية حسب الزائر والتاريخ.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {
        "page": 1,
        "pageSize": 25,
        "search": "",
        "visitor": "ALL",
        "sortDirection": "desc"
      },
      "type": "object",
      "properties": {
        "page": {
          "default": 1,
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "pageSize": {
          "default": 25,
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "search": {
          "default": "",
          "type": "string",
          "maxLength": 200
        },
        "workspaceId": {
          "type": "string",
          "maxLength": 160
        },
        "userId": {
          "type": "string",
          "maxLength": 160
        },
        "visitor": {
          "default": "ALL",
          "type": "string",
          "enum": [
            "ALL",
            "GUEST",
            "USER"
          ]
        },
        "from": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "to": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "sortDirection": {
          "default": "desc",
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ]
        }
      },
      "required": [
        "page",
        "pageSize",
        "search",
        "visitor",
        "sortDirection"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## إعدادات الذكاء الاصطناعي: قراءة {#get-ai-settings}

`get_ai_settings` · `GET /v1/workspaces/{workspaceId}/ai-settings`

الصلاحية المطلوبة: `workspace:read`. هدف التفويض: `workspace`.

تعيد مستوى الرد الذي اختاره المالك وسياسة إجابات Knowledge ومراجعة الإعدادات وأسعار الائتمانات.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## إعدادات الذكاء الاصطناعي: تحديث {#update-ai-settings}

`update_ai_settings` · `PUT /v1/workspaces/{workspaceId}/ai-settings`

الصلاحية المطلوبة: `workspace:write`. هدف التفويض: `workspace`.

يختار المالك وحده مستوى الرد وسياسة Knowledge باستخدام المراجعة الحالية للإعدادات. لا يمكن للعملاء تجاوزهما.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "level": {
          "type": "string",
          "enum": [
            "SMART",
            "SMARTER",
            "SMARTEST"
          ]
        },
        "answerPolicy": {
          "type": "string",
          "enum": [
            "SOURCE_BASED_REASONING",
            "SOURCE_ONLY"
          ]
        },
        "revision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "chatIdleTimeoutSeconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "sector": {
          "type": "string",
          "enum": [
            "AUTO",
            "GENERAL",
            "BEAUTY",
            "TEXTILE"
          ]
        }
      },
      "required": [
        "level",
        "revision"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## أسئلة المنتجات القابلة لإعادة الاستخدام: عرض القائمة {#list-product-questions}

`list_product_questions` · `GET /v1/workspaces/{workspaceId}/questions`

الصلاحية المطلوبة: `products:read`. هدف التفويض: `workspace`.

ينتمي السؤال إلى مساحة العمل هذه ويمكن إعادة استخدامه عبر المنتجات.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## سؤال المنتج القابل لإعادة الاستخدام: إنشاء {#create-product-question}

`create_product_question` · `POST /v1/workspaces/{workspaceId}/questions`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

ينتمي السؤال إلى مساحة العمل هذه ويمكن إعادة استخدامه عبر المنتجات.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240
        }
      },
      "required": [
        "text"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## سؤال المنتج القابل لإعادة الاستخدام: تحديث {#update-product-question}

`update_product_question` · `PUT /v1/workspaces/{workspaceId}/questions/{id}`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

تغيّر السؤال القابل لإعادة الاستخدام في جميع المنتجات المعيّن لها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "data": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240
        }
      },
      "required": [
        "text"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## سؤال المنتج القابل لإعادة الاستخدام: حذف نهائي {#delete-product-question}

`delete_product_question` · `DELETE /v1/workspaces/{workspaceId}/questions/{id}`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

تحذف السؤال القابل لإعادة الاستخدام وجميع تعييناته.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الأسئلة المختارة للمنتج: قراءة {#get-product-questions}

`get_product_questions` · `GET /v1/workspaces/{workspaceId}/products/{id}/questions`

الصلاحية المطلوبة: `products:read`. هدف التفويض: `workspace`.

تعيد قائمة مرتّبة أو قائمة فارغة مقصودة أو الأسئلة الافتراضية الثلاثة للقالب.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الأسئلة المختارة للمنتج: تعيين {#assign-product-questions}

`assign_product_questions` · `PUT /v1/workspaces/{workspaceId}/products/{id}/questions`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

عيّن من صفر إلى خمسة معرّفات لأسئلة مساحة العمل بترتيب خاص بالمنتج. تخفي القائمة الفارغة الأسئلة الأولية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "data": {
      "type": "object",
      "properties": {
        "questionIds": {
          "minItems": 0,
          "maxItems": 5,
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        }
      },
      "required": [
        "questionIds"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## الأسئلة المختارة للمنتج: استعادة القيم الافتراضية {#reset-product-questions}

`reset_product_questions` · `DELETE /v1/workspaces/{workspaceId}/products/{id}/questions`

الصلاحية المطلوبة: `products:write`. هدف التفويض: `workspace`.

تستعيد الأسئلة الافتراضية الثلاثة من قالب المنتج.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "id",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## تقرير الاستخدام: قراءة {#list-usage-report}

`list_usage_report` · `GET /v1/workspaces/{workspaceId}/usage-report`

الصلاحية المطلوبة: `workspace:read`. هدف التفويض: `workspace`.

تعيد الاستخدام حسب المستخدم وائتمانات الذكاء الاصطناعي والنماذج والنشاط على صفحات، مع التصفية حسب التاريخ والبحث والفاعل.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {
        "surface": "ALL",
        "page": 1,
        "pageSize": 25,
        "search": "",
        "actorType": "ALL",
        "sortBy": "credits",
        "sortDirection": "desc"
      },
      "type": "object",
      "properties": {
        "surface": {
          "default": "ALL",
          "type": "string",
          "enum": [
            "ALL",
            "HOSTED"
          ]
        },
        "page": {
          "default": 1,
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "pageSize": {
          "default": 25,
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "search": {
          "default": "",
          "type": "string",
          "maxLength": 200
        },
        "actorType": {
          "default": "ALL",
          "type": "string",
          "enum": [
            "ALL",
            "AUTH_USER",
            "WORKSPACE_USER",
            "WORKSPACE_KIOSK_DEVICE",
            "GUEST"
          ]
        },
        "from": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "to": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "userId": {
          "type": "string",
          "maxLength": 160
        },
        "sortBy": {
          "default": "credits",
          "type": "string",
          "enum": [
            "credits",
            "requests",
            "lastUsedAt",
            "name"
          ]
        },
        "sortDirection": {
          "default": "desc",
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ]
        }
      },
      "required": [
        "surface",
        "page",
        "pageSize",
        "search",
        "actorType",
        "sortBy",
        "sortDirection"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## أحداث النشاط: قراءة {#list-usage-events}

`list_usage_events` · `GET /v1/workspaces/{workspaceId}/usage-report/events`

الصلاحية المطلوبة: `workspace:read`. هدف التفويض: `workspace`.

تعيد الأحداث على صفحات مع التصفية حسب المستخدم والتاريخ والفاعل. تُستثنى البيانات الوصفية الداخلية للجلسة والشبكة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "default": {
        "surface": "ALL",
        "page": 1,
        "pageSize": 25,
        "search": "",
        "actorType": "ALL",
        "sortBy": "credits",
        "sortDirection": "desc"
      },
      "type": "object",
      "properties": {
        "surface": {
          "default": "ALL",
          "type": "string",
          "enum": [
            "ALL",
            "HOSTED"
          ]
        },
        "page": {
          "default": 1,
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "pageSize": {
          "default": 25,
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "search": {
          "default": "",
          "type": "string",
          "maxLength": 200
        },
        "actorType": {
          "default": "ALL",
          "type": "string",
          "enum": [
            "ALL",
            "AUTH_USER",
            "WORKSPACE_USER",
            "WORKSPACE_KIOSK_DEVICE",
            "GUEST"
          ]
        },
        "from": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "to": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "userId": {
          "type": "string",
          "maxLength": 160
        },
        "sortBy": {
          "default": "credits",
          "type": "string",
          "enum": [
            "credits",
            "requests",
            "lastUsedAt",
            "name"
          ]
        },
        "sortDirection": {
          "default": "desc",
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ]
        }
      },
      "required": [
        "surface",
        "page",
        "pageSize",
        "search",
        "actorType",
        "sortBy",
        "sortDirection"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## تخطيطات روبوت المحادثة: عرض القائمة {#list-chatbot-templates}

`list_chatbot_templates` · `GET /v1/workspaces/{workspaceId}/chatbot-templates`

الصلاحية المطلوبة: `website:read`. هدف التفويض: `workspace`.

تعيد التخطيطات المدعومة ذات الإصدارات وبيانات العرض الوصفية الخاصة بها.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## تخطيط روبوت المحادثة: تحديث {#update-chatbot-template}

`update_chatbot_template` · `PUT /v1/workspaces/{workspaceId}/chatbot-template`

الصلاحية المطلوبة: `website:write`. هدف التفويض: `workspace`.

تغيّر التخطيط فقط، مع الحفاظ على الهوية البصرية والأصول المسموح بها والتوافر والروابط الاجتماعية والمحادثات.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "templateKey": {
          "type": "string",
          "enum": [
            "support-v1",
            "support-v2",
            "support-v3",
            "support-v4",
            "ecommerce-v1",
            "ecommerce-v2",
            "ecommerce-v3",
            "ecommerce-v4",
            "cosmetics-v1",
            "cosmetics-v2",
            "cosmetics-v3",
            "cosmetics-v4"
          ]
        }
      },
      "required": [
        "templateKey"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## إعدادات روبوت المحادثة: قراءة {#get-chatbot-settings}

`get_chatbot_settings` · `GET /v1/workspaces/{workspaceId}/chatbot-settings`

الصلاحية المطلوبة: `website:read`. هدف التفويض: `workspace`.

تعيد إعدادات روبوت المحادثة لمساحة العمل المحددة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## إعدادات روبوت المحادثة: تحديث {#update-chatbot-settings}

`update_chatbot_settings` · `PUT /v1/workspaces/{workspaceId}/chatbot-settings`

الصلاحية المطلوبة: `website:write`. هدف التفويض: `workspace`.

تضبط روبوت المحادثة الذي يُفعّل اختياريًا وأصول مواقع HTTPS المسموح بها بدقة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "templateKey": {
          "type": "string",
          "enum": [
            "support-v1",
            "support-v2",
            "support-v3",
            "support-v4",
            "ecommerce-v1",
            "ecommerce-v2",
            "ecommerce-v3",
            "ecommerce-v4",
            "cosmetics-v1",
            "cosmetics-v2",
            "cosmetics-v3",
            "cosmetics-v4"
          ]
        },
        "enabled": {
          "default": true,
          "type": "boolean"
        },
        "templateSettings": {
          "default": {},
          "type": "object",
          "propertyNames": {
            "type": "string",
            "enum": [
              "support-v1",
              "support-v2",
              "support-v3",
              "support-v4",
              "ecommerce-v1",
              "ecommerce-v2",
              "ecommerce-v3",
              "ecommerce-v4",
              "cosmetics-v1",
              "cosmetics-v2",
              "cosmetics-v3",
              "cosmetics-v4"
            ]
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "compactIntro": {
                "type": "boolean"
              },
              "showArticles": {
                "type": "boolean"
              },
              "showContact": {
                "type": "boolean"
              },
              "showProductSearch": {
                "type": "boolean"
              },
              "showRoutine": {
                "type": "boolean"
              },
              "showManualProfile": {
                "type": "boolean"
              },
              "showPhoto": {
                "type": "boolean"
              },
              "density": {
                "type": "string",
                "enum": [
                  "comfortable",
                  "compact"
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "launcherIcon": {
          "default": "sparkles",
          "type": "string",
          "enum": [
            "sparkles",
            "message-circle",
            "bot",
            "headset",
            "help-circle",
            "shopping-bag",
            "heart",
            "flower",
            "stars",
            "smile"
          ]
        },
        "launcherDisplay": {
          "default": "icon-text",
          "type": "string",
          "enum": [
            "icon",
            "text",
            "icon-text"
          ]
        },
        "launcherSize": {
          "default": "medium",
          "type": "string",
          "enum": [
            "small",
            "medium",
            "large"
          ]
        },
        "launcherHighlight": {
          "default": "orbit",
          "type": "string",
          "enum": [
            "none",
            "orbit",
            "halo",
            "pulse",
            "ripple",
            "aurora",
            "gradient",
            "sparkle",
            "beacon",
            "float",
            "outline"
          ]
        },
        "draggable": {
          "default": true,
          "type": "boolean"
        },
        "captureMode": {
          "default": "manual",
          "type": "string",
          "enum": [
            "manual",
            "automatic"
          ]
        },
        "authenticationMode": {
          "type": "string",
          "enum": [
            "DISABLED",
            "OPTIONAL",
            "REQUIRED"
          ]
        },
        "allowedOrigins": {
          "default": [],
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 300
          }
        },
        "position": {
          "default": "bottom-right",
          "type": "string",
          "enum": [
            "bottom-right",
            "bottom-left"
          ]
        },
        "color": {
          "default": "#635bff",
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "textColor": {
          "default": "#ffffff",
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "title": {
          "default": "Help & Support",
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "launcherText": {
          "default": "Ask AI",
          "type": "string",
          "minLength": 1,
          "maxLength": 40
        },
        "welcomeText": {
          "default": "Ask AI a question or choose an available support option.",
          "type": "string",
          "minLength": 1,
          "maxLength": 600
        },
        "placeholder": {
          "default": "Ask a support question…",
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "defaultLanguage": {
          "default": "en",
          "type": "string",
          "enum": [
            "en",
            "tr",
            "de",
            "es",
            "fr"
          ]
        },
        "messages": {
          "default": {},
          "type": "object",
          "propertyNames": {
            "type": "string",
            "enum": [
              "en",
              "tr",
              "de",
              "es",
              "fr"
            ]
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "launcherText": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "welcomeText": {
                "type": "string",
                "minLength": 1,
                "maxLength": 600
              },
              "placeholder": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "title",
              "launcherText",
              "welcomeText",
              "placeholder"
            ],
            "additionalProperties": false
          }
        },
        "productBrowsingEnabled": {
          "default": true,
          "type": "boolean"
        },
        "photoAnalysisEnabled": {
          "default": true,
          "type": "boolean"
        },
        "contactEmailNotifications": {
          "default": false,
          "type": "boolean"
        },
        "contactForms": {
          "default": [],
          "maxItems": 3,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "fields": {
                "minItems": 1,
                "maxItems": 12,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_-]{0,39}$"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "TEXT",
                        "TEXTAREA",
                        "EMAIL",
                        "PHONE",
                        "SELECT",
                        "RADIO",
                        "CHECKBOX",
                        "BOOLEAN"
                      ]
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "options": {
                      "default": [],
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      }
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "type",
                    "required",
                    "options"
                  ],
                  "additionalProperties": false
                }
              },
              "translations": {
                "default": {},
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "enum": [
                    "en",
                    "tr",
                    "de",
                    "es",
                    "fr"
                  ]
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "fields": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_-]{0,39}$"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "options": {
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80
                                }
                              },
                              "required": [
                                "value",
                                "label"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "title",
              "fields",
              "translations"
            ],
            "additionalProperties": false
          }
        },
        "activeContactFormId": {
          "default": "default",
          "anyOf": [
            {
              "type": "string",
              "const": "default"
            },
            {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          ]
        },
        "starterQuestions": {
          "default": [],
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "translations": {
                "default": {},
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "enum": [
                    "en",
                    "tr",
                    "de",
                    "es",
                    "fr"
                  ]
                },
                "additionalProperties": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                }
              }
            },
            "required": [
              "id",
              "text",
              "translations"
            ],
            "additionalProperties": false
          }
        },
        "selectedStarterIds": {
          "default": [
            "about",
            "services",
            "contact",
            "getting-started"
          ],
          "maxItems": 8,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          }
        },
        "socialLinks": {
          "default": [],
          "maxItems": 7,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string",
                "enum": [
                  "instagram",
                  "facebook",
                  "youtube",
                  "tiktok",
                  "linkedin",
                  "x",
                  "website"
                ]
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri"
              },
              "visible": {
                "default": true,
                "type": "boolean"
              }
            },
            "required": [
              "platform",
              "url",
              "visible"
            ],
            "additionalProperties": false
          }
        },
        "offset": {
          "default": 20,
          "type": "integer",
          "minimum": 8,
          "maximum": 100
        }
      },
      "required": [
        "enabled",
        "templateSettings",
        "launcherIcon",
        "launcherDisplay",
        "launcherSize",
        "launcherHighlight",
        "draggable",
        "captureMode",
        "allowedOrigins",
        "position",
        "color",
        "textColor",
        "title",
        "launcherText",
        "welcomeText",
        "placeholder",
        "defaultLanguage",
        "messages",
        "productBrowsingEnabled",
        "photoAnalysisEnabled",
        "contactEmailNotifications",
        "contactForms",
        "activeContactFormId",
        "starterQuestions",
        "selectedStarterIds",
        "socialLinks",
        "offset"
      ],
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "data",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## تحليلات روبوت المحادثة: قراءة {#get-chatbot-analytics}

`get_chatbot_analytics` · `GET /v1/workspaces/{workspaceId}/chatbot-analytics`

الصلاحية المطلوبة: `workspace:read`. هدف التفويض: `workspace`.

تعيد بيانات مجمّعة للزوار والرسائل واستخدام الروتين والمنتجات. لا تعيد معرّفات الزوار أو نصوص الرسائل أبدًا.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "to": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "origin": {
          "type": "string",
          "maxLength": 300
        }
      },
      "additionalProperties": false
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    }
  },
  "required": [
    "query",
    "workspaceId"
  ],
  "additionalProperties": false
}
```

## نقاط نهاية تجربة العميل {#customer-experience-endpoints}

راجع [دليل تجربة العميل](/ar/%D9%88%D8%A7%D8%AC%D9%87%D8%A9-%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9-%D8%A7%D9%84%D8%B9%D9%85%D9%8A%D9%84/) لبيانات اعتماد الزائر وأمثلة حمولات الطلبات.

## وصول الزائر: تهيئة {#storefront-bootstrap}

`storefront_bootstrap` · `GET /v1/workspaces/{workspaceId}/experience/bootstrap`

الصلاحية المطلوبة: `storefront:read`.

تهيّئ وصول الزائر ورمز الضيف وإعدادات Turnstile.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## المنتجات المنشورة: عرض القائمة {#storefront-products}

`storefront_products` · `GET /v1/workspaces/{workspaceId}/experience/products`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## المنتج المنشور: قراءة {#storefront-products-productid}

`storefront_products_productId` · `GET /v1/workspaces/{workspaceId}/experience/products/{productId}`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## أسئلة المنتج المنشورة: عرض القائمة {#storefront-products-productid-questions}

`storefront_products_productId_questions` · `GET /v1/workspaces/{workspaceId}/experience/products/{productId}/questions`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## المنتج المنشور: قراءة {#storefront-products-slug-productslug}

`storefront_products_slug_productSlug` · `GET /v1/workspaces/{workspaceId}/experience/products/slug/{productSlug}`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## المجموعات المنشورة: عرض القائمة {#storefront-collections}

`storefront_collections` · `GET /v1/workspaces/{workspaceId}/experience/collections`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## منتجات المجموعة: عرض القائمة {#storefront-collections-collectionid-products}

`storefront_collections_collectionId_products` · `GET /v1/workspaces/{workspaceId}/experience/collections/{collectionId}/products`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## الوسوم المنشورة: عرض القائمة {#storefront-tags}

`storefront_tags` · `GET /v1/workspaces/{workspaceId}/experience/tags`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## المنتجات المنشورة: عرض القائمة {#storefront-tags-tagid-products}

`storefront_tags_tagId_products` · `GET /v1/workspaces/{workspaceId}/experience/tags/{tagId}/products`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## المجموعات المنشورة: عرض القائمة {#storefront-tags-tagid-collections}

`storefront_tags_tagId_collections` · `GET /v1/workspaces/{workspaceId}/experience/tags/{tagId}/collections`

الصلاحية المطلوبة: `storefront:read`.

تعيد فقط بيانات الكتالوج المنشورة التي تسمح بها سياسة وصول الزائر.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## رمز البريد الإلكتروني للزائر: طلب {#customer-otp-request}

`customer_otp_request` · `POST /v1/workspaces/{workspaceId}/experience/customer/otp/request`

الصلاحية المطلوبة: `visitors:write`.

تطلب رمزًا بالبريد الإلكتروني. تُطبّق Turnstile والتحقق من البريد وحدود إعادة الإرسال.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "email": {
      "type": "string",
      "format": "email",
      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
    },
    "phone": {
      "type": [
        "string",
        "null"
      ]
    },
    "turnstileToken": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
    }
  },
  "required": [
    "name",
    "email"
  ],
  "additionalProperties": false
}
```

## رمز البريد الإلكتروني للزائر: تحقق {#customer-otp-verify}

`customer_otp_verify` · `POST /v1/workspaces/{workspaceId}/experience/customer/otp/verify`

الصلاحية المطلوبة: `visitors:write`.

تتحقق من رمز أحادي الاستخدام وتعيد جلسة زائر محصورة بالجهة المستأجرة، ولا تمنح جلسة إدارة مطلقًا.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "format": "email",
      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
    },
    "code": {
      "type": "string",
      "pattern": "^\\d{6}$"
    }
  },
  "required": [
    "email",
    "code"
  ],
  "additionalProperties": false
}
```

## جلسة الزائر: قراءة {#customer-session}

`customer_session` · `GET /v1/workspaces/{workspaceId}/experience/customer/session`

الصلاحية المطلوبة: `visitors:read`.

أرسل X-Visitor-Token لجلسة زائر الجهة المستأجرة الحالية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## جلسة الزائر: تجديد {#customer-refresh}

`customer_refresh` · `POST /v1/workspaces/{workspaceId}/experience/customer/refresh`

الصلاحية المطلوبة: `visitors:write`.

أرسل X-Visitor-Token لجلسة زائر الجهة المستأجرة الحالية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## جلسة الزائر: إبطال {#customer-logout}

`customer_logout` · `POST /v1/workspaces/{workspaceId}/experience/customer/logout`

الصلاحية المطلوبة: `visitors:write`.

أرسل X-Visitor-Token لجلسة زائر الجهة المستأجرة الحالية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## ملف الزائر: قراءة {#customer-profile}

`customer_profile` · `GET /v1/workspaces/{workspaceId}/experience/customer/profile`

الصلاحية المطلوبة: `visitors:read`.

تعيد الحقول العامة لملف الزائر فقط. أرسل X-Visitor-Token.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## ملف الزائر: تحديث {#customer-profile-update}

`customer_profile_update` · `PUT /v1/workspaces/{workspaceId}/experience/customer/profile`

الصلاحية المطلوبة: `visitors:write`.

تحدّث اسم الزائر ورقم هاتفه ولغته. لا يمكن تغيير البريد هنا؛ يتطلب تغيير بريد الحساب تسجيل الدخول إلى الحساب.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "email": {
      "type": "string",
      "format": "email",
      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
    },
    "phone": {
      "type": "string"
    },
    "language": {
      "type": "string",
      "maxLength": 24
    }
  },
  "required": [
    "name",
    "email"
  ],
  "additionalProperties": false
}
```

## مساعد الأعمال: تشغيل {#storefront-ai-general}

`storefront_ai_general` · `POST /v1/workspaces/{workspaceId}/experience/chat/general`

الصلاحية المطلوبة: `ai:write`.

تستخدم الأدلة المنشورة الحالية والاستشهادات مع حماية الزائر واحتساب صريح للائتمانات؛ للقراءة فقط. في المتابعة أعد threadId الموقّع وcontextToken المعتم كما وردا تمامًا. لا ترسل سجلًا أنشأه المستدعي. يتطلب السياق المنتهي أو المحدود بدء محادثة جديدة صراحة.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "contextToken": {
      "type": "string",
      "maxLength": 32000
    },
    "threadId": {
      "type": "string",
      "maxLength": 100
    },
    "turnstileToken": {
      "type": "string",
      "maxLength": 4096
    }
  },
  "required": [
    "message"
  ],
  "additionalProperties": false
}
```

## الإرشاد للمنتجات بالذكاء الاصطناعي: تشغيل {#storefront-ai-product}

`storefront_ai_product` · `POST /v1/workspaces/{workspaceId}/experience/chat/product`

الصلاحية المطلوبة: `ai:write`.

تتطلب وصول الزائر وTurnstile والحصص، مع حجز ذري لائتمانات مساحة العمل. تستهلك ائتمانات فعلية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "message": {
      "default": "",
      "type": "string",
      "maxLength": 2000
    },
    "threadId": {
      "type": "string",
      "maxLength": 150
    },
    "thinkingLevel": {
      "type": "string",
      "enum": [
        "LOW",
        "MEDIUM",
        "HIGH"
      ]
    },
    "images": {
      "default": [],
      "maxItems": 2,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 4194368
      }
    },
    "turnstileToken": {
      "type": "string",
      "maxLength": 4096
    },
    "productId": {
      "default": "",
      "type": "string",
      "maxLength": 128
    },
    "productName": {
      "default": "",
      "type": "string",
      "maxLength": 200
    },
    "userProfile": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "maxLength": 60
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 4000
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 4000
            }
          }
        ]
      }
    },
    "userSelectedRoutineProducts": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "productName": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "id",
          "productName"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "message",
    "images",
    "productId",
    "productName"
  ],
  "additionalProperties": false
}
```

## الإرشاد للروتين بالذكاء الاصطناعي: تشغيل {#storefront-ai-routine}

`storefront_ai_routine` · `POST /v1/workspaces/{workspaceId}/experience/chat/routine`

الصلاحية المطلوبة: `ai:write`.

تتطلب وصول الزائر وTurnstile والحصص، مع حجز ذري لائتمانات مساحة العمل. تستهلك ائتمانات فعلية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "message": {
      "default": "",
      "type": "string",
      "maxLength": 2000
    },
    "threadId": {
      "type": "string",
      "maxLength": 150
    },
    "thinkingLevel": {
      "type": "string",
      "enum": [
        "LOW",
        "MEDIUM",
        "HIGH"
      ]
    },
    "images": {
      "default": [],
      "maxItems": 2,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 4194368
      }
    },
    "turnstileToken": {
      "type": "string",
      "maxLength": 4096
    },
    "userProfile": {
      "default": {},
      "type": "object",
      "propertyNames": {
        "type": "string",
        "maxLength": 60
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 4000
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 4000
            }
          }
        ]
      }
    },
    "userSelectedRoutineProducts": {
      "default": [],
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "productName": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "id",
          "productName"
        ],
        "additionalProperties": false
      }
    },
    "allowAiSuggestions": {
      "default": true,
      "type": "boolean"
    }
  },
  "required": [
    "message",
    "images",
    "userProfile",
    "userSelectedRoutineProducts",
    "allowAiSuggestions"
  ],
  "additionalProperties": false
}
```

## تحليل الصور بالذكاء الاصطناعي: تشغيل {#storefront-ai-analyze-face}

`storefront_ai_analyze_face` · `POST /v1/workspaces/{workspaceId}/experience/chat/analyze-face`

الصلاحية المطلوبة: `ai:write`.

تتطلب وصول الزائر وTurnstile والحصص، مع حجز ذري لائتمانات مساحة العمل. تستهلك ائتمانات فعلية.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "image": {
      "type": "string",
      "maxLength": 4194368
    },
    "turnstileToken": {
      "type": "string",
      "maxLength": 4096
    }
  },
  "required": [
    "image"
  ],
  "additionalProperties": false
}
```

## محادثة الزائر: حذف نهائي {#storefront-thread-delete}

`storefront_thread_delete` · `DELETE /v1/workspaces/{workspaceId}/experience/threads/{threadId}`

الصلاحية المطلوبة: `visitors:write`.

تحذف فقط محادثة موقّعة لمساحة العمل والزائر المحددين.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## ملاحظات الزائر: إرسال {#storefront-feedback}

`storefront_feedback` · `POST /v1/workspaces/{workspaceId}/experience/feedback`

الصلاحية المطلوبة: `visitors:write`.

تستخدم العقد المتحقق منه نفسه المستخدم في الموقع المستضاف.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    }
  },
  "required": [
    "message"
  ],
  "additionalProperties": false
}
```

## حدث نشاط الزائر: تسجيل {#storefront-event}

`storefront_event` · `POST /v1/workspaces/{workspaceId}/experience/events`

الصلاحية المطلوبة: `visitors:write`.

تسجّل الأحداث المسموح بها فقط، مع التحقق من الخادم ونسبها إلى الفاعل.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventName": {
      "type": "string",
      "enum": [
        "WEBSITE_VISIT",
        "PRODUCT_VIEW",
        "CONTACT_CLICK",
        "BUY_CLICK",
        "PHONE_CLICK",
        "DIRECTION_CLICK",
        "CUSTOMER_SIGNUP"
      ]
    },
    "productId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "source": {
      "type": "string",
      "maxLength": 64
    },
    "metadata": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "eventName"
  ],
  "additionalProperties": false
}
```
