Skip to main content

Get Telnyx product usage data (BETA)

GET 
/usage_reports

Get Telnyx usage data by product, broken out by the specified dimensions

Request

Query Parameters

    product stringrequired

    Telnyx product

    Examples:
    dimensions string[]required

    Breakout by specified product dimensions

    Examples:
    metrics string[]required

    Specified product usage values

    Examples:
    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

    Examples:
    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

    Examples:
    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.

    Examples:
    filter string

    Filter records on dimensions

    Examples:
    managed_accounts boolean

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

    Examples:
    page[number] Page[Number]

    Possible values: > 1

    Default value: 1

    page[size] Page[Size]

    Possible values: <= 5000

    Default value: 20

    sort string[]

    Specifies the sort order for results

    Examples:
    format string

    Possible values: [csv, json]

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

    Examples:

Header Parameters

    Authorization: Bearer <TOKEN> string

Responses

200: Successful

400: Bad Request

500: Internal Server Error

Request samples


curl -L 'https://api.telnyx.com/v2/usage_reports' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'

Response samples


{
"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"
}
]
}