> ## 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

> TypeScript와 JavaScript용 conare 패키지: 네임스페이스, 검색, 파일, 모델, 소스.

`conare`는 Node 18 이상과 Bun에서 API를 감싸며, 의존성이 없습니다.

```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": {}
  }
]
```

응답 필드는 camelCase이며, 타임스탬프는 `Date`입니다.

## 옵션

```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
});
```

모든 메서드는 마지막 인수로 `{ signal, timeout, idempotencyKey }`도 받습니다.

## 메서드

| 메서드 | 반환값 |
| - | - |
| `conare.namespace(name)` | 네임스페이스 핸들. 메서드를 호출하기 전까지는 아무것도 전송되지 않습니다 |
| `conare.namespaces({ prefix })` | `[{ name, documents, embeddingModel, rerankModel }]` |
| `ns.add(docs)` | id 목록 |
| `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, ... })` | 페이지의 비동기 이터레이터 |
| `ns.get(id)` | 문서, 또는 `null` |
| `ns.list({ limit })` | 모든 문서에 대한 비동기 이터레이터 |
| `ns.delete(id)` | 없음 |
| `ns.deleteMany(ids)`, `ns.deleteWhere(filter)` | 삭제된 개수 |
| `ns.create({ embeddingModel })` | `{ embeddingModel }` |
| `ns.drop({ force })` | `{ sourcesDeleted }` |
| `ns.uploadFile(file, name, { id, type, user, metadata, pages, password, layout, wait })` | [업로드](https://docs.conare.ai/ko/files.md#파일-업로드), 그리고 `ready`가 되면 그 Markdown |
| `ns.getFile(fileId, { user })` | 파일의 최신 [업로드](https://docs.conare.ai/ko/files.md#파일-확인) |
| `conare.parse(file or { url }, { name, type, pages, password, layout, wait })` | 파일의 [Markdown](https://docs.conare.ai/ko/files.md#파일-파싱), 저장되지 않음 |
| `conare.getParse(id)` | `parsing`으로 응답한 파싱 |
| `conare.embed(texts, { type, outputDtype })` | 벡터. `int8`이면 `{ values, scales }`(`dequantize`로 되돌림) |
| `conare.rerank(query, documents, { topK })` | `[{ index, score, document }]`, `unscored` 포함 |
| `conare.sources` | `connect`, `create`, `list`, `get`, `sync`, `update`, `delete`, `types` |
| `conare.organizations()` | 키가 대리하는 조직 |
| `conare.users.delete(user)`, `deletePrefix(prefix)` | 사용자 데이터를 삭제하는 실행 |
| `conare.events.list({ cursor, types })` | 변경된 내용, 순서대로 |

* `add`와 `write`는 문서 하나 또는 크기 제한 없는 배열을 받아 100개씩 전송합니다.
* 모든 네임스페이스 검색(`POST /query`)과 `answer`는 아직 메서드가 없습니다. HTTP로 호출하세요.

## 오류

모든 실패는 `status`, `code`, `message`, `requestId`를 가진 `ConareError`를 던집니다.

```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"
}
```

| 경우 | 동작 |
| - | - |
| 응답 없음 | `status`는 `0`, `code`는 `timeout` 또는 `connection_error` |
| `429`, `5xx`, 네트워크 오류 | `Retry-After` 또는 백오프 후 최대 `maxRetries`회 재시도 |
| 쓰기 | [`Idempotency-Key`](https://docs.conare.ai/ko/api#재시도)를 포함하므로 재시도해도 두 번 기록되지 않습니다 |


## Related topics

- [빠른 시작](https://docs.conare.ai/ko/quickstart.md)
- [소개](https://docs.conare.ai/ko/index.md)
- [임베딩과 리랭킹](https://docs.conare.ai/ko/embed-rerank.md)
- [turbopuffer API](https://docs.conare.ai/ko/turbopuffer.md)
- [검색](https://docs.conare.ai/ko/query.md)


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