# Add a brand color

> Adds a color to the editor's brand kit, which every user of the editor gets.

<Endpoint method="POST" path="/v1/brand/colors" />

<CodeTabs>

```bash tab="cURL"
curl https://api.muzekit.com/v1/brand/colors \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "value": "#3B6EF5", "name": "Primary" }'
```

```javascript tab="Node"
const res = await fetch("https://api.muzekit.com/v1/brand/colors", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ value: "#3B6EF5", name: "Primary" }),
});
const color = await res.json();
```

```python tab="Python"
import os
import requests

color = requests.post(
    "https://api.muzekit.com/v1/brand/colors",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
    json={"value": "#3B6EF5", "name": "Primary"},
).json()
```

</CodeTabs>

## Body

<ParamTable params={[
  { name: "value", type: "string", required: true, description: "A six-digit hex color, like #3B6EF5. Stored in upper case." },
  { name: "name", type: "string", description: "A label shown in the editor, up to 60 characters." },
]} />

The brand kit is the editor's, so Test and Live keys add to the same one. A value that isn't a hex color is refused with `400 invalid_color`. Images and fonts go in with [Upload an asset](/docs/api-reference/assets-upload) and `"brand": true`; see the whole kit with [Get the brand kit](/docs/api-reference/brand-get).

## Examples

### Add your palette

One request adds one color, so loop over the palette. The same value sent twice gives two entries; see [Add only the colors that are missing](/docs/api-reference/brand-get#add-only-the-colors-that-are-missing).

<CodeTabs>

```bash tab="cURL"
for PAIR in "#3B6EF5:Primary" "#E8553D:Coral" "#111827:Ink"; do
  curl -s https://api.muzekit.com/v1/brand/colors \
    -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
    -H "Content-Type: application/json" \
    -d "{ \"value\": \"${PAIR%%:*}\", \"name\": \"${PAIR#*:}\" }"
done
```

```javascript tab="Node"
const palette = [
  { value: "#3B6EF5", name: "Primary" },
  { value: "#E8553D", name: "Coral" },
  { value: "#111827", name: "Ink" },
];

for (const color of palette) {
  await fetch("https://api.muzekit.com/v1/brand/colors", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(color),
  });
}
```

```python tab="Python"
import os
import requests

palette = [
    {"value": "#3B6EF5", "name": "Primary"},
    {"value": "#E8553D", "name": "Coral"},
    {"value": "#111827", "name": "Ink"},
]

for color in palette:
    requests.post(
        "https://api.muzekit.com/v1/brand/colors",
        headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
        json=color,
    )
```

</CodeTabs>

### Set up a brand kit for a new editor

A full kit is colors, a logo and a font. Colors go in here; the logo and the font are uploads with `"brand": true` (the font with its `family`). Every end user gets them in their next session.

<CodeTabs>

```bash tab="cURL"
AUTH="Authorization: Bearer $MUZEKIT_SECRET_KEY"
API=https://api.muzekit.com/v1

# Colors
curl -s $API/brand/colors -H "$AUTH" -H "Content-Type: application/json" \
  -d '{ "value": "#3B6EF5", "name": "Primary" }'

# Logo
URL=$(curl -s $API/assets/uploads -H "$AUTH" -H "Content-Type: application/json" \
  -d '{ "name": "logo.png", "type": "image/png", "brand": true }' \
  | jq -r .upload_url)
curl -X PUT "$URL" -H "Content-Type: image/png" --data-binary @logo.png

# Font
URL=$(curl -s $API/assets/uploads -H "$AUTH" -H "Content-Type: application/json" \
  -d '{
    "name": "Acme-Bold.woff2",
    "type": "font/woff2",
    "family": "Acme",
    "brand": true
  }' \
  | jq -r .upload_url)
curl -X PUT "$URL" -H "Content-Type: font/woff2" --data-binary @Acme-Bold.woff2
```

```javascript tab="Node"
import { readFile } from "node:fs/promises";

const API = "https://api.muzekit.com/v1";
const headers = {
  Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
  "Content-Type": "application/json",
};

async function uploadBrandFile(path, type, extra = {}) {
  const res = await fetch(`${API}/assets/uploads`, {
    method: "POST",
    headers,
    body: JSON.stringify({ name: path, type, brand: true, ...extra }),
  });
  const upload = await res.json();
  await fetch(upload.upload_url, {
    method: "PUT",
    headers: { "Content-Type": type },
    body: await readFile(path),
  });
}

await fetch(`${API}/brand/colors`, {
  method: "POST",
  headers,
  body: JSON.stringify({ value: "#3B6EF5", name: "Primary" }),
});
await uploadBrandFile("logo.png", "image/png");
await uploadBrandFile("Acme-Bold.woff2", "font/woff2", { family: "Acme" });
```

```python tab="Python"
import os
import requests

API = "https://api.muzekit.com/v1"
headers = {"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"}

def upload_brand_file(path, mime, **extra):
    upload = requests.post(
        f"{API}/assets/uploads",
        headers=headers,
        json={"name": path, "type": mime, "brand": True, **extra},
    ).json()
    with open(path, "rb") as f:
        requests.put(upload["upload_url"], headers={"Content-Type": mime}, data=f)

requests.post(
    f"{API}/brand/colors",
    headers=headers,
    json={"value": "#3B6EF5", "name": "Primary"},
)
upload_brand_file("logo.png", "image/png")
upload_brand_file("Acme-Bold.woff2", "font/woff2", family="Acme")
```

</CodeTabs>

## Response

```json
{
  "object": "asset",
  "id": "ast_dQC3Z8RgqAH",
  "kind": "color",
  "name": "Primary",
  "url": null,
  "value": "#3B6EF5",
  "type": null,
  "size": null,
  "width": null,
  "height": null,
  "family": null,
  "created_at": "2026-10-17T02:10:00.000Z"
}
```
