Skip to main content
GET
/
usage_reports
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const usageReports = await client.usageReports.list({
  dimensions: ['string'],
  metrics: ['string'],
  product: 'product',
});

console.log(usageReports.data);
{
  "meta": {
    "total_pages": 5,
    "total_results": 100,
    "page_number": 1,
    "page_size": 20
  },
  "data": [
    {
      "product": "messaging",
      "cost": 0.012,
      "parts": 12,
      "count": 8,
      "customer_carrier_fee": 0,
      "product_name": "long_code",
      "country_iso": "LC",
      "direction": "outbound"
    },
    {
      "product": "messaging",
      "cost": 0.021,
      "parts": 21,
      "count": 12,
      "customer_carrier_fee": 0,
      "product_name": "long_code",
      "country_iso": "MP",
      "direction": "outbound"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

authorization_bearer
string

Authenticates the request with your Telnyx API V2 KEY

Query Parameters

product
string
required

Telnyx product

dimensions
string[]
required

Breakout by specified product dimensions

metrics
string[]
required

Specified product usage values

start_date
string

The start date for the time range you are interested in. The maximum time range is 31 days. Format: YYYY-MM-DDTHH:mm:ssZ

end_date
string

The end date for the time range you are interested in. The maximum time range is 31 days. Format: YYYY-MM-DDTHH:mm:ssZ

date_range
string

A more user-friendly way to specify the timespan you want to filter by. More options can be found in the Telnyx API Reference docs.

filter
string

Filter records on dimensions

managed_accounts
boolean

Return the aggregations for all Managed Accounts under the user making the request.

sort
string[]

Specifies the sort order for results

format
enum<string>

Specify the response format (csv or json). JSON is returned by default, even if not specified.

Available options:
csv,
json
page
object

Consolidated page parameter (deepObject style). Originally: page[number], page[size]

Response

Successful

meta
object
data
object[]
Example:
[
{
"product": "messaging",
"cost": 0.012,
"parts": 12,
"count": 8,
"customer_carrier_fee": 0,
"product_name": "long_code",
"country_iso": "LC",
"direction": "outbound"
},
{
"product": "messaging",
"cost": 0.021,
"parts": 21,
"count": 12,
"customer_carrier_fee": 0,
"product_name": "long_code",
"country_iso": "MP",
"direction": "outbound"
}
]