Remove a brand item
Removes a color, font or image from the editor's brand kit. A file templates still use needs force=true.
curl -X DELETE https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY"const res = await fetch("https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH", {
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});
const deleted = await res.json();import os
import requests
deleted = requests.delete(
"https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()The id is an item's from Get the brand kit. A font or image that templates still use is refused with 409 asset_in_use, saying how many templates and naming the first few; add force=true to remove it anyway (those templates lose the file). An id that isn't in the brand kit answers 404 asset_not_found.
Examples
Remove a color
Colors have no file, so removing one never answers 409.
curl -X DELETE https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY"await fetch("https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH", {
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});import os
import requests
requests.delete(
"https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
)Remove a logo that templates use
Try without force first. On 409 asset_in_use, the error carries templates (how many) and names; send force=true only once you accept that those templates lose the file.
# 1. Refused with 409 asset_in_use if templates use the file
curl -X DELETE https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY"
# 2. Remove it anyway
curl -X DELETE "https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH?force=true" \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY"const url = "https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH";
const headers = { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` };
let res = await fetch(url, { method: "DELETE", headers });
if (res.status === 409) {
const { error } = await res.json();
console.log(`Used in ${error.templates}: ${error.names.join(", ")}`);
// Continue only if that's acceptable
res = await fetch(`${url}?force=true`, { method: "DELETE", headers });
}import os
import requests
url = "https://api.muzekit.com/v1/brand/ast_dQC3Z8RgqAH"
headers = {"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"}
res = requests.delete(url, headers=headers)
if res.status_code == 409:
error = res.json()["error"]
print(f"Used in {error['templates']}: {', '.join(error['names'])}")
# Continue only if that's acceptable
res = requests.delete(url, params={"force": "true"}, headers=headers)Remove every weight of a font
Each weight is its own item. Find them by family in Get the brand kit and remove each one.
for ID in $(curl -s https://api.muzekit.com/v1/brand \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
| jq -r '.fonts[] | select(.family == "Acme") | .id'); do
curl -s -X DELETE "https://api.muzekit.com/v1/brand/$ID" \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY"
doneconst headers = { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` };
const brand = await (
await fetch("https://api.muzekit.com/v1/brand", { headers })
).json();
for (const font of brand.fonts.filter((f) => f.family === "Acme")) {
const res = await fetch(`https://api.muzekit.com/v1/brand/${font.id}`, {
method: "DELETE",
headers,
});
if (res.status === 409) console.log(`${font.name} is still in use`);
}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()
for font in [f for f in brand["fonts"] if f["family"] == "Acme"]:
res = requests.delete(
f"https://api.muzekit.com/v1/brand/{font['id']}", headers=headers
)
if res.status_code == 409:
print(f"{font['name']} is still in use")Response
{
"object": "asset",
"id": "ast_dQC3Z8RgqAH",
"deleted": true
}