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

# Documents

> A document is an id, text and metadata.

```json theme={null}
{ "id": "refunds", "text": "Refunds are available for 30 days after purchase.", "metadata": { "team": "support" } }
```

Conare splits the text into passages, embeds them and indexes them for keyword search. You
send whole documents; you never manage chunks or vectors.

| Field | Rules |
| - | - |
| `id` | 1-256 characters of `A-Z a-z 0-9 . _ : -`, starting with a letter or digit. Optional: Conare generates one if you leave it out. |
| `text` | Required. Up to 256 KB. |
| `metadata` | Optional. Up to 32 keys. Values are strings, numbers, booleans or arrays of strings. Use it to [filter](/concepts/filters). |

Writing a document with an existing id replaces it. To update a document, write it again.

## Add

Send up to 100 documents per request. The SDK accepts any number and sends them 100 at a time.

<CodeGroup>
  ```ts TypeScript theme={null}
  await docs.add([
    { id: "refunds", text: "Refunds are available for 30 days.", metadata: { team: "support" } },
    { id: "shipping", text: "Orders ship within two business days.", metadata: { team: "ops" } },
  ]);
  // ["refunds", "shipping"]
  ```

  ```bash curl theme={null}
  curl https://api.conare.ai/namespaces/docs/documents \
    -H "Authorization: Bearer $CONARE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"documents": [{"id": "refunds", "text": "Refunds are available for 30 days."}]}'
  ```
</CodeGroup>

## Get, list, delete

<CodeGroup>
  ```ts TypeScript theme={null}
  await docs.get("refunds");                 // { id, text, metadata, updatedAt } or null

  for await (const doc of docs.list()) {     // every document, page by page
    console.log(doc.id, doc.updatedAt);
  }

  await docs.delete("refunds");
  ```

  ```bash curl theme={null}
  curl https://api.conare.ai/namespaces/docs/documents/refunds -H "Authorization: Bearer $CONARE_API_KEY"

  # Pages: pass next_cursor back as cursor until it is null.
  curl "https://api.conare.ai/namespaces/docs/documents?limit=100" -H "Authorization: Bearer $CONARE_API_KEY"

  curl -X DELETE https://api.conare.ai/namespaces/docs/documents/refunds -H "Authorization: Bearer $CONARE_API_KEY"
  ```
</CodeGroup>

Listing returns ids and metadata, not text. Get a document for its text.
