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" }],
});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"}]namestringrequired品牌名称。
descriptionstring一句话,最多 500 个字符。详细描述应放在 identity.longDescription 中。
logosarray{ name, content } 或 { path },可选 role(primary、secondary、icon、monogram、other)和 main。最多 12 个,每个 5 MB;支持 SVG、PNG、JPEG 或 WebP,根据字节识别,而非文件名。
palettearray | object颜色列表("#6B3E26" 或 { hex, role, name }),或 { colors, typography }。不提供时,颜色从主标志中提取。
identityobject标语、详细描述、行业、语言、创立年份、域名、社交账号。
platformobject使命、愿景、价值观、定位、承诺、受众、原型、语气、信息。
assetsarray照片、视频或插图——参见 assets。
被拒绝的资源不会取消品牌
先创建品牌,再添加其资源。失败的资源会列在 brand.assetErrors 中——包括索引、代码和消息——其余资源照常保留。
错误
| 代码 | 状态 | 触发条件 |
|---|---|---|
| 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 MB。 |
| invalid_color | 400 | 颜色不是十六进制值,或角色未知。 |
| too_many_brands | 403 | 账户已有 50 个品牌。 |