Get Usage Reports query options (BETA)
Get the Usage Reports options for querying usage, including the products available and their respective metrics and dimensions
GET
/
usage_reports
/
options
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.usageReports.getOptions();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.usage_reports.get_options()
print(response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.UsageReports.GetOptions(context.TODO(), telnyx.UsageReportGetOptionsParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.usagereports.UsageReportGetOptionsParams;
import com.telnyx.sdk.models.usagereports.UsageReportGetOptionsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
UsageReportGetOptionsResponse response = client.usageReports().getOptions();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.usage_reports.get_options
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->usageReports->getOptions(
product: 'product', authorizationBearer: 'authorization_bearer'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx usage-reports get-options \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/usage_reports/options \
--header 'Authorization: Bearer <token>'{
"data": [
{
"product": "wireless",
"product_dimensions": [
"mnc",
"mcc",
"sim_card_id",
"sim_group_name"
],
"product_metrics": [
"uplink_data_bytes",
"downlink_data",
"downlink_data_bytes",
"uplink_data",
"data_cost"
],
"record_types": [
{
"record_type": "conversation_event",
"product_dimensions": [
"direction",
"currency",
"message_type"
],
"product_metrics": [
"cost",
"billed_sec"
]
}
]
}
]
}{
"errors": [
{
"code": "10003",
"title": "Metrics invalid values",
"detail": "Available metrics values for sip-trunking: connected,cost,completed,call_sec,attempted,billed_sec.",
"source": {
"pointer": "/title",
"parameter": "metrics"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10001"
}
}
]
}{
"errors": [
{
"code": "10003",
"title": "Metrics invalid values",
"detail": "Available metrics values for sip-trunking: connected,cost,completed,call_sec,attempted,billed_sec.",
"source": {
"pointer": "/title",
"parameter": "metrics"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10001"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Bearer token used to authenticate the request. Authenticates the request with your Telnyx API V2 KEY
Query Parameters
Options (dimensions and metrics) for a given product. If none specified, all products will be returned.
Response
Successful
An object following one of the schemas published in https://developers.telnyx.com/docs/api/v2/detail-records
Collection of product description
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.usageReports.getOptions();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.usage_reports.get_options()
print(response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.UsageReports.GetOptions(context.TODO(), telnyx.UsageReportGetOptionsParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.usagereports.UsageReportGetOptionsParams;
import com.telnyx.sdk.models.usagereports.UsageReportGetOptionsResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
UsageReportGetOptionsResponse response = client.usageReports().getOptions();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.usage_reports.get_options
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->usageReports->getOptions(
product: 'product', authorizationBearer: 'authorization_bearer'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx usage-reports get-options \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/usage_reports/options \
--header 'Authorization: Bearer <token>'{
"data": [
{
"product": "wireless",
"product_dimensions": [
"mnc",
"mcc",
"sim_card_id",
"sim_group_name"
],
"product_metrics": [
"uplink_data_bytes",
"downlink_data",
"downlink_data_bytes",
"uplink_data",
"data_cost"
],
"record_types": [
{
"record_type": "conversation_event",
"product_dimensions": [
"direction",
"currency",
"message_type"
],
"product_metrics": [
"cost",
"billed_sec"
]
}
]
}
]
}{
"errors": [
{
"code": "10003",
"title": "Metrics invalid values",
"detail": "Available metrics values for sip-trunking: connected,cost,completed,call_sec,attempted,billed_sec.",
"source": {
"pointer": "/title",
"parameter": "metrics"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10001"
}
}
]
}{
"errors": [
{
"code": "10003",
"title": "Metrics invalid values",
"detail": "Available metrics values for sip-trunking: connected,cost,completed,call_sec,attempted,billed_sec.",
"source": {
"pointer": "/title",
"parameter": "metrics"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10001"
}
}
]
}