Overview
Teak supports uploading files up to 20MB for images, videos, audio, and documents. The file upload process is a multi-step workflow that ensures proper validation, storage, and card creation.Upload Workflow
generateUploadUrl
Generates a temporary URL for uploading a file to Convex storage.Parameters
The name of the file being uploaded (for logging and debugging purposes).
The MIME type of the file being uploaded (for logging and debugging purposes).
Returns
A temporary URL that can be used to upload the file via POST request.
Example
Authentication
Requires authenticated user. Returns an error if called without authentication.Location
packages/convex/card/generateUploadUrl.ts:4
finalizeUploadedCard
Completes the upload process by creating a card with the uploaded file.Parameters
The storage ID returned from the upload POST request.
The original name of the uploaded file.
The type of card to create. Must be one of:
"image"- Image files"video"- Video files"audio"- Audio files"document"- PDF and document files
Optional text content to associate with the card.
Additional metadata for the file:
recordingTimestamp- When the media was recordedduration- Duration for audio/video fileswidth- Width for images/videosheight- Height for images/videos
Returns
Whether the card was created successfully.
The ID of the created card (only present if success is true).
Error message if the operation failed.
Error code for programmatic handling. Possible values:
CARD_LIMIT_REACHED- User has reached their card limitRATE_LIMITED- Too many cards created recentlyTYPE_MISMATCH- File MIME type doesn’t match the specified card type
Example
Validation
The mutation validates that:
- The file exists in storage
- The MIME type matches the specified card type
- The user hasn’t exceeded their card limit
- The user hasn’t hit rate limits
Location
packages/convex/card/uploadCard.ts:106
File Size Limits
Teak enforces a maximum file size of 20MB (20,971,520 bytes) for all uploads.Files exceeding 20MB will be rejected during the upload process. Make sure to validate file sizes on the client before attempting to upload.
Supported File Types
Teak supports the following file types, organized by card type:Images
- All files with MIME type starting with
image/ - Examples: JPEG, PNG, GIF, WebP, SVG, etc.
Videos
- All files with MIME type starting with
video/ - Examples: MP4, WebM, MOV, AVI, etc.
Audio
- All files with MIME type starting with
audio/ - Examples: MP3, WAV, M4A, OGG, etc.
Documents
- PDF files (
application/pdf) - Microsoft Word documents (
application/msword,application/vnd.openxmlformats-officedocument.*) - Text files (MIME types starting with
text/)
The file’s MIME type must match the specified
cardType. For example, uploading a video file with cardType: "image" will fail with a TYPE_MISMATCH error.Processing Pipeline
After a file is successfully uploaded and the card is created:- Classification - AI determines visual characteristics and palette colors
- Thumbnail Generation - Creates optimized preview images
- Metadata Extraction - Extracts tags, summary, and other AI-generated insights
- Categorization - Organizes the card based on content
processingStatus field on the card.