Skip to main content
POST https://api.craftkit.dev/v1/embed/sessions
Mint an embed session. Your backend calls this with a project API key; the response carries a signed EdDSA session JWT, the iframe_url to mount, and a single-use renew_token. Sessions live for 4 hours — rotate the token with Refresh a session before expires_at. The key’s project must have embed enabled, or auth returns invalid_credentials.

Authorization

string
required
Bearer ck_live_… — a project API key for a project with embed enabled.

Body

object
required
The organization this session belongs to. Upserted on every mint.
object
required
The end-user inside the iframe. Upserted under the tenant.
object
default:"{ mode: 'edit' }"
What the session can open.
object
An inline catalog used for this session only (same shape as Create a catalog). Mutually exclusive with catalogRef.
object
Reference a published catalog by name. Resolves to the current version when version is omitted.
object
Partial override of permission flags (publish, saveDraft, delete, rename, rollback, createCustomVariables, changePageSettings, viewVersionHistory, submitForm, saveFormDraft, shareDocument, emailDocument, viewEngagement). Omitted flags use schema defaults.
string
Name of a saved permission preset (≤60 chars). Accepted by the schema; reserved.
object
Partial branding (primaryColor, logoUrl, fontUrl, locale, ui, support).
object
Framework-agnostic styling contract (baseTheme, variables, rules, layout, stylesheetUrl, fontUrl, logoUrl). Supersedes branding when both are present. Falls back to the partner’s default theme.
object
onPublishedUrl / onCloseUrl — partner URLs the embed posts to.
object
Partial override of maxPublishes (10), maxSaveDrafts (200), maxUploadsBytes (5 MiB).
object
Form-fill claims — only meaningful when scope.mode === 'fill': prefill, showPreview (false), showDocumentAfterSubmit (true), redirectUrl.
Send either variableCatalog (inline, one-off) or catalogRef (a pointer to a published catalog), not both. Neither is required — omit both for a session with no catalog. An unknown catalogRef.name returns 404 catalog_not_found.

Response

200 with the minted session.
string
Session UUID. Use it to revoke the session server-side.
string
Signed EdDSA JWT, also carried in iframe_url.
string
URL to mount in your <iframe> (builder, or form route in fill mode).
string
ISO-8601 expiry, 4 hours from mint.
string
Single-use token for the refresh endpoint.

Errors

cURL
200
Persist renew_token and expires_at server-side. Before expiry, call POST /v1/embed/sessions/refresh with the same project’s API key to rotate the session.