Skip to main content

Upload a File

Use multipart/form-data to upload binary files up to 10 MB:
curl -X POST "$API/memory/upload" \
  -H "Authorization: Bearer $API_KEY" \
  -F "[email protected];type=application/pdf" \
  -F "type=file" \
  -F "key=docs/quarterly-report" \
  -F "blobFilename=quarterly_report" \
  -F "expiresIn=90d" \
  -F 'metadata={"tags":["report","Q4"],"visibility":"share"}'

Form Fields

FieldRequiredDescription
fileThe binary file (max 10 MB)
typeMemory type (usually file)
keyUnique key for this memory
blobFilenameCustom name for the blob (e.g. "quarterly_report")
blobExtensionOverride file extension (e.g. ".enc" for encrypted files)
expiresInTTL (default 30d)
mimeTypeMIME type hint (auto-detected from upload)
metadataJSON string with tags and visibility
encryptionProviderSet if the file is client-side encrypted
encryptionMetaJSON string with iv and tag for encrypted files

Download a File

# Stream the raw binary
curl -o report.pdf "$API/memory/:id/download" \
  -H "Authorization: Bearer $API_KEY"

# JSON response with base64-encoded content
curl "$API/memory/:id" \
  -H "Authorization: Bearer $API_KEY"
The /download endpoint returns the raw binary with correct Content-Type and Content-Disposition headers. The JSON endpoint returns contentEncoding: "base64" for binary files.

Supported Formats

Any file type is supported. Common examples:
TypeMIMETypical Use
PDFapplication/pdfDocuments, reports
JPEG/PNGimage/jpeg, image/pngScreenshots, diagrams
MP4video/mp4Screen recordings
MP3audio/mpegVoice notes
JSONapplication/jsonConfig files, exports

Encrypted File Uploads

You can encrypt files before uploading — see Encryption for the full workflow.
When uploading encrypted files, use blobExtension=".enc" to clearly indicate the blob is encrypted on-chain.