Upload a file
Upload a file to be processed
Parameters
Optional container tags. Can be either a JSON string of an array (e.g., ’[“user_123”, “project_123”]’) or a single string (e.g., ‘user_123’). Single strings will be automatically converted to an array.
Optional custom ID of the document. Max 100 characters, alphanumeric with hyphens, underscores, and colons only.
Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction.
Optional file path for the uploaded file (e.g., ‘/documents/reports/file.pdf’). Used by supermemoryfs to map documents to filesystem paths.
Optional file type override to force specific processing behavior. Valid values: text, pdf, tweet, google_doc, google_slide, google_sheet, image, video, notion_doc, webpage, onedrive
Optional metadata filter as a JSON string. Scopes which existing memories are pulled as context during ingestion. Scalar values match exactly (AND across keys); array values match ANY (OR within key).
Optional metadata for the document as a JSON string. This is used to store additional information about the document. Keys must be strings and values can be strings, numbers, or booleans.
Upload a file
import os
from supermemory import Supermemory
client = Supermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
)
response = client.documents.upload_file(
file=b"Example data",
)
print(response.id){
"id": "id",
"status": "status"
}Returns Examples
{
"id": "id",
"status": "status"
}