Upload avatar
Upload an avatar image for an identity
multipart/form-data
Request Parameters
Image file to uploadAccepted formats: JPEG, PNG, GIF, WebP
Maximum size: 5MB
Maximum size: 5MB
ID of the identity to update
Response
Public URL of the uploaded avatar image
Example
Behavior
- Automatically deletes the previous avatar if one exists
- Generates a unique filename with timestamp and random string
- Stores in R2 bucket under
avatars/prefix - Sets 1-year cache control header
- Logs
avatar_updatedactivity
Error Responses
Upload banner
Upload a banner image for an identity
multipart/form-data
Request Parameters
Image file to uploadAccepted formats: JPEG, PNG, GIF, WebP
Maximum size: 10MB
Maximum size: 10MB
ID of the identity to update
Response
Public URL of the uploaded banner image
Example
Behavior
- Automatically deletes the previous banner if it’s an image URL (not a color code)
- Generates a unique filename with timestamp and random string
- Stores in R2 bucket under
banners/prefix - Sets 1-year cache control header
- Logs
banner_updatedactivity
Delete avatar
Remove the avatar from an identity
Path Parameters
ID of the identity
Response
Always
true if deletion succeedsExample
Delete banner
Remove the banner from an identity
Path Parameters
ID of the identity
Response
Always
true if deletion succeedsExample
Configuration
The upload endpoints require the following environment variables to be configured:Cloudflare R2 account ID
R2 access key ID
R2 secret access key
R2 bucket name (defaults to “ave-uploads”)
Public URL for accessing uploaded files
File Specifications
Avatar Images
- Formats: JPEG, PNG, GIF, WebP
- Maximum size: 5MB
- Storage path:
avatars/{timestamp}-{random}.{ext} - Cache: 1 year (
max-age=31536000)
Banner Images
- Formats: JPEG, PNG, GIF, WebP
- Maximum size: 10MB
- Storage path:
banners/{timestamp}-{random}.{ext} - Cache: 1 year (
max-age=31536000)
Banner URLs can also be color codes (starting with
#) instead of image URLs. The delete endpoint only removes actual image files, not color codes.Security
- Authentication required: All endpoints require valid session authentication
- Identity ownership: Users can only upload to identities they own
- File type validation: Only allows JPEG, PNG, GIF, and WebP images
- Size limits: 5MB for avatars, 10MB for banners
- Automatic cleanup: Old images are deleted when replaced
- Activity logging: All uploads and deletions are logged
Next Steps
Identities
Manage identity information
Activity log
View upload activity