Skip to main content
POST
/
legacy_reporting
/
usage_reports
/
voice
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const voice = await client.legacy.reporting.usageReports.voice.create({
  end_time: '2024-02-01T00:00:00Z',
  start_time: '2024-02-01T00:00:00Z',
});

console.log(voice.data);
import os
from datetime import datetime
from telnyx import Telnyx

client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
voice = client.legacy.reporting.usage_reports.voice.create(
end_time=datetime.fromisoformat("2024-02-01T00:00:00"),
start_time=datetime.fromisoformat("2024-02-01T00:00:00"),
)
print(voice.data)
package main

import (
"context"
"fmt"
"time"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
voice, err := client.Legacy.Reporting.UsageReports.Voice.New(context.TODO(), telnyx.LegacyReportingUsageReportVoiceNewParams{
EndTime: time.Now(),
StartTime: time.Now(),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voice.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.legacy.reporting.usagereports.voice.VoiceCreateParams;
import com.telnyx.sdk.models.legacy.reporting.usagereports.voice.VoiceCreateResponse;
import java.time.OffsetDateTime;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

VoiceCreateParams params = VoiceCreateParams.builder()
.endTime(OffsetDateTime.parse("2024-02-01T00:00:00Z"))
.startTime(OffsetDateTime.parse("2024-02-01T00:00:00Z"))
.build();
VoiceCreateResponse voice = client.legacy().reporting().usageReports().voice().create(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

voice = telnyx.legacy.reporting.usage_reports.voice.create(
end_time: "2024-02-01T00:00:00Z",
start_time: "2024-02-01T00:00:00Z"
)

puts(voice)
<?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 {
$voice = $client->legacy->reporting->usageReports->voice->create(
endTime: new \DateTimeImmutable('2024-02-01T00:00:00Z'),
startTime: new \DateTimeImmutable('2024-02-01T00:00:00Z'),
aggregationType: 0,
connections: [123, 456],
managedAccounts: [
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'6ba7b810-9dad-11d1-80b4-00c04fd430c8',
],
productBreakdown: 0,
selectAllManagedAccounts: false,
);

var_dump($voice);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx legacy:reporting:usage-reports:voice create \
--api-key 'My API Key' \
--end-time "'2024-02-01T00:00:00Z'" \
--start-time "'2024-02-01T00:00:00Z'"
curl --request POST \
--url https://api.telnyx.com/v2/legacy_reporting/usage_reports/voice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: */*' \
--data '
{
"start_time": "2024-02-01T00:00:00Z",
"end_time": "2024-02-01T00:00:00Z",
"aggregation_type": 0,
"connections": [
123,
456
],
"product_breakdown": 0,
"managed_accounts": [
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
],
"select_all_managed_accounts": false
}
'
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "start_time": "2018-02-02T22:25:27.521Z",
    "end_time": "2018-02-02T22:25:27.521Z",
    "connections": [
      "1234567890",
      "9876543210"
    ],
    "aggregation_type": 123,
    "status": 123,
    "report_url": "http://portal.telnyx.com/downloads/report_name_8hvb45Gu.csv",
    "result": {},
    "created_at": "2018-02-02T22:25:27.521Z",
    "updated_at": "2018-02-02T22:25:27.521Z",
    "record_type": "cdr_usage_report",
    "product_breakdown": 123
  }
}

Authorizations

Authorization
string
header
required

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

Body

*/*

Cdr detail request data

Request object for CDR usage report

start_time
string<date-time>
required

Start time in ISO format

Example:

"2024-02-01T00:00:00Z"

end_time
string<date-time>
required

End time in ISO format

Example:

"2024-02-01T00:00:00Z"

aggregation_type
integer<int32>

Aggregation type: All = 0, By Connections = 1, By Tags = 2, By Billing Group = 3

Example:

0

connections
integer<int64>[]

List of connections to filter by

List of connections to filter by

Example:
[123, 456]
product_breakdown
integer<int32>

Product breakdown type: No breakdown = 0, DID vs Toll-free = 1, Country = 2, DID vs Toll-free per Country = 3

Example:

0

managed_accounts
string<uuid>[]

List of managed accounts to include

Example:
[
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
]
select_all_managed_accounts
boolean

Whether to select all managed accounts

Example:

false

Response

V2 legacy CDR usage report request created successfully

data
object

Legacy V2 CDR usage report response