Check out our upcoming events and meetups! View events →
Get Telnyx usage data by product, broken out by the specified dimensions
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const usageReportListResponse of client.usageReports.list({
dimensions: ['string'],
metrics: ['string'],
product: 'product',
})) {
console.log(usageReportListResponse);
}{
"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"
}
]
}Documentation Index
Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Authenticates the request with your Telnyx API V2 KEY
Telnyx product
Breakout by specified product dimensions
Specified product usage values
The start date for the time range you are interested in. The maximum time range is 31 days. Format: YYYY-MM-DDTHH:mm:ssZ
The end date for the time range you are interested in. The maximum time range is 31 days. Format: YYYY-MM-DDTHH:mm:ssZ
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 records on dimensions
Return the aggregations for all Managed Accounts under the user making the request.
Specifies the sort order for results
Specify the response format (csv or json). JSON is returned by default, even if not specified.
csv, json Consolidated page parameter (deepObject style). Originally: page[number], page[size]
Show child attributes
Successful
Show child attributes
[
{
"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"
}
]Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const usageReportListResponse of client.usageReports.list({
dimensions: ['string'],
metrics: ['string'],
product: 'product',
})) {
console.log(usageReportListResponse);
}{
"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"
}
]
}