# Files

Attachments to Knowledge Base 2.0 documents. A file is added in two steps: first [upload](./files/upload.md) saves the content and links the file to the document, then [getting the metadata](./files/get.md) returns the ready-to-insert `assetMarkdown` fragment for adding to the document content via `PATCH /v1/note/documents/:id`.

**Scope:** `note` | **Base URL:** `https://vibecode.bitrix24.com/v1` | **Authorization:** `X-Api-Key`

## Operations

- [Upload a file](./files/upload.md) — `POST /v1/note/documents/:documentId/files`
- [Get file metadata](./files/get.md) — `GET /v1/note/documents/:documentId/files/:id`

## Typical scenario

1. Create a document: `POST /v1/note/documents`.
2. Upload a file: `POST /v1/note/documents/:documentId/files` — remember the `id` from the response.
3. Get the fragment to insert: `GET /v1/note/documents/:documentId/files/:id` — take `assetMarkdown`.
4. Insert the fragment into the content: `PATCH /v1/note/documents/:id` with the updated `markdown`.

Full curl example — [Knowledge base overview](/docs/note).

## See also

- [Knowledge bases](/docs/note/collections)
- [Documents](/docs/note/documents)
- [Knowledge base overview](/docs/note)
