api/go/telnyx-account-reports-go/SKILL.md
Generate and retrieve usage reports for billing, analytics, and reconciliation. This skill provides Go SDK examples.
npx skillsauth add team-telnyx/telnyx-toolkit telnyx-account-reports-goInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
go get github.com/team-telnyx/telnyx-go
import (
"context"
"fmt"
"os"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
client := telnyx.NewClient(
option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)
All examples below assume client is already initialized as shown above.
Retrieves all MDR detailed report requests for the authenticated user
GET /legacy_reporting/batch_detail_records/messaging
messagings, err := client.Legacy.Reporting.BatchDetailRecords.Messaging.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messagings.Data)
Creates a new MDR detailed report request with the specified filters
POST /legacy_reporting/batch_detail_records/messaging — Required: start_time, end_time
messaging, err := client.Legacy.Reporting.BatchDetailRecords.Messaging.New(context.TODO(), telnyx.LegacyReportingBatchDetailRecordMessagingNewParams{
EndTime: time.Now(),
StartTime: time.Now(),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
Retrieves a specific MDR detailed report request by ID
GET /legacy_reporting/batch_detail_records/messaging/{id}
messaging, err := client.Legacy.Reporting.BatchDetailRecords.Messaging.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
Deletes a specific MDR detailed report request by ID
DELETE /legacy_reporting/batch_detail_records/messaging/{id}
messaging, err := client.Legacy.Reporting.BatchDetailRecords.Messaging.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
Retrieves all CDR report requests for the authenticated user
GET /legacy_reporting/batch_detail_records/voice
voices, err := client.Legacy.Reporting.BatchDetailRecords.Voice.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voices.Data)
Creates a new CDR report request with the specified filters
POST /legacy_reporting/batch_detail_records/voice — Required: start_time, end_time
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)
Retrieves a specific CDR report request by ID
GET /legacy_reporting/batch_detail_records/voice/{id}
voice, err := client.Legacy.Reporting.BatchDetailRecords.Voice.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voice.Data)
Deletes a specific CDR report request by ID
DELETE /legacy_reporting/batch_detail_records/voice/{id}
voice, err := client.Legacy.Reporting.BatchDetailRecords.Voice.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voice.Data)
Retrieves all available fields that can be used in CDR reports
GET /legacy_reporting/batch_detail_records/voice/fields
response, err := client.Legacy.Reporting.BatchDetailRecords.Voice.GetFields(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Billing)
Fetch all previous requests for MDR usage reports.
GET /legacy_reporting/usage_reports/messaging
page, err := client.Legacy.Reporting.UsageReports.Messaging.List(context.TODO(), telnyx.LegacyReportingUsageReportMessagingListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
Creates a new legacy usage V2 MDR report request with the specified filters
POST /legacy_reporting/usage_reports/messaging
messaging, err := client.Legacy.Reporting.UsageReports.Messaging.New(context.TODO(), telnyx.LegacyReportingUsageReportMessagingNewParams{
AggregationType: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
Fetch single MDR usage report by id.
GET /legacy_reporting/usage_reports/messaging/{id}
messaging, err := client.Legacy.Reporting.UsageReports.Messaging.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
Deletes a specific V2 legacy usage MDR report request by ID
DELETE /legacy_reporting/usage_reports/messaging/{id}
messaging, err := client.Legacy.Reporting.UsageReports.Messaging.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
Retrieve a paginated list of telco data usage reports
GET /legacy_reporting/usage_reports/number_lookup
numberLookups, err := client.Legacy.Reporting.UsageReports.NumberLookup.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", numberLookups.Data)
Submit a new telco data usage report
POST /legacy_reporting/usage_reports/number_lookup
numberLookup, err := client.Legacy.Reporting.UsageReports.NumberLookup.New(context.TODO(), telnyx.LegacyReportingUsageReportNumberLookupNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", numberLookup.Data)
Retrieve a specific telco data usage report by its ID
GET /legacy_reporting/usage_reports/number_lookup/{id}
numberLookup, err := client.Legacy.Reporting.UsageReports.NumberLookup.Get(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", numberLookup.Data)
Delete a specific telco data usage report by its ID
DELETE /legacy_reporting/usage_reports/number_lookup/{id}
err := client.Legacy.Reporting.UsageReports.NumberLookup.Delete(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
Generate and fetch speech to text usage report synchronously.
GET /legacy_reporting/usage_reports/speech_to_text
response, err := client.Legacy.Reporting.UsageReports.GetSpeechToText(context.TODO(), telnyx.LegacyReportingUsageReportGetSpeechToTextParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
Fetch all previous requests for cdr usage reports.
GET /legacy_reporting/usage_reports/voice
page, err := client.Legacy.Reporting.UsageReports.Voice.List(context.TODO(), telnyx.LegacyReportingUsageReportVoiceListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
Creates a new legacy usage V2 CDR report request with the specified filters
POST /legacy_reporting/usage_reports/voice
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)
Fetch single cdr usage report by id.
GET /legacy_reporting/usage_reports/voice/{id}
voice, err := client.Legacy.Reporting.UsageReports.Voice.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voice.Data)
Deletes a specific V2 legacy usage CDR report request by ID
DELETE /legacy_reporting/usage_reports/voice/{id}
voice, err := client.Legacy.Reporting.UsageReports.Voice.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voice.Data)
Fetch all messaging usage reports.
GET /reports/mdr_usage_reports
page, err := client.Reports.MdrUsageReports.List(context.TODO(), telnyx.ReportMdrUsageReportListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
Submit request for new new messaging usage report.
POST /reports/mdr_usage_reports
mdrUsageReport, err := client.Reports.MdrUsageReports.New(context.TODO(), telnyx.ReportMdrUsageReportNewParams{
AggregationType: telnyx.ReportMdrUsageReportNewParamsAggregationTypeNoAggregation,
EndDate: time.Now(),
StartDate: time.Now(),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", mdrUsageReport.Data)
Fetch a single messaging usage report by id
GET /reports/mdr_usage_reports/{id}
mdrUsageReport, err := client.Reports.MdrUsageReports.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", mdrUsageReport.Data)
Delete messaging usage report by id
DELETE /reports/mdr_usage_reports/{id}
mdrUsageReport, err := client.Reports.MdrUsageReports.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", mdrUsageReport.Data)
Generate and fetch messaging usage report synchronously.
GET /reports/mdr_usage_reports/sync
response, err := client.Reports.MdrUsageReports.FetchSync(context.TODO(), telnyx.ReportMdrUsageReportFetchSyncParams{
AggregationType: telnyx.ReportMdrUsageReportFetchSyncParamsAggregationTypeProfile,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
Generate and fetch voice usage report synchronously.
GET /reports/cdr_usage_reports/sync
response, err := client.Reports.CdrUsageReports.FetchSync(context.TODO(), telnyx.ReportCdrUsageReportFetchSyncParams{
AggregationType: telnyx.ReportCdrUsageReportFetchSyncParamsAggregationTypeNoAggregation,
ProductBreakdown: telnyx.ReportCdrUsageReportFetchSyncParamsProductBreakdownNoBreakdown,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
Get Telnyx usage data by product, broken out by the specified dimensions
GET /usage_reports
page, err := client.UsageReports.List(context.TODO(), telnyx.UsageReportListParams{
Dimensions: []string{"string"},
Metrics: []string{"string"},
Product: "product",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
Get the Usage Reports options for querying usage, including the products available and their respective metrics and dimensions
GET /usage_reports/options
response, err := client.UsageReports.GetOptions(context.TODO(), telnyx.UsageReportGetOptionsParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
tools
Build cross-platform VoIP calling apps with React Native using Telnyx Voice SDK. High-level reactive API with automatic lifecycle management, CallKit/ConnectionService integration, and push notifications. Use for mobile VoIP apps with minimal setup.
tools
Build browser-based VoIP calling apps using Telnyx WebRTC JavaScript SDK. Covers authentication, voice calls, events, debugging, call quality metrics, and AI Agent integration. Use for web-based real-time communication.
tools
Build VoIP calling apps on iOS using Telnyx WebRTC SDK. Covers authentication, making/receiving calls, CallKit integration, PushKit/APNS push notifications, call quality metrics, and AI Agent integration. Use when implementing real-time voice communication on iOS.
tools
Build cross-platform VoIP calling apps with Flutter using Telnyx WebRTC SDK. Covers authentication, making/receiving calls, push notifications (FCM + APNS), call quality metrics, and AI Agent integration. Works on Android, iOS, and Web.