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

> ## Agent Instructions
> Conare's API is at https://api.conare.ai. Authenticate with `Authorization: Bearer $CONARE_API_KEY`.
> The full OpenAPI spec is at https://api.conare.ai/openapi.yaml; each endpoint has a page under /api-reference, and appending .md to any page URL returns its Markdown.
> Embed with model conare-embed-1; send input_type "query" for search queries. Rerank with conare-rerank-1.
> Prefer the TypeScript SDK (`npm install conare`) or plain HTTP in examples.
> Install the Conare skill with `npx skills add https://docs.conare.ai`; search these docs over MCP at https://docs.conare.ai/mcp; the whole site is at https://docs.conare.ai/llms-full.txt.

# TypeScript SDK

> Das Paket conare für TypeScript und JavaScript: Namespaces, Suche, Dateien, Modelle und Quellen.

`conare` kapselt die API für Node 18 oder neuer und Bun, ohne Abhängigkeiten.

```bash theme={null}
npm install conare
```

```ts theme={null}
import { Conare } from "conare";

const conare = new Conare(); // reads CONARE_API_KEY
const docs = conare.namespace("docs");

await docs.add({ text: "Refunds are available for 30 days." });
const results = await docs.query("how do refunds work?");
```

```json Result theme={null}
[
  {
    "id": "doc_HmsFWqbQQc2mY03FhVZE",
    "text": "Refunds are available for 30 days.",
    "score": 0.3192,
    "reranked": true,
    "metadata": {}
  }
]
```

Antwortfelder sind in camelCase, und Zeitstempel sind `Date`s.

## Optionen

```ts theme={null}
new Conare({
  apiKey: "sk-conare-...",           // default: CONARE_API_KEY
  baseURL: "https://api.conare.ai",  // default: CONARE_BASE_URL
  timeout: 60_000,                   // ms per attempt
  maxRetries: 2,
  organization: "org_...",           // for a multi-organization key
});
```

Jede Methode akzeptiert außerdem als letztes Argument `{ signal, timeout, idempotencyKey }`.

## Methoden

| Methode | Rückgabe |
| - | - |
| `conare.namespace(name)` | Ein Namespace-Handle; nichts wird gesendet, bis Sie eine Methode aufrufen |
| `conare.namespaces({ prefix })` | `[{ name, documents, embeddingModel, rerankModel }]` |
| `ns.add(docs)` | Die Ids |
| `ns.write(docs)` | `[{ id, version, result, chunks, chunksEmbedded }]` |
| `ns.query(query, { topK, filter, rerank, rerankDepth, retrievers, user, userPrefix, excludeIds, hops })` | `[{ id, text, score, reranked, metadata }]` |
| `ns.queryPages(query, { maxResults, ... })` | Ein asynchroner Iterator über Seiten |
| `ns.get(id)` | Das Dokument oder `null` |
| `ns.list({ limit })` | Ein asynchroner Iterator über alle Dokumente |
| `ns.delete(id)` | Nichts |
| `ns.deleteMany(ids)`, `ns.deleteWhere(filter)` | Wie viele gelöscht wurden |
| `ns.create({ embeddingModel })` | `{ embeddingModel }` |
| `ns.drop({ force })` | `{ sourcesDeleted }` |
| `ns.uploadFile(file, name, { id, type, user, metadata, pages, password, layout, wait })` | Der [Upload](https://docs.conare.ai/de/files.md#eine-datei-hochladen) und, sobald `ready`, sein Markdown |
| `ns.getFile(fileId, { user })` | Der neueste [Upload](https://docs.conare.ai/de/files.md#eine-datei-prüfen) der Datei |
| `conare.parse(file or { url }, { name, type, pages, password, layout, wait })` | Das [Markdown](https://docs.conare.ai/de/files.md#eine-datei-parsen) der Datei, nichts wird gespeichert |
| `conare.getParse(id)` | Ein Parse, der mit `parsing` geantwortet hat |
| `conare.embed(texts, { type, outputDtype })` | Die Vektoren; mit `int8` `{ values, scales }` (`dequantize` wandelt sie zurück) |
| `conare.rerank(query, documents, { topK })` | `[{ index, score, document }]`, mit `unscored` |
| `conare.sources` | `connect`, `create`, `list`, `get`, `sync`, `update`, `delete`, `types` |
| `conare.organizations()` | Die Organisationen, für die der Schlüssel handelt |
| `conare.users.delete(user)`, `deletePrefix(prefix)` | Der Lauf, der die Daten eines Nutzers löscht |
| `conare.events.list({ cursor, types })` | Was sich geändert hat, in Reihenfolge |

* `add` und `write` akzeptieren ein Dokument oder ein Array beliebiger Größe und senden jeweils 100 auf einmal.
* Die Suche über alle Namespaces (`POST /query`) und `answer` haben noch keine Methode: Rufen Sie sie über HTTP auf.

## Fehler

Jeder Fehler wirft einen `ConareError` mit `status`, `code`, `message` und `requestId`.

```ts theme={null}
import { ConareError } from "conare";

try {
  await docs.add({ text: "" });
} catch (err) {
  if (err instanceof ConareError) console.log(err.status, err.code); // 400 "invalid_request"
}
```

| Fall | Verhalten |
| - | - |
| Keine Antwort | `status` ist `0`, `code` ist `timeout` oder `connection_error` |
| `429`, `5xx`, Netzwerkfehler | Bis zu `maxRetries` Mal wiederholt, nach `Retry-After` oder einem Backoff |
| Schreibvorgänge | Tragen einen [`Idempotency-Key`](https://docs.conare.ai/de/api#wiederholungen), sodass eine Wiederholung nie doppelt schreibt |


## Related topics

- [Einführung](https://docs.conare.ai/de/index.md)
- [Schnellstart](https://docs.conare.ai/de/quickstart.md)
- [Embedding und Reranking](https://docs.conare.ai/de/embed-rerank.md)
- [turbopuffer API](https://docs.conare.ai/de/turbopuffer.md)
- [Suche](https://docs.conare.ai/de/query.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.