Create a template
Create a workspace template, blank or from a document.
curl https://api.muzekit.com/v1/templates \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Product card", "external_id": "product-card", "tags": ["shop"] }'const res = await fetch("https://api.muzekit.com/v1/templates", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Product card",
external_id: "product-card",
tags: ["shop"],
}),
});
const template = await res.json();import os
import requests
template = requests.post(
"https://api.muzekit.com/v1/templates",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={"name": "Product card", "external_id": "product-card", "tags": ["shop"]},
).json()Body
namestringrequiredUp to 200 characters.
descriptionstringUp to 2,000 characters.
tagsstring[]Up to 30 tags.
external_idstringThe template's key: the same in every environment, accepted wherever a tpl_ id is. Made from the name when you leave it out. Lowercase letters, numbers, dots, dashes and underscores.
documentobjectA document (see Templates). Without one, a blank 1080 × 1080 page.
Returns the template with 201. A document that breaks a rule returns 400 invalid_document with every problem in problems. A key another template in this environment already has returns 409 external_id_taken.
Examples
Create from a saved document
Send a document you keep in your own code, or one you read from another template with Get a document. Give it a key so your code can name it the same way in Test and Live.
# product-card.json holds the document: { "pages": [ … ] }
jq '{ name: "Product card", external_id: "product-card", document: . }' \
product-card.json \
| curl https://api.muzekit.com/v1/templates \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d @-import { readFile } from "node:fs/promises";
const document = JSON.parse(await readFile("product-card.json", "utf8"));
const res = await fetch("https://api.muzekit.com/v1/templates", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Product card",
external_id: "product-card",
document,
}),
});
const template = await res.json();import json
import os
import requests
with open("product-card.json") as f:
document = json.load(f)
template = requests.post(
"https://api.muzekit.com/v1/templates",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"name": "Product card",
"external_id": "product-card",
"document": document,
},
).json()Create a blank template at another size
For a size other than 1080 × 1080, send a document with one empty page of that size. Your team or your users then design it in the editor.
curl https://api.muzekit.com/v1/templates \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Story",
"external_id": "story",
"document": {
"pages": [
{ "id": "page-1", "canvas": { "width": 1080, "height": 1920 }, "elements": [] }
]
}
}'const res = await fetch("https://api.muzekit.com/v1/templates", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Story",
external_id: "story",
document: {
pages: [
{ id: "page-1", canvas: { width: 1080, height: 1920 }, elements: [] },
],
},
}),
});
const template = await res.json();import os
import requests
template = requests.post(
"https://api.muzekit.com/v1/templates",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"name": "Story",
"external_id": "story",
"document": {
"pages": [
{"id": "page-1", "canvas": {"width": 1080, "height": 1920}, "elements": []}
]
},
},
).json()Retry without making two templates
Send an Idempotency-Key. If the network drops and you send the same request again within 24 hours, you get the first response back instead of a second template.
curl https://api.muzekit.com/v1/templates \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: create-product-card-1" \
-d '{ "name": "Product card", "external_id": "product-card" }'const res = await fetch("https://api.muzekit.com/v1/templates", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "create-product-card-1",
},
body: JSON.stringify({ name: "Product card", external_id: "product-card" }),
});
const template = await res.json();import os
import requests
template = requests.post(
"https://api.muzekit.com/v1/templates",
headers={
"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}",
"Idempotency-Key": "create-product-card-1",
},
json={"name": "Product card", "external_id": "product-card"},
).json()Response
A new template has no thumbnail_url until the editor saves it.
{
"object": "template",
"id": "tpl_Vk1t4l9xvQv",
"name": "Product card",
"description": null,
"tags": ["shop"],
"external_id": "product-card",
"user": null,
"source": "api",
"version": { "id": "ver_…", "number": 1, "revision": 1 },
"width": 1080,
"height": 1080,
"page_count": 1,
"thumbnail_url": null,
"created_at": "2026-10-17T02:10:00.000Z",
"updated_at": "2026-10-17T02:10:00.000Z"
}