
Use Editor sessions to embed the Bannerbear template editor on your own website. Create a session for a template on your server and you get an editor_url.
Load it in your page with the @bannerbear/editor SDK, or in your own iframe, and your users can edit the template, even if they do not have a Bannerbear account.
Changes save to the template as the user makes them. To keep the template as it is, create the session with copy: true: the user then edits a copy, and the session's template is the copy's uid. Render images from the edited template with Create an Image as usual.
🐻 Bear Tip: Editor sessions are not available on trial accounts.
Create An Editor Session
Creates an editor session for an image template or an animation template, and returns an Editor Session object with its editor_url.
Send a POST request to /editor_sessions with the parameters for your Editor session.
var data = {
"template": "Kax9mYepjw5g8bAnBv",
"mode": "limited",
"copy": true,
"allowed_origins": ["https://app.example.com"],
"metadata": { "customer_id": 42 }
}
fetch('https://api.bannerbear.com/v5/editor_sessions', {
method: 'POST',
body: JSON.stringify(data),
headers: {
'Content-Type' : 'application/json',
'Authorization' : `Bearer ${API_KEY}`
}
})
Revoke an editor session
Send a DELETE request to /editor_sessions/:uid to stop a session. The link stops opening at once, and an editor that is open can no longer save. The session stays in the list with the status revoked.
fetch(`https://api.bannerbear.com/v5/editor_sessions/${UID}`, {
method: 'DELETE',
headers: {
'Authorization' : `Bearer ${API_KEY}`
}
})
Modes
editopens the full editor.limitedopens the editor, but layers cannot be added or deleted.previewshows the template only, read-only, with no editor tools.
🐻 Bear Tip: Preview mode shows your users how a template will look with their data before you render the final image. Send modifications when you create the session, in the same format as Create an Image. You can also add ?modifications= to the editor_url, with the same list as Base64-encoded JSON, or show new modifications in the open preview with the SDK's preview() (see the examples below).
Security
A session expires expires_in seconds after it is created, whether or not it was opened. In edit and limited mode the editor_url opens once: a reload in the same browser tab still works, but the link does not open anywhere else. A preview link opens again until it expires. Set "allowed_origins": {} list so that only your own website can load the editor in an iframe, and revoke a session at any time.
"allowed_origins": [
"https://app.example.com"
Permissions
Use the "permissions" {} list parameter to change what a session allows e.g. whether users can change only some layers. Each key is optional and overrides the default of the mode
add_layersbooleanAllow adding and duplicating layers. Default: true in edit mode, false in limited mode.
delete_layersbooleanAllow deleting layers. Default: true in edit mode, false in limited mode.
editable_layersbooleanThe names of the only layers the user can change. Other layers stay as they are in the template. Omit to allow every layer.
ai_toolsbooleanAllow AI background generation in the editor. It uses your AI credits. Default: false.
"permissions": {
"add_layers": false,
"delete_layers": false,
"editable_layers": null,
"ai_tools": false
}

