# Add a text for Otto (https://notert.io/docs/api/reference/add-a-text-for-otto)

`POST /api/v1/knowledge-sources/texts`

Adds a text for Otto to answer customers from, as the Knowledge page's Upload file does with a text file: a FAQ, a policy or docs, as plain text or Markdown. Notert indexes it, which the list follows. A workspace keeps at most 20 websites and files.

Access: A token with knowledge:write.

## Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | No | A key of your own for this call, such as a UUID, sent again with a call made again after its answer was lost, so it stores and sends once and answers what the first stored. The same key with other words names another record. Send it or an id in the body, not both. At least 1 character. At most 255 characters. |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | uuid | No | An id of your own, a UUID, so a call sent again after its answer was lost answers the text it added rather than adding a second. Or send an Idempotency-Key header instead, not both. |
| `name` | string | Yes | The name the Knowledge page lists it by and Otto's answers cite it by, such as pricing-faq.md. At least 1 character. At most 200 characters. |
| `text` | string | Yes | What Otto reads, as plain text or Markdown, up to 200,000 characters; a longer document is uploaded as a file on the Knowledge page. At least 1 character. At most 200000 characters. |

## Response 201

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | The source's id. |
| `kind` | string | What the source is: a website the team added, a file it uploaded, or what Notert connects by itself, the published changelog (changelog), completed requests (completed) and help articles (help). One of: `website`, `file`, `changelog`, `completed`, `help`. |
| `name` | string | A file's name as uploaded, or a website's address, as the team added it. |
| `url` | string or null | A website's address. Null for a file or a source Notert connects. |
| `state` | string | Where the source stands: crawling, paused, ready (every page it found settled) or failed (its first page couldn't be read, or getting it ready for Otto ran out of tries). One of: `crawling`, `paused`, `ready`, `failed`. |
| `failure` | string or null | Why the source failed, such as unreachable, blocked or not found, or not indexed when getting what was read ready for Otto ran out of tries. Null unless it failed. One of: `unreachable`, `blocked`, `not found`, `no access`, `refused`, `server error`, `rate limited`, `not a page`, `too large`, `robots`, `empty`, `elsewhere`, `not a product site`, `not indexed`. |
| `pages` | object | The source's pages by where each stands. |
| `pages.indexed` | integer | The pages Otto answers from. |
| `pages.failed` | integer | The pages that couldn't be read. |
| `pages.skipped` | integer | The pages left out: those the website's robots.txt keeps out or that ask not to be indexed. |
| `pages.queued` | integer | The pages still to read. |
| `crawledAt` | date-time or null | When the source last finished being read. Null before it has. |

## Errors

| Status | Code | Message |
| --- | --- | --- |
| 400 | `BAD_REQUEST` | Input validation failed. |
| 400 | `IDEMPOTENCY_KEY_REFUSED` | Send an Idempotency-Key of 1 to 255 visible characters, or an id of your own in the body, not both. |
| 401 | `UNAUTHORIZED` | Send a valid API token as a Bearer token. |
| 403 | `FORBIDDEN` | The teammate who holds this API token's secret can't change Otto's knowledge. Only an owner or admin can. |
| 403 | `HOLDER_NOT_ALLOWED` | The teammate who holds this API token's secret can't do this in the workspace now. A teammate who can should roll it in the workspace's settings. |
| 403 | `INSUFFICIENT_SCOPE` | This API token can't change what Otto reads or its description. Create one that may in the workspace's settings. |
| 403 | `NETWORK_NOT_ALLOWED` | This API token works only from the networks it was made for. Call from one of them, or create a token for this one in the workspace's settings. |
| 403 | `NO_SEAT` | This workspace's plan has no seat for you. |
| 403 | `WORKSPACE_SUSPENDED` | This workspace is suspended. |
| 404 | `NOT_FOUND` | Not Found. |
| 409 | `CHANGED_MEANWHILE` | Something changed meanwhile. Try again. |
| 409 | `LIMIT_REACHED` | The workspace keeps 20 websites and files for Otto, as many as it may. Its data holds `limit`. |
| 429 | `TOO_MANY_REQUESTS` | Too Many Requests. Its data holds `retryAfter`. |

## Example request

```sh
curl -X POST https://app.notert.io/api/v1/knowledge-sources/texts \
  -H "Authorization: Bearer $NOTERT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "id": "3c5e7a9b-1d2f-4a6b-8c0e-2f4a6c8e0b17",
  "name": "refunds.md",
  "text": "Refunds reach your card within five days of the return."
}'
```

## Example response 201

```json
{
  "id": "3c5e7a9b-1d2f-4a6b-8c0e-2f4a6c8e0b17",
  "kind": "website",
  "name": "docs.example.com",
  "url": "https://docs.example.com/",
  "state": "ready",
  "failure": null,
  "pages": {
    "indexed": 120,
    "failed": 2,
    "skipped": 6,
    "queued": 0
  },
  "crawledAt": "2026-11-20T08:12:00.000Z"
}
```
