Skip to main content
POST
/
legacy_reporting
/
batch_detail_records
/
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.batchDetailRecords.voice.create({
  end_time: '2024-02-12T23:59:59Z',
  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.batch_detail_records.voice.create(
    end_time=datetime.fromisoformat("2024-02-12T23:59:59"),
    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.BatchDetailRecords.Voice.New(context.TODO(), telnyx.LegacyReportingBatchDetailRecordVoiceNewParams{
		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.batchdetailrecords.voice.VoiceCreateParams;
import com.telnyx.sdk.models.legacy.reporting.batchdetailrecords.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-12T23:59:59Z"))
            .startTime(OffsetDateTime.parse("2024-02-01T00:00:00Z"))
            .build();
        VoiceCreateResponse voice = client.legacy().reporting().batchDetailRecords().voice().create(params);
    }
}
require "telnyx"

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

voice = telnyx.legacy.reporting.batch_detail_records.voice.create(
  end_time: "2024-02-12T23:59:59Z",
  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->batchDetailRecords->voice->create(
    endTime: new \DateTimeImmutable('2024-02-12T23:59:59Z'),
    startTime: new \DateTimeImmutable('2024-02-01T00:00:00Z'),
    callTypes: [1, 2],
    connections: [123, 456],
    fields: ['call_leg_id', 'start_time', 'end_time'],
    filters: [
      [
        'billingGroup' => 'adfaa016-f921-4b6c-97bb-e4c1dad231c5',
        'cld' => '+13129457420',
        'cldFilter' => 'contains',
        'cli' => '+13129457420',
        'cliFilter' => 'contains',
        'filterType' => 'and',
        'tagsList' => 'tag1',
      ],
    ],
    includeAllMetadata: true,
    managedAccounts: [
      'f47ac10b-58cc-4372-a567-0e02b2c3d479',
      '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
    ],
    recordTypes: [1, 2],
    reportName: 'My CDR Report',
    selectAllManagedAccounts: false,
    source: 'calls',
    timezone: 'UTC',
  );

  var_dump($voice);
} catch (APIException $e) {
  echo $e->getMessage();
}
telnyx legacy:reporting:batch-detail-records:voice create \
  --api-key 'My API Key' \
  --end-time "'2024-02-12T23:59:59Z'" \
  --start-time "'2024-02-01T00:00:00Z'"
curl --request POST \
  --url https://api.telnyx.com/v2/legacy_reporting/batch_detail_records/voice \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "start_time": "2024-02-01T00:00:00Z",
  "end_time": "2024-02-12T23:59:59Z",
  "timezone": "UTC",
  "call_types": [
    1,
    2
  ],
  "record_types": [
    1,
    2
  ],
  "connections": [
    123,
    456
  ],
  "report_name": "My CDR Report",
  "source": "calls",
  "include_all_metadata": true,
  "filters": [
    {
      "cli": "+13129457420",
      "cld": "+13129457420",
      "tags_list": "tag1",
      "billing_group": "adfaa016-f921-4b6c-97bb-e4c1dad231c5"
    }
  ],
  "fields": [
    "call_leg_id",
    "start_time",
    "end_time"
  ],
  "managed_accounts": [
    "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
  ],
  "select_all_managed_accounts": false
}
'
{
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "start_time": "2024-02-01T00:00:00Z",
    "end_time": "2024-02-12T23:59:59Z",
    "call_types": [
      123
    ],
    "record_types": [
      1,
      2
    ],
    "connections": [
      123,
      456
    ],
    "report_name": "My Report",
    "status": 1,
    "report_url": "<string>",
    "filters": [
      {
        "cli": "+13129457420",
        "cld": "+13129457420",
        "tags_list": "tag1",
        "billing_group": "adfaa016-f921-4b6c-97bb-e4c1dad231c5"
      }
    ],
    "created_at": "2024-02-12T14:00:00Z",
    "updated_at": "2024-02-12T14:05:00Z",
    "timezone": "<string>",
    "source": "<string>",
    "retry": 123,
    "managed_accounts": [
      "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
    ],
    "record_type": "cdr_detailed_report"
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json

CDR detailed report request data

Request object for CDR detailed 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-12T23:59:59Z"

timezone
string

Timezone for the report

Example:

"UTC"

call_types
integer<int32>[]

List of call types to filter by (Inbound = 1, Outbound = 2)

Example:
[1, 2]
record_types
integer<int32>[]

List of record types to filter by (Complete = 1, Incomplete = 2, Errors = 3)

Example:
[1, 2]
connections
integer<int64>[]

List of connections to filter by

Example:
[123, 456]
report_name
string

Name of the report

Example:

"My CDR Report"

source
string

Source of the report. Valid values: calls (default), call-control, fax-api, webrtc

Example:

"calls"

include_all_metadata
boolean

Whether to include all metadata

Example:

true

filters
object[]

List of filters to apply

fields
string[]

Set of fields to include in the report

Example:
["call_leg_id", "start_time", "end_time"]
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

CDR report request created successfully

data
object

Response object for CDR detailed report