api/python/telnyx-account-reports-python/SKILL.md
Generate and retrieve usage reports for billing, analytics, and reconciliation. This skill provides Python SDK examples.
npx skillsauth add team-telnyx/telnyx-toolkit telnyx-account-reports-pythonInstall 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.
pip install telnyx
import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
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 = client.legacy.reporting.batch_detail_records.messaging.list()
print(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
from datetime import datetime
messaging = client.legacy.reporting.batch_detail_records.messaging.create(
end_time=datetime.fromisoformat("2024-02-12T23:59:59"),
start_time=datetime.fromisoformat("2024-02-01T00:00:00"),
)
print(messaging.data)
Retrieves a specific MDR detailed report request by ID
GET /legacy_reporting/batch_detail_records/messaging/{id}
messaging = client.legacy.reporting.batch_detail_records.messaging.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(messaging.data)
Deletes a specific MDR detailed report request by ID
DELETE /legacy_reporting/batch_detail_records/messaging/{id}
messaging = client.legacy.reporting.batch_detail_records.messaging.delete(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(messaging.data)
Retrieves all CDR report requests for the authenticated user
GET /legacy_reporting/batch_detail_records/voice
voices = client.legacy.reporting.batch_detail_records.voice.list()
print(voices.data)
Creates a new CDR report request with the specified filters
POST /legacy_reporting/batch_detail_records/voice — Required: start_time, end_time
from datetime import datetime
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)
Retrieves a specific CDR report request by ID
GET /legacy_reporting/batch_detail_records/voice/{id}
voice = client.legacy.reporting.batch_detail_records.voice.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(voice.data)
Deletes a specific CDR report request by ID
DELETE /legacy_reporting/batch_detail_records/voice/{id}
voice = client.legacy.reporting.batch_detail_records.voice.delete(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(voice.data)
Retrieves all available fields that can be used in CDR reports
GET /legacy_reporting/batch_detail_records/voice/fields
response = client.legacy.reporting.batch_detail_records.voice.retrieve_fields()
print(response.billing)
Fetch all previous requests for MDR usage reports.
GET /legacy_reporting/usage_reports/messaging
page = client.legacy.reporting.usage_reports.messaging.list()
page = page.data[0]
print(page.id)
Creates a new legacy usage V2 MDR report request with the specified filters
POST /legacy_reporting/usage_reports/messaging
messaging = client.legacy.reporting.usage_reports.messaging.create(
aggregation_type=0,
)
print(messaging.data)
Fetch single MDR usage report by id.
GET /legacy_reporting/usage_reports/messaging/{id}
messaging = client.legacy.reporting.usage_reports.messaging.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(messaging.data)
Deletes a specific V2 legacy usage MDR report request by ID
DELETE /legacy_reporting/usage_reports/messaging/{id}
messaging = client.legacy.reporting.usage_reports.messaging.delete(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(messaging.data)
Retrieve a paginated list of telco data usage reports
GET /legacy_reporting/usage_reports/number_lookup
number_lookups = client.legacy.reporting.usage_reports.number_lookup.list()
print(number_lookups.data)
Submit a new telco data usage report
POST /legacy_reporting/usage_reports/number_lookup
number_lookup = client.legacy.reporting.usage_reports.number_lookup.create()
print(number_lookup.data)
Retrieve a specific telco data usage report by its ID
GET /legacy_reporting/usage_reports/number_lookup/{id}
number_lookup = client.legacy.reporting.usage_reports.number_lookup.retrieve(
"id",
)
print(number_lookup.data)
Delete a specific telco data usage report by its ID
DELETE /legacy_reporting/usage_reports/number_lookup/{id}
client.legacy.reporting.usage_reports.number_lookup.delete(
"id",
)
Generate and fetch speech to text usage report synchronously.
GET /legacy_reporting/usage_reports/speech_to_text
response = client.legacy.reporting.usage_reports.retrieve_speech_to_text()
print(response.data)
Fetch all previous requests for cdr usage reports.
GET /legacy_reporting/usage_reports/voice
page = client.legacy.reporting.usage_reports.voice.list()
page = page.data[0]
print(page.id)
Creates a new legacy usage V2 CDR report request with the specified filters
POST /legacy_reporting/usage_reports/voice
from datetime import datetime
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)
Fetch single cdr usage report by id.
GET /legacy_reporting/usage_reports/voice/{id}
voice = client.legacy.reporting.usage_reports.voice.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(voice.data)
Deletes a specific V2 legacy usage CDR report request by ID
DELETE /legacy_reporting/usage_reports/voice/{id}
voice = client.legacy.reporting.usage_reports.voice.delete(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(voice.data)
Fetch all messaging usage reports.
GET /reports/mdr_usage_reports
page = client.reports.mdr_usage_reports.list()
page = page.data[0]
print(page.id)
Submit request for new new messaging usage report.
POST /reports/mdr_usage_reports
from datetime import datetime
mdr_usage_report = client.reports.mdr_usage_reports.create(
aggregation_type="NO_AGGREGATION",
end_date=datetime.fromisoformat("2020-07-01T00:00:00-06:00"),
start_date=datetime.fromisoformat("2020-07-01T00:00:00-06:00"),
)
print(mdr_usage_report.data)
Fetch a single messaging usage report by id
GET /reports/mdr_usage_reports/{id}
mdr_usage_report = client.reports.mdr_usage_reports.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(mdr_usage_report.data)
Delete messaging usage report by id
DELETE /reports/mdr_usage_reports/{id}
mdr_usage_report = client.reports.mdr_usage_reports.delete(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(mdr_usage_report.data)
Generate and fetch messaging usage report synchronously.
GET /reports/mdr_usage_reports/sync
response = client.reports.mdr_usage_reports.fetch_sync(
aggregation_type="PROFILE",
)
print(response.data)
Generate and fetch voice usage report synchronously.
GET /reports/cdr_usage_reports/sync
response = client.reports.cdr_usage_reports.fetch_sync(
aggregation_type="NO_AGGREGATION",
product_breakdown="NO_BREAKDOWN",
)
print(response.data)
Get Telnyx usage data by product, broken out by the specified dimensions
GET /usage_reports
page = client.usage_reports.list(
dimensions=["string"],
metrics=["string"],
product="product",
)
page = page.data[0]
print(page)
Get the Usage Reports options for querying usage, including the products available and their respective metrics and dimensions
GET /usage_reports/options
response = client.usage_reports.get_options()
print(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.