Calculating Usage

The calculating usage page provides information on how usage is calculated for each Media API to help you estimate cost. In addition to cost information, you can view reports about your specific application usage in the Dolby.io dashboard.

Media Enhance & Music Mastering API

The Media Enhance API processes audio that is priced per minute, while the Music Mastering API masters your music that is priced per track. The Music Mastering Preview API provides a free preview of several mastering profiles.

Usage calculation example

The following table shows a possible scenario and price total using the Media Enhance API.

ScenarioCalculation
Your process three podcasts using the Enhance API—a 20.5-minute podcast, a 40.7-minute podcast, and a 50-minute podcast.(20.5 + 40.7 + 50) x (price per minute) = total price

The following table shows a possible scenario and price total using the Music Mastering API.

ScenarioCalculation
You process ten music tracks using the Music Mastering API.10 x (price per track) = total price
You process ten music tracks using the Music Mastering Preview API.10 x (price per preview) = free

Usage Reports

Dolby.io dashboard reports

You can view statistical reports for your applications using the Dolby.io dashboard.

To view and usage reports:

  1. Log into the Dolby.io dashboard.

  2. Navigate to Usage in the left menu.

  3. You can view usage summary and daily aggregate reports for your application and adjust the date range.

Realtime Usage

The Realtime Usage API returns real-time data for each Media API that your Dolby.io app uses for a specific date range. You can retrieve up to one year of data per API call. The returned data includes the following:

FieldDescription
PathThe Media API endpoint.
JobsThe number of jobs completed.
SucceededThe number of successful jobs.
FailedThe number of failed jobs.

Pagination

The real-time usage data returned might exceed the maximum results per page. When this occurs, the response includes a next_token parameter and value. This next_token parameter and value can be used in additional requests to return more results until all results are returned.

import os
import requests

# Add your API token as an environmental variable or hard coded value.
api_token = os.getenv("DOLBYIO_API_TOKEN", "your_token_here")

# Add the 'next_token' returned from a previous request as an environmental variable or hard coded value.
next_token = os.getenv("DOLBYIO_NEXT_TOKEN", "your_token_here")

url = "https://api.dolby.com/media/usage"
headers = {
    "Authorization": "Bearer {0}".format(api_token),
    "Accept": "application/json"
}

# Use YYYY-MM-DD for the date format.
payload = {'from': '2022-01-01', 'to': '2022-12-31', 'next_token': next_token}


response = requests.get(url, headers=headers, params=payload)
response.raise_for_status()
data = response.json()
const axios = require("axios").default

// Add your API token as an environmental variable or hard coded value.  
const api_token = process.env.DOLBYIO_API_TOKEN || "your_token_here"  

// Add the 'next_token' returned from a previous request as an environmental variable or hard coded value.
const next_token = process.env.DOLBYIO_NEXT_TOKEN || "your_token_here"  


// Use YYYY-MM-DD for the date format.
const config = {
  method: "get",
  url: "https://api.dolby.com/media/usage",
  headers: {
    "Authorization": `Bearer ${api_token}`,
    "Accept": "application/json"
  },
  params: {
    from: '2022-01-01',
    to: '2022-01-31',
    next_token: next_token
  }
}

axios(config)
  .then(function(response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function(error) {
    console.log(error)
  })
#!/bin/bash

# Add your API token as an environmental variable or hard coded value.
API_TOKEN=${DOLBYIO_API_TOKEN:-"your_token_here"}

# Add the 'next_token' returned from a previous request as an environmental variable or hard coded value.
NEXT_TOKEN=${DOLBYIO_NEXT_TOKEN:-"your_token_here"}


# Use YYYY-MM-DD for the date format.
curl --request GET \
     --url https://api.dolby.com/media/usage?from=2022-01-01&to=2022-01-31&next_token=$NEXT_TOKEN \
     --header 'Accept: application/json'

Code example

This code example shows you how to retrieve one month of usage data for your Dolby.io app. To specify what Dolby.io app you want to retrieve usage data for, use an API Token associated with that app when making a Realtime Usage API call.

import os
import requests

# Add your API token as an environmental variable or hard coded value.
api_token = os.getenv("DOLBYIO_API_TOKEN", "your_token_here")

url = "https://api.dolby.com/media/usage"
headers = {
    "Authorization": "Bearer {0}".format(api_token),
    "Accept": "application/json"
}

# Use YYYY-MM-DD for the date format.
payload = {'from': '2022-01-01', 'to': '2022-01-31'}


response = requests.get(url, headers=headers, params=payload)
response.raise_for_status()
data = response.json()
const axios = require("axios").default

// Add your API token as an environmental variable or hard coded value.  
const api_token = process.env.DOLBYIO_API_TOKEN || "your_token_here"  

// Use YYYY-MM-DD for the date format.
const config = {
  method: "get",
  url: "https://api.dolby.com/media/usage",
  headers: {
    "Authorization": `Bearer ${api_token}`,
    "Accept": "application/json"
  },
  params: {
    from: '2022-01-01',
    to: '2022-01-31'
  }
}

axios(config)
  .then(function(response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function(error) {
    console.log(error)
  })
#!/bin/bash

# Add your API token as an environmental variable or hard coded value.
API_TOKEN=${DOLBYIO_API_TOKEN:-"your_token_here"}

# Use YYYY-MM-DD for the date format.
curl --request GET \
     --url https://api.dolby.com/media/usage?from=2022-01-01&to=2022-01-31 \
     --header 'Accept: application/json'