Render a template
PNG, JPG, WEBP, AVIF, PDF or video of a template, with your values filled in.
curl https://api.muzekit.com/v1/renders \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "template": "tpl_Vk1t4l9xvQv", "format": "png", "modifications": { "headline": "Summer sale" } }'const res = await fetch("https://api.muzekit.com/v1/renders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
template: "tpl_Vk1t4l9xvQv",
format: "png",
modifications: { headline: "Summer sale" },
}),
});
const render = await res.json();import os
import requests
# json= sends the body with Content-Type: application/json
render = requests.post(
"https://api.muzekit.com/v1/renders",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"template": "tpl_Vk1t4l9xvQv",
"format": "png",
"modifications": {"headline": "Summer sale"},
},
).json()| Field | |
|---|---|
template | The template's tpl_… id or its key; its current document is rendered |
format | png (default), jpg, webp, avif, pdf, or video: mp4, webm, gif, mov, mkv |
pages | Page numbers, e.g. [1, 3]; every page when left out. An image or video render makes one file per page, a PDF one file |
scale | 1 (default) to 4: 2 makes a 1080 px page 2160 px |
quality | 1 to 100 for jpg, webp and avif |
modifications | Values for the template's parameters. A single-page template takes bare keys ("headline"). A multi-page template needs the page on every key, page 1 included ("page1@headline", "page2@headline"): a bare key there changes nothing. Sub-properties follow a dot ("headline.color"); without a page they apply on every page that has the parameter |
pdf | PDF only: margin (or marginTop …) as pixels or a length (24, "24px", "10mm", "1cm", "0.5in", "12pt"), title, colorMode (rgb or cmyk), imageFormat, imageQuality, maxImageDpi |
video | Video only, see Video |
lang | Language tag for the document ("ar" sets right-to-left text) |
size | Render at another size: a preset ("instagram-story", "youtube-thumbnail", …), "WIDTHxHEIGHT" or { "width": 1080, "height": 1920 }. See Sizes |
extraSizes | Extra copies at other sizes, up to 10: ["1080x1920", "1200x628"], or named, { "story": "1080x1920" } |
Renders use the same engine as the editor's downloads, so the files match what your users see. An image or PDF render answers 201 once its files are stored. If it takes more than a minute, or renders more than 20 pages (each extra size counts its pages again), it answers 202 with status: "queued" instead, like a video; get the render until it is succeeded. Each file stays for your plan's days (expires_at); copy it if you need it longer. Test and Live render the same way. Live renders use your plan's API credits; Test renders are free, carry a TEST watermark and are kept 7 days (livemode is false).
Keys that match no parameter don't stop the render; they come back in warnings.
A page with flow layers (text or tables that continue on new pages) renders as many files as its content needs: its outputs carry part 1, 2, and so on.
Sizes
One design renders at any size: the layout is solved again for the new shape, and a size your team set up with Smart resize in the editor uses that saved layout. size replaces the template's own size; extraSizes adds copies beside it. Each copy is an output with a size (its name, or WIDTHxHEIGHT) and counts like any other file. See Render several sizes at once.
Presets: instagram-post, instagram-post-portrait, instagram-post-landscape, instagram-story, facebook-post, facebook-story, facebook-cover, twitter-post, twitter-header, linkedin-post, linkedin-banner, youtube-thumbnail, youtube-short, tiktok-video, pinterest-pin, whatsapp-status, og-image, blog-header, email-header, website-banner, presentation-16-9, a4-document, us-letter, business-card, zoom-background, leaderboard-ad, medium-rectangle-ad.
A size can also differ by page: { "page1": "1080x1920", "page2": "1080x1350" } as one entry of extraSizes.
AI values
A text or image parameter can be written by AI at render: send a prompt as "<parameter>.prompt". A text layer gets the words, an image layer a new picture. Add "<parameter>.promptMode": "update" to have the prompt edit the layer's value instead of replacing it, and "<parameter>.promptReferences" (image URLs) to guide a picture.
{
"modifications": {
"headline.prompt": "A five-word summer sale headline",
"hero.prompt": "A beach at golden hour, wide"
}
}Each prompt uses AI credits: 1 for text, 2 for an image. A render checks that its credits are there before it starts (402 ai_credits_exhausted if not). A prompt that fails leaves the layer as the template has it and adds a line to warnings. AI video clips and flowing-text layers don't take prompts yet; they warn.
Video
Videos are queued: the answer is 202 with status: "queued", and the files are ready when the render's status is succeeded (get the render, or listen for render.succeeded). Send Prefer: wait to wait up to a minute for the finished render in the answer instead, or Prefer: wait=30 to wait at most 30 seconds and then get the render as it stands. A page's length comes from its videos, animations and audio, or from video.duration.
video field | |
|---|---|
duration | Seconds, when the page has nothing that sets its length |
fps | Frames per second, up to 30 (GIF: 15) |
quality | 1 to 100 |
muted | true renders without sound |
trimStart, trimEnd | Seconds to keep from the page's video |
audioSource | An audio URL for every page, or [{ "page": 1, "track": 0, "url": "…" }] to replace one page's track |
subtitleSource | Audio (or a .srt / .vtt file) to caption. Audio is transcribed; no credits |
subtitleSegments | Captions: [{ "start": 0, "end": 2.5, "text": "…" }] |
captionPreset | A caption style by name; subtitleColor, subtitleFontSize and the other subtitle… options set one by one |
combinePages | Join the pages into one video (not GIF) |
pageTransition, pageTransitionDuration | The transition between joined pages (fade, dissolve, wipeleft, …) and its length, 0.1 to 2 s |
Every Live render spends API credits: an image 1 a page, a PDF 1, a video 1 a second of its length, rounded up (video_seconds). A video can be as long as your plan allows (limits.video_length, in seconds), with up to limits.audio_tracks audio tracks a page.
Examples
Personalize an image for one person
Fill text and image parameters with one person's values. An image parameter takes a public URL; a dot key changes one property of a layer, here the headline's color.
curl https://api.muzekit.com/v1/renders \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "product-card",
"format": "jpg",
"quality": 90,
"modifications": {
"headline": "Happy birthday, Maya",
"photo": "https://example.com/photos/maya.jpg",
"headline.color": "#0B5FFF"
}
}'const res = await fetch("https://api.muzekit.com/v1/renders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
template: "product-card",
format: "jpg",
quality: 90,
modifications: {
headline: "Happy birthday, Maya",
photo: "https://example.com/photos/maya.jpg",
"headline.color": "#0B5FFF",
},
}),
});
const render = await res.json();
const imageUrl = render.outputs[0].url;import os
import requests
render = requests.post(
"https://api.muzekit.com/v1/renders",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"template": "product-card",
"format": "jpg",
"quality": 90,
"modifications": {
"headline": "Happy birthday, Maya",
"photo": "https://example.com/photos/maya.jpg",
"headline.color": "#0B5FFF",
},
},
).json()
image_url = render["outputs"][0]["url"]Check warnings in the answer: a misspelled key is listed there and the layer keeps the template's value.
Render a user's design after they save
When a user saves in the editor, a template.updated webhook names their template (a design's first save sends template.created). Render it from your webhook handler, and send the event's id as Idempotency-Key so a retried delivery doesn't render twice.
# data.template and the event id come from the webhook
curl https://api.muzekit.com/v1/renders \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Idempotency-Key: evt_8gK2mQ1xZpRt" \
-H "Content-Type: application/json" \
-d '{ "template": "tpl_G2l2bmhk8Pq", "format": "png" }'// Call with the parsed event, after you check its signature
async function onMuzekitEvent(event) {
if (!["template.created", "template.updated"].includes(event.type)) return;
if (!event.data.user) return; // a workspace template, not a user's design
const res = await fetch("https://api.muzekit.com/v1/renders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Idempotency-Key": event.id,
"Content-Type": "application/json",
},
body: JSON.stringify({ template: event.data.template, format: "png" }),
});
const render = await res.json();
// Store render.outputs[0].url for event.data.external_user_id
}import os
import requests
# Call with the parsed event, after you check its signature
def on_muzekit_event(event):
if event["type"] not in ("template.created", "template.updated"):
return
if not event["data"].get("user"):
return # a workspace template, not a user's design
render = requests.post(
"https://api.muzekit.com/v1/renders",
headers={
"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}",
"Idempotency-Key": event["id"],
},
json={"template": event["data"]["template"], "format": "png"},
).json()
# Store render["outputs"][0]["url"] for event["data"]["external_user_id"]Answer the webhook quickly (within five seconds); if your renders take longer, queue them and render after you reply. Without any code, render on save does the same and sends the files in render.succeeded.
Render several sizes at once
One request makes the template's own size plus named copies. Sizes can be presets or WIDTHxHEIGHT.
curl https://api.muzekit.com/v1/renders \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "summer-sale",
"format": "png",
"modifications": { "headline": "Summer sale" },
"extraSizes": { "story": "instagram-story", "og": "1200x628" }
}'const res = await fetch("https://api.muzekit.com/v1/renders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
template: "summer-sale",
format: "png",
modifications: { headline: "Summer sale" },
extraSizes: { story: "instagram-story", og: "1200x628" },
}),
});
const render = await res.json();
const story = render.outputs.find((o) => o.size === "story");import os
import requests
render = requests.post(
"https://api.muzekit.com/v1/renders",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"template": "summer-sale",
"format": "png",
"modifications": {"headline": "Summer sale"},
"extraSizes": {"story": "instagram-story", "og": "1200x628"},
},
).json()
story = next(o for o in render["outputs"] if o.get("size") == "story")The template's own size has no size; each copy carries its name:
"outputs": [
{
"page": 1,
"part": null,
"url": "https://storage.muzekit.com/r/…/1.png",
"content_type": "image/png"
},
{
"page": 1,
"part": null,
"size": "story",
"url": "https://storage.muzekit.com/r/…/1.story.png",
"content_type": "image/png"
},
{
"page": 1,
"part": null,
"size": "og",
"url": "https://storage.muzekit.com/r/…/1.og.png",
"content_type": "image/png"
}
]Send extraSizes as a list (["instagram-story", "1200x628"]) and each copy's size is its WIDTHxHEIGHT. To get only the other size, send size instead.
Make a PDF
A PDF render puts the pages you choose into one file, so it has one output with page: null.
curl https://api.muzekit.com/v1/renders \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "certificate",
"format": "pdf",
"modifications": { "name": "Maya Patel", "course": "Data basics" },
"pdf": { "title": "Certificate for Maya Patel", "margin": "10mm" }
}'const res = await fetch("https://api.muzekit.com/v1/renders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
template: "certificate",
format: "pdf",
modifications: { name: "Maya Patel", course: "Data basics" },
pdf: { title: "Certificate for Maya Patel", margin: "10mm" },
}),
});
const pdfUrl = (await res.json()).outputs[0].url;import os
import requests
render = requests.post(
"https://api.muzekit.com/v1/renders",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"template": "certificate",
"format": "pdf",
"modifications": {"name": "Maya Patel", "course": "Data basics"},
"pdf": {"title": "Certificate for Maya Patel", "margin": "10mm"},
},
).json()
pdf_url = render["outputs"][0]["url"]Add "pages": [1, 3] for some pages only, and "colorMode": "cmyk" in pdf for print.
Render a video and wait for it
A video answers 202 with status: "queued" and the render's id. Get the render every few seconds until it is succeeded or failed, or listen for the render.succeeded webhook with the same id. For short videos, Prefer: wait returns the finished render instead.
curl https://api.muzekit.com/v1/renders \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "promo-video",
"format": "mp4",
"modifications": { "headline": "New in store" },
"video": { "duration": 8 }
}'
# Then, with the id from the answer, until status is succeeded or failed
curl https://api.muzekit.com/v1/renders/rnd_vQ8VEOnjY5H \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY"const API = "https://api.muzekit.com/v1";
const auth = { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` };
const res = await fetch(`${API}/renders`, {
method: "POST",
headers: { ...auth, "Content-Type": "application/json" },
body: JSON.stringify({
template: "promo-video",
format: "mp4",
modifications: { headline: "New in store" },
video: { duration: 8 },
}),
});
let render = await res.json(); // 202, status "queued"
while (render.status === "queued" || render.status === "processing") {
await new Promise((resolve) => setTimeout(resolve, 5000));
render = await (await fetch(`${API}/renders/${render.id}`, { headers: auth })).json();
}
if (render.status === "failed") throw new Error(render.error.message);
const videoUrl = render.outputs[0].url;import os
import time
import requests
API = "https://api.muzekit.com/v1"
auth = {"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"}
render = requests.post(
f"{API}/renders",
headers=auth,
json={
"template": "promo-video",
"format": "mp4",
"modifications": {"headline": "New in store"},
"video": {"duration": 8},
},
).json() # 202, status "queued"
while render["status"] in ("queued", "processing"):
time.sleep(5)
render = requests.get(f"{API}/renders/{render['id']}", headers=auth).json()
if render["status"] == "failed":
raise RuntimeError(render["error"]["message"])
video_url = render["outputs"][0]["url"]video.duration sets the length only when nothing on the page does (a video layer, animations or audio). A Live video spends 1 API credit a second.
Response
{
"object": "render",
"id": "rnd_vQ8VEOnjY5H",
"status": "succeeded",
"template": "tpl_Vk1t4l9xvQv",
"revision": 4,
"trigger": "api",
"livemode": true,
"format": "png",
"pages": [ 1, 2 ],
"outputs": [
{
"page": 1,
"part": null,
"url": "https://storage.muzekit.com/r/d90/…/1.png",
"content_type": "image/png",
"size": null,
"width": 1080,
"height": 1080
},
{
"page": 2,
"part": null,
"url": "https://storage.muzekit.com/r/d90/…/2.png",
"content_type": "image/png",
"size": null,
"width": 1080,
"height": 1080
}
],
"warnings": [],
"error": null,
"duration_ms": 2410,
"created_at": "2026-10-17T10:52:43.248Z",
"completed_at": "2026-10-17T10:52:45.658Z",
"expires_at": "2027-01-15T10:52:45.658Z"
}Each output has the size it was rendered at (null for the template's own size) and its width and height in pixels. Every file URL has a random part, so a URL can't be guessed from another.
A field the API doesn't know answers 400 invalid_request with Unknown field '<name>', so a typo never renders the template as it is. A render takes no user: to render an end user's design, send that design's tpl_… id as template.
| Error | When |
|---|---|
400 invalid_page | A page number the template doesn't have |
400 invalid_option | video options with an image or PDF format |
400 invalid_size | A size that isn't a preset or WIDTHxHEIGHT, a side outside 16 to 8,000 px, or more than 10 extra sizes |
402 api_credits_exhausted | This period's Live API credits are used |
402 ai_credits_exhausted | The .prompt values need more AI credits than are left |
402 plan_required | The editor has no plan, or its plan is paused or unpaid |
404 template_not_found | No template with this id or key in this environment |
422 video_limit | A video longer than your plan allows, or a page with too many audio tracks |
422 render_failed | The engine couldn't render the page; message says why |
429 rate_limited | More than 60 renders a minute with this key |
429 test_renders_exhausted | A Test environment reached its daily cap of free renders; render with your Live key |
503 render_unavailable | Renders can't be queued for a moment; try again shortly. Nothing is charged |
A render that answered 202 and fails later turns failed, with one of these codes in error, and sends render.failed.