GET /api/user/limits
Retrieves the current user’s file count and storage limits along with their current usage and remaining quota. This endpoint is useful for displaying quota information to users.Authentication
This endpoint requires authentication. Include the JWT token in the Authorization header:Response
Maximum number of files the user can upload (default: 100)
Maximum storage in bytes the user can use (default: 1073741824 = 1GB)
Current number of files the user has uploaded
Current storage used in bytes
Number of files the user can still upload (max_files - current_files)
Remaining storage in bytes (max_storage - current_storage)
Error responses
User is not authenticated
Failed to retrieve user information or calculate usage
Example request
Example response
Use cases
Display quota to users
Show users their current usage and remaining quota in your application’s UI
Prevent upload failures
Check limits before attempting uploads to provide better user feedback
Usage analytics
Track user storage and file count patterns over time
Quota warnings
Alert users when they’re approaching their limits (e.g., 90% full)
Related endpoints
- Upload File - File uploads enforce these limits
- Get File Stats - Get detailed breakdown by file type
- Update User Limits - Admin endpoint to modify limits
Implementation details
This endpoint is implemented incontrollers/user.go:102-137. It performs two database queries:
COUNT(*)to get the number of filesCOALESCE(SUM(size), 0)to get total storage used
max - current for both files and storage.