Skip to content
Start here

Storage use

client.Stream.Videos.StorageUsage(ctx, params) (*VideoStorageUsageResponse, error)
GET/accounts/{account_id}/stream/storage-usage

Returns information about an account's storage use.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Stream WriteStream Read
ParametersExpand Collapse
params VideoStorageUsageParams
AccountID param.Field[string]

Path param: The account identifier tag.

maxLength32
Creator param.Field[string]optional

Query param: A user-defined identifier for the media creator.

maxLength64
ReturnsExpand Collapse
type VideoStorageUsageResponse struct{…}
Creator stringoptional

A user-defined identifier for the media creator.

maxLength64
TotalStorageMinutes int64optional

The total minutes of video content stored in the account.

TotalStorageMinutesLimit int64optional

The storage capacity alloted for the account.

VideoCount int64optional

The total count of videos associated with the account.

Storage use

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/stream"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.Stream.Videos.StorageUsage(context.TODO(), stream.VideoStorageUsageParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.VideoCount)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "creator": "creator-id_abcde12345",
    "totalStorageMinutes": 0,
    "totalStorageMinutesLimit": 0,
    "videoCount": 0
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "creator": "creator-id_abcde12345",
    "totalStorageMinutes": 0,
    "totalStorageMinutesLimit": 0,
    "videoCount": 0
  }
}