telnyx-account-java
Original:🇺🇸 English
Translated
Manage account balance, payments, invoices, webhooks, and view audit logs and detail records. This skill provides Java SDK examples.
2installs
Sourceteam-telnyx/skills
Added on
NPX Install
npx skill4agent add team-telnyx/skills telnyx-account-javaTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
— Required:
Telnyx Account - Java
Installation
text
<!-- Maven -->
<dependency>
<groupId>com.telnyx.sdk</groupId>
<artifactId>telnyx</artifactId>
<version>6.36.0</version>
</dependency>
// Gradle
implementation("com.telnyx.sdk:telnyx:6.36.0")Setup
java
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
TelnyxClient client = TelnyxOkHttpClient.fromEnv();All examples below assume is already initialized as shown above.
clientError Handling
All API calls can fail with network errors, rate limits (429), validation errors (422),
or authentication errors (401). Always handle errors in production code:
java
import com.telnyx.sdk.errors.TelnyxServiceException;
try {
var result = client.messages().send(params);
} catch (TelnyxServiceException e) {
System.err.println("API error " + e.statusCode() + ": " + e.getMessage());
if (e.statusCode() == 422) {
System.err.println("Validation error — check required fields and formats");
} else if (e.statusCode() == 429) {
// Rate limited — wait and retry with exponential backoff
Thread.sleep(1000);
}
}Common error codes: invalid API key, insufficient permissions,
resource not found, validation error (check field formats),
rate limited (retry with exponential backoff).
401403404422429Important Notes
- Pagination: List methods return a page. Use for automatic iteration:
.autoPager(). For manual control, usefor (var item : page.autoPager()) { ... }and.hasNextPage()..nextPage()
List Audit Logs
Retrieve a list of audit log entries. Audit logs are a best-effort, eventually consistent record of significant account-related changes.
GET /audit_eventsjava
import com.telnyx.sdk.models.auditevents.AuditEventListPage;
import com.telnyx.sdk.models.auditevents.AuditEventListParams;
AuditEventListPage page = client.auditEvents().list();Returns: (string | null), (enum: telnyx, account_manager, account_owner, organization_member), (string), (array | null), (date-time), (uuid), (uuid), (string), (string), (uuid)
alternate_resource_idchange_made_bychange_typechangescreated_atidorganization_idrecord_typeresource_iduser_idGet user balance details
GET /balancejava
import com.telnyx.sdk.models.balance.BalanceRetrieveParams;
import com.telnyx.sdk.models.balance.BalanceRetrieveResponse;
BalanceRetrieveResponse balance = client.balance().retrieve();Returns: (string), (string), (string), (string), (string), (enum: balance)
available_creditbalancecredit_limitcurrencypendingrecord_typeGet monthly charges breakdown
Retrieve a detailed breakdown of monthly charges for phone numbers in a specified date range. The date range cannot exceed 31 days.
GET /charges_breakdownjava
import com.telnyx.sdk.models.chargesbreakdown.ChargesBreakdownRetrieveParams;
import com.telnyx.sdk.models.chargesbreakdown.ChargesBreakdownRetrieveResponse;
import java.time.LocalDate;
ChargesBreakdownRetrieveParams params = ChargesBreakdownRetrieveParams.builder()
.startDate(LocalDate.parse("2025-05-01"))
.build();
ChargesBreakdownRetrieveResponse chargesBreakdown = client.chargesBreakdown().retrieve(params);Returns: (string), (date), (array[object]), (date), (email), (string)
currencyend_dateresultsstart_dateuser_emailuser_idGet monthly charges summary
Retrieve a summary of monthly charges for a specified date range. The date range cannot exceed 31 days.
GET /charges_summaryjava
import com.telnyx.sdk.models.chargessummary.ChargesSummaryRetrieveParams;
import com.telnyx.sdk.models.chargessummary.ChargesSummaryRetrieveResponse;
import java.time.LocalDate;
ChargesSummaryRetrieveParams params = ChargesSummaryRetrieveParams.builder()
.endDate(LocalDate.parse("2025-06-01"))
.startDate(LocalDate.parse("2025-05-01"))
.build();
ChargesSummaryRetrieveResponse chargesSummary = client.chargesSummary().retrieve(params);Returns: (string), (date), (date), (object), (object), (email), (string)
currencyend_datestart_datesummarytotaluser_emailuser_idSearch detail records
Search for any detail record across the Telnyx Platform
GET /detail_recordsjava
import com.telnyx.sdk.models.detailrecords.DetailRecordListPage;
import com.telnyx.sdk.models.detailrecords.DetailRecordListParams;
DetailRecordListPage page = client.detailRecords().list();Returns: (string), (string), (string), (string), (date-time), (string), (string), (date-time), (string), (string), (string), (string), (enum: inbound, outbound), (array[string]), (boolean), (string), (enum: SMS, MMS, RCS), (string), (boolean), (integer), (string), (string), (string), (string), (date-time), (string), (enum: gw_timeout, delivered, dlr_unconfirmed, dlr_timeout, received, gw_reject, failed), (string), (date-time), (string), (string)
carriercarrier_feecldclicompleted_atcostcountry_codecreated_atcurrencydelivery_statusdelivery_status_failover_urldelivery_status_webhook_urldirectionerrorsfteumccmessage_typemncon_netpartsprofile_idprofile_nameraterecord_typesent_atsource_country_codestatustagsupdated_atuser_iduuidList invoices
Retrieve a paginated list of invoices.
GET /invoicesjava
import com.telnyx.sdk.models.invoices.InvoiceListPage;
import com.telnyx.sdk.models.invoices.InvoiceListParams;
InvoiceListPage page = client.invoices().list();Returns: (uuid), (uuid), (boolean), (date), (date), (uri)
file_idinvoice_idpaidperiod_endperiod_starturlGet invoice by ID
Retrieve a single invoice by its unique identifier.
GET /invoices/{id}java
import com.telnyx.sdk.models.invoices.InvoiceRetrieveParams;
import com.telnyx.sdk.models.invoices.InvoiceRetrieveResponse;
InvoiceRetrieveResponse invoice = client.invoices().retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");Returns: (uri), (uuid), (uuid), (boolean), (date), (date), (uri)
download_urlfile_idinvoice_idpaidperiod_endperiod_starturlList auto recharge preferences
Returns the payment auto recharge preferences.
GET /payment/auto_recharge_prefsjava
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefListParams;
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefListResponse;
AutoRechargePrefListResponse autoRechargePrefs = client.payment().autoRechargePrefs().list();Returns: (boolean), (string), (boolean), (enum: credit_paypal, ach), (string), (string), (string)
enabledidinvoice_enabledpreferencerecharge_amountrecord_typethreshold_amountUpdate auto recharge preferences
Update payment auto recharge preferences.
PATCH /payment/auto_recharge_prefsOptional: (boolean), (boolean), (enum: credit_paypal, ach), (string), (string)
enabledinvoice_enabledpreferencerecharge_amountthreshold_amountjava
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefUpdateParams;
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefUpdateResponse;
AutoRechargePrefUpdateResponse autoRechargePref = client.payment().autoRechargePrefs().update();Returns: (boolean), (string), (boolean), (enum: credit_paypal, ach), (string), (string), (string)
enabledidinvoice_enabledpreferencerecharge_amountrecord_typethreshold_amountList User Tags
List all user tags.
GET /user_tagsjava
import com.telnyx.sdk.models.usertags.UserTagListParams;
import com.telnyx.sdk.models.usertags.UserTagListResponse;
UserTagListResponse userTags = client.userTags().list();Returns: (array[string]), (array[string])
number_tagsoutbound_profile_tagsCreate a stored payment transaction
POST /v2/payment/stored_payment_transactionsamountjava
import com.telnyx.sdk.models.payment.PaymentCreateStoredPaymentTransactionParams;
import com.telnyx.sdk.models.payment.PaymentCreateStoredPaymentTransactionResponse;
PaymentCreateStoredPaymentTransactionParams params = PaymentCreateStoredPaymentTransactionParams.builder()
.amount("120.00")
.build();
PaymentCreateStoredPaymentTransactionResponse response = client.payment().createStoredPaymentTransaction(params);Returns: (integer), (string), (boolean), (date-time), (string), (string), (enum: transaction), (enum: stored_payment)
amount_centsamount_currencyauto_rechargecreated_atidprocessor_statusrecord_typetransaction_processing_typeList webhook deliveries
Lists webhook_deliveries for the authenticated user
GET /webhook_deliveriesjava
import com.telnyx.sdk.models.webhookdeliveries.WebhookDeliveryListPage;
import com.telnyx.sdk.models.webhookdeliveries.WebhookDeliveryListParams;
WebhookDeliveryListPage page = client.webhookDeliveries().list();Returns: (array[object]), (date-time), (uuid), (string), (date-time), (enum: delivered, failed), (uuid), (object)
attemptsfinished_atidrecord_typestarted_atstatususer_idwebhookFind webhook_delivery details by ID
Provides webhook_delivery debug data, such as timestamps, delivery status and attempts.
GET /webhook_deliveries/{id}java
import com.telnyx.sdk.models.webhookdeliveries.WebhookDeliveryRetrieveParams;
import com.telnyx.sdk.models.webhookdeliveries.WebhookDeliveryRetrieveResponse;
WebhookDeliveryRetrieveResponse webhookDelivery = client.webhookDeliveries().retrieve("C9C0797E-901D-4349-A33C-C2C8F31A92C2");Returns: (array[object]), (date-time), (uuid), (string), (date-time), (enum: delivered, failed), (uuid), (object)
attemptsfinished_atidrecord_typestarted_atstatususer_idwebhook