File vs Media
File
A File is raw data uploaded to the server, devoid of context, usage, or metadata about how it’s being used. Files are identified by a snowflake ID and stored in specific regions.Media
A Media object is the backing type for attachments in messages. It contains:- A reference to a File
- Additional metadata (dimensions, duration, etc.)
- Context about how the file is being used
Core Types
File Structure
Snowflake identifier for the file
Storage region where the file is located
File size in bytes
MIME type of the file (e.g.,
image/png, video/mp4)Original filename
Type-specific metadata (see below)
FileMetadata Variants
TheFileMetadata message contains different metadata based on file type:
Image Metadata
Image width in pixels
Image height in pixels
Low-resolution preview data for fast loading
Video Metadata
Video width in pixels
Video height in pixels
Video duration in seconds
Audio Metadata
Audio duration in seconds
Custom Emoji Metadata
Emoji image width in pixels
Emoji image height in pixels
The emoji character this represents
Reference to the sticker pack containing this emoji
Message Media Types
When attaching media to messages, use theMessageMedia type:
- MediaFile: A file attachment with metadata
- MediaEmbed: A URL embed with preview data