POST

Create a session

Open the editor for one of your users. Returns a single-use client secret for your page.

View as Markdown
POSThttps://api.muzekit.com/v1/sessions

Body

user.idstringrequired

Your 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.namestring

Shown in the editor.

user.emailstring

For your records; Muzekit never emails end users.

user.localestring

Editor language, e.g. en, de.

user.metadataobject

Your own data, up to 4 KB as JSON; more answers 400 invalid_request.

modedesign | fill | view

What the user can do. Default design. view needs a template. See Editor modes.

templatetpl_… | key

A 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.

localestring

Overrides the user locale for this session: en, de, es, fr, pt, ru or el (de-DE works too). Another language answers 400 invalid_request.

featuresobject

This 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 | brand

brand: only the brand kit's fonts and the design's own.

maxPagesnumber

The most pages a design can have in this session (1–500).

labelsobject

Your 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 | object

The 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" }'

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"
  }'

The response's template is what you sent, so a key stays a key:

JSON
{ "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"
  }'

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
  }'

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 }
  }'

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" }
  }'

Response

JSON
{
  "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.