> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qirtaas.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Client

> Configure the connection once with createQirtaasClient, then mount editors and renderers.

`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.

```ts theme={null}
import { createQirtaasClient } from "@qirtaas/core";

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

## `createQirtaasClient(options)`

### QirtaasClientOptions

<ParamField path="apiUrl" type="string" default="https://api.qirtaas.io">
  Qirtaas API base URL. Point this at the managed cloud, or at your own
  backend when [self-hosting](/backend/self-hosting).
</ParamField>

<ParamField path="getToken" type="() => 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.
</ParamField>

## Client methods

The returned `QirtaasClient` exposes:

<ResponseField name="mountEditor(el, options?)" type="EditorInstance">
  Boot the editor onto a host node, authorized by the client's `getToken`.
  See [Editor](/sdk/editor).
</ResponseField>

<ResponseField name="mountRenderer(el, options)" type="RendererInstance">
  Boot the read-only renderer. Its auth (signature / token / shareToken) is
  supplied **per call**, not on the client. See [Renderer](/sdk/renderer).
</ResponseField>

<ResponseField name="deleteDocument(documentId)" type="Promise<void>">
  Delete a document over the embed-token channel — no mount required.
</ResponseField>

<ResponseField name="duplicateDocument(documentId)" type="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.
</ResponseField>

## Example: imperative delete from a list view

Because delete/duplicate live on the client, you can call them without mounting
an editor:

```ts theme={null}
async function onDelete(id: string) {
  await qirtaas.deleteDocument(id);
  // refresh your list…
}
```
