Skip to main content
Engram’s Media API provides a dedicated file storage layer separate from the memory system. Files are stored on the Shelby network with auto-categorization, CDN streaming, and HTTP Range support.

How It Works

  1. Upload a file via multipart form-data
  2. Engram auto-categorizes it by MIME type (photo, video, audio, document)
  3. The file is stored on Shelby with a unique blob name
  4. Stream it back with full Range request support (video/audio seeking)

Categories

MIME PrefixCategoryExamples
image/*photoJPEG, PNG, WebP, SVG
video/*videoMP4, WebM, MOV
audio/*audioMP3, WAV, OGG
Everything elsedocumentPDF, TXT, ZIP

Quick Start

Upload

curl -X POST "$API/v1/media/upload" \
  -H "Authorization: Bearer $API_KEY" \
  -F "[email protected]" \
  -F "expiresIn=90d" \
  -F "title=Profile Photo"

List

# All media
curl "$API/v1/media" -H "Authorization: Bearer $API_KEY"

# Only photos
curl "$API/v1/media?category=photo" -H "Authorization: Bearer $API_KEY"

Stream

# Download
curl -o photo.jpg "$API/v1/media/$ID/stream" \
  -H "Authorization: Bearer $API_KEY"

# Range request for video seeking
curl -H "Range: bytes=0-1024" "$API/v1/media/$ID/stream" \
  -H "Authorization: Bearer $API_KEY"

Delete

curl -X DELETE "$API/v1/media/$ID" -H "Authorization: Bearer $API_KEY"

Media vs Memory Uploads

FeatureMedia API (/v1/media)Memory Upload (/v1/memory/upload)
PurposeStandalone file storageFile-backed memories
CategoriesAuto-categorizedUser-defined type
VersioningNoYes (PUT creates versions)
SearchNot indexedSearchable by key/tags
Streaming✅ Range supportDownload only
AuthAPI keyAPI key
Use the Media API for standalone files (images, videos, documents) that need streaming. Use Memory Upload for files that should be part of the memory system with versioning and search.

CDN Direct Access

For frequently accessed public files, bypass the API and use the Shelby CDN directly:
https://api.testnet.shelby.xyz/shelby/v1/blobs/{aptosAddress}/{blobName}
This is especially useful for embedding images and videos in web pages.

TTL and Expiration

Media files follow the same TTL rules as memories. Set expiresIn during upload:
DurationUse Case
1hTemporary previews
7dWeekly reports
30dMonthly content
90dLong-term storage (default)
365dAnnual archives (maximum)

Credit Costs

OperationCostNotes
Upload (POST)media.upload (5 credits)Refunded if upload fails
Stream (GET .../stream)media.stream (1 credit)Actual Shelby read
Delete (DELETE)media.delete (2 credits)
List / Metadata (GET)FreeDB-only, no Shelby read