Media Storage and File Statistics

Overview

The service provides an endpoint for retrieving statistics related to media files, including total storage used, total file counts, and file counts by media type, within a specified date range.

Authorization

Access to this endpoint requires the following authority: BACKOFFICE


Endpoints

Get Media Statistics

Method: GET

URL: /api/subaccount/statistics/media

Authorization: Required

Description: Fetches media statistics for the authenticated account and subaccount, including total storage, total media file count, and file count by media type, for a specified date range.

Query Parameters

Parameter

Type

Required

Description

from

Date

Yes

The from date of the date range. Format: yyyy-MM-dd'T'HH:mm:ssZ

to

Date

Yes

The to date of the date range. Format: yyyy-MM-dd'T'HH:mm:ssZ

storageUnit

Enum

No

The storage unit to use for reporting storage. Default: BYTES. Options: BYTES, MB, GB (case-insensitive).

Example cURL Request

curl --location --request GET '{{BASE-URL}}/api/subaccount/statistics/media?from=2022-12-01T00:00:00Z&to=2024-12-01T00:00:00Z&storageUnit=MB' \
--header 'Authorization: Bearer {{YOUR-ACCESS-TOKEN}}'

Response

Returns a JSON object containing the media statistics.

Response Fields

Field

Type

Description

totalStorage

Number

The total storage used for media, in the specified unit (e.g., bytes, MB, or GB).

totalMediaCount

Number

The total number of media files in the specified date range.

fileCountByMediaType

Object

A breakdown of file counts by media type (e.g., IMAGE, VIDEO, etc.).

storageUnit

String

The unit used to report totalStorage (e.g., BYTES, MB, or GB).

Example Response

{
  "totalStorage": 1665627784,
  "totalMediaCount": 3503,
  "fileCountByMediaType": [
    {
      "type": "VIDEO",
      "count": 3254,
      "totalSize": 1240354135
    },
    {
      "type": "IMAGE",
      "count": 220,
      "totalSize": 319024410
    },
    {
      "type": "DOCUMENT",
      "count": 11,
      "totalSize": 82269178
    },
    {
      "type": "AUDIO",
      "count": 18,
      "totalSize": 23980061
    }
  ],
  "storageUnit": "BYTES"
}

Error Handling

Status Code

Error

Description

400

Bad Request

Invalid parameters provided (e.g., missing or incorrectly formatted from/to date).

403

Forbidden

The user does not have the required authority.

500

Internal Server Error

An unexpected error occurred during processing.

Example Errors

400 Bad Request

{
  "type": "about:blank",
  "title": "Bad Request",
  "status": 400,
  "detail": "Required parameter 'endDate' is not present.",
  "instance": "/api/subaccount/statistics/media"
}

403 Forbidden

{
  "type": "about:blank",
  "title": "Forbidden",
  "status": 403,
  "detail": "User does not have the required authority.",
  "instance": "/api/subaccount/statistics/media"
}

500 Internal Server Error

{
  "type": "about:blank",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "An unexpected error occurred.",
  "instance": "/api/subaccount/statistics/media"
}

Parameters

Params:

BASE-URL:


YOUR-ACCESS-TOKEN:

Access token provided by the endpoint mentioned on this documentation: [SDK Mobile] - Generate an API Token

Last updated