---
title: "Upload File"
method: POST
path: "/api/v2/agents/{agent_id}/upload-file"
tags: ["Sessions & Agents", "Memory Operations"]
---

# Upload File

`POST /api/v2/agents/{agent_id}/upload-file`

## Request

- The document declares no server URL.
- Auth: none declared

Upload a file directly to the agent's memory namespace (Session-based)

Supported formats: .pdf, .docx, .xlsx, .json, .txt, .csv, .md
Maximum file size: 5GB

The file is processed by Moorcheh to extract text and generate embeddings,
making its content searchable via recall.

Requires:
- X-Session-Token: {session_token}
- Content-Type: multipart/form-data

## Path parameters

- `agent_id` string, required

## Headers

- `x-session-token` string, nullable
- `authorization` string, nullable
- `X-Api-Key` string, nullable

## Cookies

- `memanto_session_token` string, nullable

## Request body `multipart/form-data`

- BodyUploadFileApiV2AgentsAgentIdUploadFilePost
  - `file` string, binary, required: File to upload (.pdf, .docx, .xlsx, .json, .txt, .csv, .md)

## Response `200`

Successful Response

- UploadFileResponse
  - `agent_id` string, required
  - `session_id` string, required
  - `namespace` string, required
  - `file_name` string, required
  - `file_size` integer, nullable
  - `status` string, required
  - `message` string

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-21** `b26ebc4d9cd6`: 1 breaking, 1 info
  - the `file` request property contentMediaType changed from `` to `application/octet-stream`
  - the `file` request property format was generalized from `binary` to no format
- **2026-10-21** `87da4fd7ad11`: 2 breaking
  - the `file` request property contentMediaType changed from `application/octet-stream` to ``
  - the `file` request property format changed from no format to `binary`
- **2026-09-01** `4dbab4daf6d3`: 2 info
  - added the new optional `header` request parameter `X-Api-Key`
  - added the new optional `header` request parameter `authorization`
- **2026-07-09** `6c0f57766d0f`: 1 info
  - added the new optional `cookie` request parameter `memanto_session_token`
- **2026-06-23** `3f3d8570f1a6`: 1 warning
  - deleted the `cookie` request parameter `memanto_session_token`

[Operation history](https://skmtc.dev/moorcheh-ai/apis/memanto-memory-that-ai-agents-love/changes/api/v2/agents/:agent_id/upload-file/post.md)

---

[API](https://skmtc.dev/moorcheh-ai/apis/memanto-memory-that-ai-agents-love.md) - [All operations](https://skmtc.dev/moorcheh-ai/apis/memanto-memory-that-ai-agents-love/llms.txt) - [OpenAPI document](https://skmtc.dev/moorcheh-ai/apis/memanto-memory-that-ai-agents-love/revisions/ef842776283e?raw)
