Skip to main content
POST
TypeScript SDK

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string<uuid>
required

The managed user the session is for (Widgetic's id for the user)

Body

application/json
surfaces
enum<string>[]
required

The pieces of Widgetic's editor the session may drive. files is the media library (the File Browser: upload a file, list the files uploaded for this user); what a user uploads is kept in your own storage destination. Partner storage is not optional: a session of any surface can be made only once you have set a destination up (setPartnerStorageDestination), and is refused with 409 PARTNER_STORAGE_REQUIRED until then. editor is editing one of this user's compositions: read it, change its name, content, design and embed settings, read its schemas, and ask where to show it (getCompositionPreview: the widget's published page). creator is Widgetic's widget creator, with its drawing canvas and its AI: this user's canvases, the widgets on them and the conversation of each widget, the generation, build and publish calls that make a widget, and the compositions of those widgets (list, make). The surfaces do not imply one another: the whole creator also saves a composition (editor) and attaches pictures to its chat (files), so ask for ["creator", "editor", "files"]. workflows is the Workflows editor: this user's own workflows (list, make, make from one of your starting points, draw, publish, pause, resume, archive, delete, the version history and the counts) under /workspaces/personal/workflows, and the compositions made for this user, which are the only ones a workflow of theirs can chain. A workflow is filed under the user it was made for (managedUserId), and the session reaches nothing of another user's, nor of yours.

Minimum array length: 1
Available options:
files,
editor,
creator,
workflows
Example:
expiresInSeconds
integer
default:3600

How long the session lasts, in seconds. It cannot be extended; make a new session when it ends.

Required range: 60 <= x <= 14400
Example:

3600

allowedOrigin
string | null

Bind the session to one web page origin, such as https://app.example.com (no path; http is accepted only for localhost). The session is then refused from any other origin, and from a request that carries no Origin header. Leave it out for a session that can be used from anywhere, which is what a server-side caller needs.

Example:

"https://app.example.com"

maxCredits
integer

The most credits this session may spend on Widgetic's AI, one credit being one generation. Once the operations it ran have taken that many, the next one is refused (402, EDITOR_SESSION_CREDIT_LIMIT_REACHED) and the browser is only told that the feature is not available right now. A generation that fails is refunded and does not count. Leave it out to get the limit Widgetic has set for your account, if it has set one (it sets none unless you ask), and otherwise no limit of its own, which leaves the credits of your account as the only ceiling. Send null to ask for no limit of its own even when a default is set.

Required range: 1 <= x <= 1000000
Example:

20

Response

The session, with its token (shown once)

success
boolean
required

Always true on a success.

Example:

true

data
object
required

An editor session you have just made. token is shown once and cannot be read again: hand it to the browser of this one user and keep it out of logs and storage.

Example:
meta
object

Extra information about the answer: where a page sits in a list, the cursor of the next page, or warnings about a call that succeeded with a caveat.