Skip to main content
Upload documents, images, videos, audio, and other content to Mem[v] for automatic memory extraction.

Upload files

from memvai import Memv

client = Memv()

# Upload a file
with open("document.pdf", "rb") as file:
    response = client.upload.batch.create(
        space_id="space_abc123",
        files=[file]
    )

print(f"Batch ID: {response.batch_id}")

Upload multiple files

# Upload multiple files
file_paths = ["doc1.pdf", "doc2.txt", "image.png"]

files = [open(path, "rb") for path in file_paths]

try:
    response = client.upload.batch.create(
        space_id="space_abc123",
        files=files
    )
    print(f"Uploaded {len(files)} files - Batch ID: {response.batch_id}")
finally:
    for file in files:
        file.close()

Supported file types

PDF, Word, Text, Markdown, Rich Text
Excel, CSV, Google Sheets
PowerPoint, Google Slides
JPEG, PNG, GIF, WebP
MP4, WebM, MOV, AVI
MP3, WAV, OGG, M4A

Monitor upload progress

import time

# Upload file
with open("large_video.mp4", "rb") as file:
    response = client.upload.batch.create(
        space_id="space_abc123",
        files=[file]
    )

batch_id = response.batch_id

# Poll for completion
while True:
    status = client.upload.batch.get_status(batch_id=batch_id)

    print(f"Status: {status.status}")
    print(f"Progress: {status.processed_files}/{status.total_files}")

    if status.status == "completed":
        print("Processing complete!")
        break
    elif status.status == "failed":
        print("Processing failed")
        break

    time.sleep(2)  # Check every 2 seconds

List files

# List all files in a space
response = client.files.list(space_id="space_abc123")

for file in response.files:
    print(f"{file.name} - {file.size} bytes")
    print(f"  Type: {file.mime_type}")
    print(f"  Status: {file.processing_status}")

Download files

# Download a file
response = client.files.download(
    file_id="file_xyz789",
    space_id="space_abc123"
)

# Save to disk
with open("downloaded_file.pdf", "wb") as f:
    f.write(response.content)

Delete files

# Delete a file
response = client.files.delete(
    file_id="file_xyz789",
    space_id="space_abc123"
)

if response.success:
    print("File deleted successfully")

Next steps

Videos

Work with video files

Memories

Search extracted memories