Skip to main content
createQirtaasClient bundles your connection (apiUrl) and embed-token source (getToken) once, then returns a client whose methods are bound to that config. This is the “configure once” shape — you don’t re-pass apiUrl/getToken on every call.

createQirtaasClient(options)

QirtaasClientOptions

string
default:"https://api.qirtaas.io"
Qirtaas API base URL. Point this at the managed cloud, or at your own backend when self-hosting.
() => Promise<string> | string
Returns a short-lived embed token. Called on init, before the token expires, and again on a 401. Shared by mountEditor and the mount-less ops (listDocuments, deleteDocument, duplicateDocument, getShareInfo, setSharing).Optional — a renderer-only client can omit it (the renderer carries its own per-read auth). The editor and the mount-less ops throw if it is missing.

Client methods

The returned QirtaasClient exposes:
EditorInstance
Boot the editor onto a host node, authorized by the client’s getToken. See Editor.
RendererInstance
Boot the read-only renderer. Its auth (signature / token / shareToken) is supplied per call, not on the client. See Renderer.
Promise<DocumentSummary[]>
List the identity’s documents — { id, title, status, created_at, updated_at }, no content. Titles are derived server-side from the content, so the result is directly displayable: a host can render a document list without keeping its own index of ids.
Promise<void>
Delete a document over the embed-token channel — no mount required.
Promise<DuplicateDocumentResult>
Copy a document’s content into a new document, returning the new id. Lets a host keep a stable published document while the author edits a private clone.
Promise<ShareInfo>
Turn public sharing on or off for a document the identity owns. Enabling mints (or returns the existing) opaque share token — the credential the renderer’s public read mode consumes. Disabling revokes it. Returns { is_shared, share_token }.
Promise<ShareInfo>
Read a document’s current sharing state without changing it — same { is_shared, share_token } shape (share_token is null while sharing is off).

One live embed per page

The SDK’s HTTP transport is shared per page, so only one Qirtaas embed (editor or renderer) should be mounted at a time when their connections differ — a second concurrent mount with a different apiUrl or auth source (e.g. multiple renderers each carrying their own per-document getSignature) takes over the connection from the first. Two mounts on the same backend and token source coexist fine. destroy() the current embed before mounting the next when in doubt.

Example: a document list without a backend model

Because list/delete/duplicate live on the client, a host can drive a whole list view without mounting an editor — or keeping any document index of its own:
See the document creation tutorial for this pattern end to end.