Skip to main content
The Bags API supports file uploads for token creation with specific requirements and formats.

Upload Requirements

  • Maximum file size: 15MB for image uploads
  • Content-Type: multipart/form-data for file upload endpoints
  • File field name: image (required field name for all image uploads)
  • Supported formats: PNG, JPG, JPEG, GIF, WebP

Basic File Upload

Single Image Upload

Advanced Upload Examples

Validate File Before Upload

Error Handling

Common Upload Errors

File too large (413):
Invalid file type (400):
Missing file (400):
Corrupted file (400):

Best Practices

  1. Always validate files client-side before uploading to save bandwidth and API quota
  2. Compress images when possible to improve upload speed and user experience
  3. Show progress indicators for better user experience during uploads
  4. Handle network interruptions with retry logic for failed uploads
  5. Use appropriate image formats - PNG for graphics with transparency, JPEG for photos
  6. Optimize image dimensions - resize to appropriate dimensions before upload
Uploaded images are processed and optimized by the Bags system. The final image URL may differ from your uploaded version.
Consider implementing client-side image compression to improve upload speeds and stay within file size limits.