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

# Knowledge API

> Knowledge API — Visito M2M API

All paths below are relative to `/m2m/v1`. Send `Authorization: Bearer <key>`. Tenant identity comes from the key.

Use `knowledge:read` for discovery and status and `knowledge:write` for ingestion and management. Existing quotas, supported file formats, and activation semantics apply.

| Method | Route                                  | Use                                                                      |
| ------ | -------------------------------------- | ------------------------------------------------------------------------ |
| GET    | `/knowledge/sources`                   | List with `limit` (1–200), `cursor`, `status`, `sourceType`, and `query` |
| GET    | `/knowledge/sources/{sourceId}`        | Source detail; optional `includeInactive`                                |
| GET    | `/knowledge/usage`                     | Active-token usage and remaining quota                                   |
| POST   | `/knowledge/text`                      | Create or replace text by `sourceId`                                     |
| POST   | `/knowledge/file`                      | Multipart upload, `file` field, maximum 10 MiB                           |
| POST   | `/knowledge/url`                       | Ingest one URL                                                           |
| POST   | `/knowledge/url/crawl`                 | Queue a crawl; returns 202 with job ID                                   |
| GET    | `/knowledge/url/crawl/{jobId}`         | Crawl progress/result                                                    |
| PATCH  | `/knowledge/sources/{sourceId}/active` | Activate/deactivate with `{"active":true}`                               |
| DELETE | `/knowledge/sources/{sourceId}`        | Delete; returns 204                                                      |

```json theme={null}
{"text":"Check-in starts at 3 pm.","title":"Check-in policy","sourceId":"check-in-policy"}
```

Text is limited to 200,000 characters; title to 160; sourceId to 128. Updating a source of a different type is rejected. Text/file/URL ingestion returns 201 on creation or 200 on update. A new source can be saved inactive when quota is exceeded; check `active` and `quotaExceeded`. Updating an active source beyond quota returns 409.

The current knowledge model is source-based: no `knowledgeBaseId` is required. File uploads accept optional `title` and `assetUpload`; `sourceId` is not supported for file uploads. Crawl JSON accepts `url`, `crawlDepth` (1–3, default 2), and `maxPages` (1–500, default 500).
