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.
import { createQirtaasClient } from "@qirtaas/core";

const qirtaas = createQirtaasClient({
  apiUrl: "https://api.qirtaas.io",
  getToken: () => fetchEmbedToken(),
});

createQirtaasClient(options)

QirtaasClientOptions

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

Client methods

The returned QirtaasClient exposes:
mountEditor(el, options?)
EditorInstance
Boot the editor onto a host node, authorized by the client’s getToken. See Editor.
mountRenderer(el, options)
RendererInstance
Boot the read-only renderer. Its auth (signature / token / shareToken) is supplied per call, not on the client. See Renderer.
deleteDocument(documentId)
Promise<void>
Delete a document over the embed-token channel — no mount required.
duplicateDocument(documentId)
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.

Example: imperative delete from a list view

Because delete/duplicate live on the client, you can call them without mounting an editor:
async function onDelete(id: string) {
  await qirtaas.deleteDocument(id);
  // refresh your list…
}