api.brand

create()

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

创建品牌。只有名称是必填项;其余内容都可以之后逐个模块补充。

POST /api/brandfreecolors from the logo
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

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_name400没有名称,或名称为空。
invalid_field400identity 或 platform 中的未知字段,或类型错误的值。
unsupported_logo400字节不是 SVG、PNG、JPEG 或 WebP 图片。
unsafe_svg400SVG 含有脚本、事件处理器、内嵌 HTML 或外部链接。
too_many_logos400超过 12 个标志。
logo_too_large413标志超过 5 MB。
invalid_color400颜色不是十六进制值,或角色未知。
too_many_brands403账户已有 50 个品牌。