# create()

Canonical URL: https://developers.iagenify.com/ar/sdk/ref/brand/create/
Language: ar

`api.brand.create({ name, description?, logos?, palette?, identity?, platform?, assets? }) → Promise<Brand>`

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

Status: POST /api/brand · free · colors from the logo

```javascript
const brand = await api.brand.create({
  name: "Qahwa Lab",
  description: "Specialty coffee roasted in Tunis",
  logos: [
    { name: "logo.svg", content: svgText, main: true },   // SVG text, bytes, a Blob or base64
    { path: "./icon.png", role: "icon" },                // Node.js only
  ],
  palette: ["#6B3E26", "#D9A441"],                        // optional
  identity: { tagline: "Roasted every morning" },
  assets: [{ cloud: "Brand/storefront.jpg", role: "hero" }],
});
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `name` | string | required | اسم العلامة التجارية. |
| `description` | string |  | جملة واحدة، 500 حرف على الأكثر. أما الوصف المطوّل فمكانه `identity.longDescription`. |
| `logos` | array |  | `{ name, content }` أو `{ path }`، مع `role` اختياري (primary، secondary، icon، monogram، other) و`main`. 12 على الأكثر، بحجم 5 ميغابايت لكل منها؛ SVG أو PNG أو JPEG أو WebP، يُتعرَّف عليها من البايتات لا من الاسم. |
| `palette` | array | object |  | قائمة ألوان (`"#6B3E26"` أو `{ hex, role, name }`)، أو `{ colors, typography }`. وبدونها تُستخرج الألوان من الشعار الرئيسي. |
| `identity` | object |  | الشعار النصي، والوصف المطوّل، والقطاع، واللغات، وسنة التأسيس، والنطاق، وحسابات التواصل. |
| `platform` | object |  | المهمة، والرؤية، والقيم، والتموضع، والوعد، والجماهير، والنموذج الأصلي، ونبرة الصوت، والرسائل. |
| `assets` | array |  | صور أو مقاطع فيديو أو رسوم توضيحية — انظر [assets](/ar/sdk/ref/brand-object/assets). |

## المورد المرفوض لا يلغي العلامة التجارية {#assets}

تُنشأ العلامة التجارية أولًا، ثم مواردها. ويُدرج المورد الذي يفشل في `brand.assetErrors` — مع فهرسه ورمزه ورسالته — وتُحفظ الموارد الأخرى.

## الأخطاء {#errors}

| الرمز | الحالة | متى |
| --- | --- | --- |
| invalid_name | 400 | لا يوجد اسم، أو الاسم فارغ. |
| invalid_field | 400 | حقل غير معروف في identity أو platform، أو قيمة من نوع خاطئ. |
| unsupported_logo | 400 | البايتات ليست صورة SVG أو PNG أو JPEG أو WebP. |
| unsafe_svg | 400 | ملف SVG يحمل نصًا برمجيًا أو معالج أحداث أو HTML مضمّنًا أو رابطًا خارجيًا. |
| too_many_logos | 400 | أكثر من 12 شعارًا. |
| logo_too_large | 413 | شعار يتجاوز 5 ميغابايت. |
| invalid_color | 400 | لون ليس قيمة سداسية عشرية، أو دور غير معروف. |
| too_many_brands | 403 | يملك الحساب بالفعل 50 علامة تجارية. |

- [Brand](/ar/sdk/ref/brand-object): ما تحمله العلامة التجارية، وكيف تعدّلها.
- [logos](/ar/sdk/ref/brand-object/logos): إضافة شعار، واختيار الشعار الرئيسي.
- [palette](/ar/sdk/ref/brand-object/palette): الألوان والأدوار والخطوط.

```python
brand = api.brand.create(
    name="Qahwa Lab",
    description="Specialty coffee roasted in Tunis",
    logos=[
        {"name": "logo.svg", "content": svg_text, "main": True},   # SVG text, bytes or base64
        {"path": "icon.png", "role": "icon"},
    ],
    palette=["#6B3E26", "#D9A441"],                              # optional
    identity={"tagline": "Roasted every morning"},
    assets=[{"cloud": "Brand/storefront.jpg", "role": "hero"}],
)
brand.asset_errors   # None, or [{"index", "code", "message"}]
```
