Skip to main content

Get Statistics

GET /api/user/stats

Retrieve detailed statistics about your files, storage usage, URLs, and activity.

Request

curl -X GET https://your-zipline.com/api/user/stats \
  -H "Authorization: YOUR_TOKEN"

Response

filesUploaded
number
Total number of files uploaded by this user
favoriteFiles
number
Number of files marked as favorite
views
number
Total views across all files
avgViews
number
Average views per file
storageUsed
number
Total storage used in bytes
avgStorageUsed
number
Average file size in bytes
urlsCreated
number
Total number of shortened URLs created
urlViews
number
Total views across all shortened URLs
sortTypeCount
object
Breakdown of files by MIME typeEach key is a MIME type (e.g., image/png, video/mp4) and the value is the count of files with that type.
Example Response
{
  "filesUploaded": 147,
  "favoriteFiles": 12,
  "views": 3842,
  "avgViews": 26.13,
  "storageUsed": 5368709120,
  "avgStorageUsed": 36520000,
  "urlsCreated": 23,
  "urlViews": 891,
  "sortTypeCount": {
    "image/png": 89,
    "image/jpeg": 34,
    "video/mp4": 12,
    "application/pdf": 8,
    "text/plain": 4
  }
}

Statistics Breakdown

File Statistics

  • filesUploaded: Every file you’ve uploaded (including deleted files with max views)
  • favoriteFiles: Files marked with the favorite flag
  • views: Sum of all view counts across files
  • avgViews: Mean views per file (views ÷ filesUploaded)

Storage Statistics

  • storageUsed: Total bytes used by all your files
  • avgStorageUsed: Average file size (storageUsed ÷ filesUploaded)
To convert storageUsed to human-readable format:
  • GB: storageUsed / 1024 / 1024 / 1024
  • MB: storageUsed / 1024 / 1024
Example: 5368709120 bytes = ~5 GB

URL Statistics

  • urlsCreated: Total shortened URLs created
  • urlViews: Sum of all URL visit counts

File Type Distribution

sortTypeCount provides a breakdown by MIME type, useful for:
  • Understanding what types of content you upload most
  • Displaying visual charts/graphs
  • Analyzing storage usage by file type
Example: Get Top 5 File Types
const topTypes = Object.entries(stats.sortTypeCount)
  .sort(([, a], [, b]) => b - a)
  .slice(0, 5)
  .map(([type, count]) => ({ type, count }));

// Result:
// [
//   { type: 'image/png', count: 89 },
//   { type: 'image/jpeg', count: 34 },
//   { type: 'video/mp4', count: 12 },
//   { type: 'application/pdf', count: 8 },
//   { type: 'text/plain', count: 4 }
// ]

Build docs developers (and LLMs) love