telnyx-messaging-go
>-
telnyx-account-reports-python
Generate and retrieve usage reports for billing, analytics, and reconciliation. This skill provides Python SDK examples.
Full skill instructions
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)
>-
>-
>-
>-
>-
Register for 10DLC as a sole proprietor to enable SMS messaging in the USA. Use when setting up A2P SMS, registering brands/campaigns, or assigning phone numbers for compliant US messaging. Requires Telnyx CLI.
>-
>-
Text-to-vector embeddings and semantic search using Telnyx AI. Generate embedding vectors via an OpenAI-compatible API — no OpenAI or Google API keys required.
>-
Semantic search and Q&A over workspace files using Telnyx Storage + AI embeddings. Index your memory, knowledge, and skills for natural language retrieval and AI-powered answers.
>-
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience