# Get the brand kit

> The colors, fonts and images every user of the editor gets.

<Endpoint method="GET" path="/v1/brand" />

<CodeTabs>

```bash tab="cURL"
curl https://api.muzekit.com/v1/brand \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY"
```

```javascript tab="Node"
const res = await fetch("https://api.muzekit.com/v1/brand", {
  headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});
const brand = await res.json();
```

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

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

</CodeTabs>

Add images and fonts with [Upload an asset](/docs/api-reference/assets-upload) and `"brand": true`. Add a color with [Add a brand color](/docs/api-reference/brand-colors-add); remove any item with [Remove a brand item](/docs/api-reference/brand-delete).

The brand kit is the editor's, so Test and Live keys see the same one. Items come oldest first.

## Examples

### Add only the colors that are missing

Adding the same color twice gives two entries. When you sync colors from your own settings, read the kit first and add only new values. Values are stored in upper case, so compare them that way.

<CodeTabs>

```bash tab="cURL"
HAVE=$(curl -s https://api.muzekit.com/v1/brand \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" | jq -r '.colors[].value')

for HEX in "#3B6EF5" "#E8553D"; do
  if ! grep -qx "$HEX" <<< "$HAVE"; then
    curl -s https://api.muzekit.com/v1/brand/colors \
      -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d "{ \"value\": \"$HEX\" }"
  fi
done
```

```javascript tab="Node"
const headers = {
  Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
  "Content-Type": "application/json",
};
const brand = await (
  await fetch("https://api.muzekit.com/v1/brand", { headers })
).json();
const have = new Set(brand.colors.map((c) => c.value));

for (const value of ["#3B6EF5", "#E8553D"]) {
  if (have.has(value.toUpperCase())) continue;
  await fetch("https://api.muzekit.com/v1/brand/colors", {
    method: "POST",
    headers,
    body: JSON.stringify({ value }),
  });
}
```

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

headers = {"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"}
brand = requests.get("https://api.muzekit.com/v1/brand", headers=headers).json()
have = {c["value"] for c in brand["colors"]}

for value in ["#3B6EF5", "#E8553D"]:
    if value.upper() not in have:
        requests.post(
            "https://api.muzekit.com/v1/brand/colors",
            headers=headers,
            json={"value": value},
        )
```

</CodeTabs>

### Find a brand item to remove

Look an item up by `name` (or `family` for fonts) to get the `id` that [Remove a brand item](/docs/api-reference/brand-delete) needs.

<CodeTabs>

```bash tab="cURL"
curl -s https://api.muzekit.com/v1/brand \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  | jq -r '.images[] | select(.name == "logo.png") | .id'
```

```javascript tab="Node"
const res = await fetch("https://api.muzekit.com/v1/brand", {
  headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});
const brand = await res.json();
const logo = brand.images.find((i) => i.name === "logo.png");
const acme = brand.fonts.filter((f) => f.family === "Acme"); // every weight
```

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

brand = requests.get(
    "https://api.muzekit.com/v1/brand",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()
logo = next(i for i in brand["images"] if i["name"] == "logo.png")
acme = [f for f in brand["fonts"] if f["family"] == "Acme"]  # every weight
```

</CodeTabs>

## Response

Each item has every [asset](/docs/api-reference/assets-list) field; this example shows the ones that matter for its kind.

```json
{
  "object": "brand",
  "colors": [
    {
      "object": "asset",
      "id": "ast_…",
      "kind": "color",
      "name": "Coral",
      "tags": ["primary"],
      "value": "#E8553D",
      "url": null
    }
  ],
  "fonts": [
    {
      "object": "asset",
      "id": "ast_…",
      "kind": "font",
      "name": "Acme-Bold.woff2",
      "family": "Acme",
      "url": "https://storage.muzekit.com/…"
    }
  ],
  "images": [
    {
      "object": "asset",
      "id": "ast_…",
      "kind": "image",
      "name": "logo.png",
      "url": "https://storage.muzekit.com/…",
      "width": 512,
      "height": 512
    }
  ]
}
```
