# Replace the avatar's knowledge files

URL: https://www.atmee.ai/docs/v2/api/reference/avatars/replaceAvatarKnowledge

`PUT /v1/avatars/{avatarId}/knowledge`

Replaces the whole knowledge set: repeat the `files` part for each document (pdf, docx,
doc, txt, md, html, csv <= 50 MB each; up to 20 files). Send with no files to clear it.
`descriptions` is an optional JSON object mapping a filename to a short description.
Or, on an instance that keeps uploads (where `POST /v1/uploads` answers),
`application/json`: `{"files": ["<https URL | upload:<uploadId>>", ...],
"descriptions": {...}}`, the files by URL or by `knowledge` uploads (an empty
list clears the set). A URL's file is named by its last path segment, an
upload's by the `fileName` it was created with; `descriptions` uses those
names. The uploads are consumed when the replacement succeeds.
Re-runs only the build stages that depend on this part; poll
`GET /v1/avatars/{avatarId}` for progress. Requires `avatars:write`.
The `knowledge.facts` text and the `knowledge.questionnaire` answers
keep their own files: replacing the files leaves them (change them
with PATCH). Knowledge is not used in v2
conversations yet.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `avatarId` | path | yes |  |

## Request body

- `multipart/form-data`: object
- `application/json`: `AvatarKnowledgeJsonRequest`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `files` | array of `AssetRefString` | yes |  |
| `descriptions` | object | no |  |

## Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Accepted; the affected build stages re-run. | `AvatarPartResponse` |
| `400` | invalid_upload (also a JSON body on an instance without uploads, which takes multipart only) \| invalid_manifest \| invalid_url \| fetch_failed \| upload_not_found \| upload_kind_mismatch | none |
| `401` | Missing or invalid API key -- or a user token that is invalid, anonymous, or of a user who may act for no account (invalid_login) | none |
| `403` | insufficient_scope \| avatar_not_allowed \| account_not_allowed (a user token whose X-Account-Id names an account the user may not act for) | none |
| `404` | avatar_not_found | none |
| `409` | upload_not_ready \| upload_consumed \| upload_expired \| upload_in_use \| account_ambiguous (a user token of several accounts without X-Account-Id) | none |
| `413` | Upload exceeds the size limit | none |

## `200` response fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `avatarId` | string | yes |  |
| `status` | string (`building`) | yes |  |
