Create a session
Open the editor for one of your users. Returns a single-use client secret for your page.
Body
user.idstringrequiredYour own id for this user (a number is sent as its string). The Muzekit user is created on the first session and reused after.
user.namestringShown in the editor.
user.emailstringFor your records; Muzekit never emails end users.
user.localestringEditor language, e.g. en, de.
user.metadataobjectYour own data, up to 4 KB as JSON; more answers 400 invalid_request.
modedesign | fill | viewWhat the user can do. Default design. view needs a template. See Editor modes.
templatetpl_… | keyA template to open: its id or its key (external_id). One of your workspace templates or one of this user's own designs. An unknown one answers 404 template_not_found.
localestringOverrides the user locale for this session: en, de, es, fr, pt, ru or el (de-DE works too). Another language answers 400 invalid_request.
featuresobjectThis session's editor, over the dashboard's Features page: { "stock": false, "developer": true }. Keys as in Features (insert, insertText, insertImage, insertVideo, insertShapes, canvasResize, uploads, links, stock, downloads, share, developer, removeBackground, aiImages, agent…).
formatsstring[]Download formats for this session: png, jpg, webp, avif, pdf, html. Never metered.
videoFormatsstring[]Video download formats for this session, when video downloads are on: mp4, webm, gif, mov. Each uses API credits, 1 a second.
inspectorstring[]Design tab sections to hide for this session: align, position, appearance, typography, fill, media, video, waveform, border, shadow, effects, stacking, repeat, animate.
fontsall | brandbrand: only the brand kit's fonts and the design's own.
maxPagesnumberThe most pages a design can have in this session (1–500).
labelsobjectYour own words for this session, up to 20: { "muzekit.templates": "Designs" }.
buttonsobject[]Up to 3 top-bar buttons: { id, label, action: event | png | pdf, primary? }. Clicks reach your page as the SDK's action event.
templatePickerstring | objectThe templates picker for this session: "panel" or "page", or { layout: panel | page, open: blank | always | never, tab: auto | mine | templates }. See Editor modes.
Request
curl https://api.muzekit.com/v1/sessions \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "user": { "id": "user_42", "name": "Ada" }, "mode": "design" }'const res = await fetch("https://api.muzekit.com/v1/sessions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ user: { id: "user_42", name: "Ada" }, mode: "design" }),
});
const session = await res.json();import os
import requests
# json= sends the body with Content-Type: application/json
session = requests.post(
"https://api.muzekit.com/v1/sessions",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={"user": {"id": "user_42", "name": "Ada"}, "mode": "design"},
).json()Examples
Open a template in fill mode
Your user fills in the fields of a template your team made, and the layout stays locked. Pass the template's key or its tpl_… id. The first change saves the user's own copy, so your template never changes; the SDK's save event then carries the copy's id with created: true.
curl https://api.muzekit.com/v1/sessions \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"user": { "id": "user_42", "name": "Ada" },
"mode": "fill",
"template": "product-card"
}'const res = await fetch("https://api.muzekit.com/v1/sessions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
user: { id: "user_42", name: "Ada" },
mode: "fill",
template: "product-card",
}),
});
// Send only the client_secret to your page
const { client_secret } = await res.json();import os
import requests
session = requests.post(
"https://api.muzekit.com/v1/sessions",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"user": {"id": "user_42", "name": "Ada"},
"mode": "fill",
"template": "product-card",
},
).json()
client_secret = session["client_secret"]The response's template is what you sent, so a key stays a key:
{ "object": "session", "mode": "fill", "template": "product-card" }Reopen a design your user saved
Store the tpl_… id from the save event (or the template.created webhook) against your user. Open it in design mode later and saves update that design in place.
curl https://api.muzekit.com/v1/sessions \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"user": { "id": "user_42" },
"mode": "design",
"template": "tpl_Vk1t4l9xvQv"
}'const res = await fetch("https://api.muzekit.com/v1/sessions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
user: { id: "user_42" },
mode: "design",
template: savedTemplateId, // "tpl_Vk1t4l9xvQv"
}),
});
const session = await res.json();import os
import requests
session = requests.post(
"https://api.muzekit.com/v1/sessions",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"user": {"id": "user_42"},
"mode": "design",
"template": saved_template_id, # "tpl_Vk1t4l9xvQv"
},
).json()A design that belongs to another of your users won't open for this one.
Give each pricing tier its own editor
Pick the switches from your own plan for the user. Session choices override the dashboard's Features page for this session only. Switches that cost or store something (uploads, stock, share links, video downloads and AI) are checked on Muzekit's servers too, so a user can't get around them from the browser.
# A basic-tier user: no stock or AI, PNG and JPG only, one page
curl https://api.muzekit.com/v1/sessions \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"user": { "id": "user_42" },
"features": { "stock": false, "aiImages": false, "share": false },
"formats": ["png", "jpg"],
"maxPages": 1
}'const TIERS = {
basic: {
features: { stock: false, aiImages: false, share: false },
formats: ["png", "jpg"],
maxPages: 1,
},
pro: {
features: { aiImages: true, removeBackground: true, videoDownload: true },
videoFormats: ["mp4", "gif"],
},
};
const res = await fetch("https://api.muzekit.com/v1/sessions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ user: { id: user.id }, ...TIERS[user.tier] }),
});
const session = await res.json();import os
import requests
TIERS = {
"basic": {
"features": {"stock": False, "aiImages": False, "share": False},
"formats": ["png", "jpg"],
"maxPages": 1,
},
"pro": {
"features": {"aiImages": True, "removeBackground": True, "videoDownload": True},
"videoFormats": ["mp4", "gif"],
},
}
session = requests.post(
"https://api.muzekit.com/v1/sessions",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={"user": {"id": user.id}, **TIERS[user.tier]},
).json()AI features and video downloads spend your plan's AI and API credits, so turn them on only for users who pay you for them.
Show a design for review
Open a view session for previews and approvals: nothing in the design can change. Turn downloads off too when the reviewer should only look.
curl https://api.muzekit.com/v1/sessions \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"user": { "id": "reviewer_7", "name": "Grace" },
"mode": "view",
"template": "tpl_Vk1t4l9xvQv",
"features": { "downloads": false }
}'const res = await fetch("https://api.muzekit.com/v1/sessions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
user: { id: "reviewer_7", name: "Grace" },
mode: "view",
template: "tpl_Vk1t4l9xvQv",
features: { downloads: false },
}),
});
const session = await res.json();import os
import requests
session = requests.post(
"https://api.muzekit.com/v1/sessions",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"user": {"id": "reviewer_7", "name": "Grace"},
"mode": "view",
"template": "tpl_Vk1t4l9xvQv",
"features": {"downloads": False},
},
).json()A view session opens your workspace templates and the session user's own designs. To show one user's design to someone else, open the session as its owner (user.id of the user who made it).
Add a button that sends the design to your app
A top-bar button of your own, in your words. With action: "png", a click sends your page the current page as a PNG in the SDK's action event (base64, mimeType). labels renames the editor's own buttons for this session.
curl https://api.muzekit.com/v1/sessions \
-H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"user": { "id": "user_42" },
"template": "product-card",
"buttons": [
{
"id": "add-to-listing",
"label": "Add to listing",
"action": "png",
"primary": true
}
],
"labels": { "downloads.download": "Export" }
}'const res = await fetch("https://api.muzekit.com/v1/sessions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
user: { id: "user_42" },
template: "product-card",
buttons: [
{ id: "add-to-listing", label: "Add to listing", action: "png", primary: true },
],
labels: { "downloads.download": "Export" },
}),
});
const session = await res.json();
// On your page: editor.on("action", (e) => upload(e.base64))import os
import requests
session = requests.post(
"https://api.muzekit.com/v1/sessions",
headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
json={
"user": {"id": "user_42"},
"template": "product-card",
"buttons": [
{"id": "add-to-listing", "label": "Add to listing", "action": "png", "primary": True},
],
"labels": {"downloads.download": "Export"},
},
).json()Response
{
"object": "session",
"id": "ses_…",
"client_secret": "ses_…_secret_…",
"editor_url": "https://editor.muzekit.com/session",
"expires_at": "2026-10-16T21:45:00.000Z",
"mode": "design",
"user": {
"object": "user",
"id": "usr_8fK2mQ1xZpR",
"external_id": "user_42",
"name": "Ada",
"email": null,
"locale": null,
"metadata": {},
"last_active_at": "2026-10-16T21:35:00.000Z",
"created_at": "2026-10-02T09:12:44.000Z"
},
"template": null,
"design": null
}user is the user as stored after this session's update.
In fill mode with one of your workspace templates, a user who already filled it gets their own copy back, so their earlier answers stay. design is that copy's tpl_… id, or null when the session starts from your template.
The client_secret works once and expires after 10 minutes. Pass it to the editor on your page; never store it.
The session counts toward your plan when the editor opens on your page, not when you create it. Creating one answers 402 sessions_exhausted up front when this period's sessions and the 3% margin are used, so your server sees it before your user does.