Usage Snapshots

A UsageSnapshot is a site-wide utilization report of storage, bandwidth, APIs, and user accounts of your Files.com site for the given time period.

List Usage Snapshots

SDK Method

UsageSnapshot.list()

Return Object

UsageSnapshot[]

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

import UsageSnapshot from 'files.com/lib/models/UsageSnapshot';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const usageSnapshots = await UsageSnapshot.list();
  for (const usageSnapshot of usageSnapshots) {
    // Operate on usageSnapshot
  }
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Get the most recent usage snapshot (usage data for billing purposes) for a Site

SDK Method

Site.getUsage()

Return Object

UsageSnapshot

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

import Site from 'files.com/lib/models/Site';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const usageSnapshot = await Site.getUsage();
  // Operate on usageSnapshot
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

The UsageSnapshot Object

Some of the methods above return a UsageSnapshot object. The attributes of this object are listed below.

AttributeDescription
id
int64
Usage snapshot ID
start_at
date-time
Usage snapshot start date/time
end_at
date-time
Usage snapshot end date/time
high_water_user_count
int64
Highest user count number in time period
transformation_credits_usage
int64
Total Transformation and AI credits used in this usage period. Updated daily. Does not include credits consumed today.
current_storage
int64
Current total Storage Usage GB as of end date (not necessarily high water mark, which is used for billing)
high_water_storage
int64
Highest Storage Usage GB recorded in time period (used for billing)
root_storage
int64
Storage Usage for root folder as of end date (not necessarily high water mark, which is used for billing)
deleted_files_counted_in_minimum
int64
Storage Usage for files that are deleted but uploaded within last 30 days as of end date (not necessarily high water mark, which is used for billing)
deleted_files_storage
int64
Storage Usage for files that are deleted but retained as backups as of end date (not necessarily high water mark, which is used for billing)
total_billable_usage
int64
Storage + Transfer Usage - Total Billable amount
total_billable_transfer_usage
int64
Transfer usage for period - Total Billable amount
bytes_sent
int64
Transfer Usage for period - Outbound GB from Files Native Storage
sync_bytes_received
int64
Transfer Usage for period - Inbound GB to Remote Servers (Sync/Mount)
sync_bytes_sent
int64
Transfer Usage for period - Outbound GB from Remote Servers (Sync/Mount)
usage_by_top_level_dir
array(object)
Storage Usage - map of root folders to their usage as of end date (not necessarily high water mark, which is used for billing)