Get the brand kit
The colors, fonts and images every user of the editor gets.
curl https://api.muzekit.com/v1/brand \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY"const res = await fetch("https://api.muzekit.com/v1/brand", {
headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});
const brand = await res.json();import os
import requests
brand = requests.get(
"https://api.muzekit.com/v1/brand",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()Add images and fonts with Upload an asset and "brand": true. Add a color with Add a brand color; remove any item with Remove a brand item.
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.
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
doneconst 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 }),
});
}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},
)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 needs.
curl -s https://api.muzekit.com/v1/brand \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
| jq -r '.images[] | select(.name == "logo.png") | .id'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 weightimport 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 weightResponse
Each item has every asset field; this example shows the ones that matter for its kind.
{
"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
}
]
}