TextVerified Python Client

Python wrapper for the TextVerified API.

Installation

pip install textverified

Quick Start

from textverified import TextVerified

client = TextVerified(api_key="your_key", api_username="your_username")
services = client.services.list()

API Reference

TextVerified Python Client

This package provides a Python interface to the TextVerified API. You can either use the TextVerified class directly to manage multiple credentials or access API endpoints statically.

Example usage:

from textverified import services, verifications # or from textverified import TextVerified client = TextVerified(api_key=”…”, api_username=”…”)

class TextVerified(api_key: str, api_username: str, base_url: str = 'https://www.textverified.com', user_agent: str = 'TextVerified-Python-Client/0.1.0', test_mode: TestMode | None = None)[source]

Bases: _ActionPerformer

API Context for interacting with the Textverified API.

api_key: str
api_username: str
base_url: str = 'https://www.textverified.com'
user_agent: str = 'TextVerified-Python-Client/0.1.0'
test_mode: TestMode | None = None
property account: AccountAPI
property billing_cycles: BillingCycleAPI
property reservations: ReservationsAPI
property sales: SalesAPI
property services: ServicesAPI
property verifications: VerificationsAPI
property wake_requests: WakeAPI
property sms: SMSApi
property calls: CallAPI
refresh_bearer()[source]

Refresh the bearer token, if expired. Called automatically before performing actions.

class PaginatedList(request_json: dict, parse_item: Callable[[dict], T], api_context: _ActionPerformer)[source]

Bases: Generic[T], Iterator[T]

Handles paginated API responses, allowing iteration over items and fetching additional pages as needed. You should not need to instantiate this class directly; use the API methods that return it instead.

Supports iteration and indexing, allowing you to access items as if it were a regular list. To exhaust all items, iterate over it using list(paginated_list) or call paginated_list.get_all_items().

get_all_items() → List[T][source]

Get all items in the paginated list, fetching all pages if necessary.

Returns:

A list of all items in the paginated list.

Return type:

List[T]

exception TextVerifiedError(error_code: str, error_description: str, context: str = '')[source]

Bases: Exception

Server-side API Errors.

error_code: str
error_description: str
context: str = ''
configure(api_key: str, api_username: str, base_url: str = 'https://www.textverified.com', user_agent: str = 'TextVerified-Python-Client/0.1.0', test_mode=None) → None[source]

Configure the static TextVerified instance.

set_test_mode(mode: TestMode) → None[source]

Set the global server-backed test scenario.

Pass a TestMode value. Use TestMode.LIVE for ordinary API behavior. Direct assignment to textverified.test_mode is also supported.

class TestMode(value)[source]

Bases: Enum

Live operation and server-backed Phoneblur test scenarios.

Each value is the documented test_* service name understood by the Phoneblur API. Use a scenario only with the verification or rental routes that support it.

LIVE = 'live'
MOCK_SUCCESS = 'test_success'
MOCK_RENEWABLE_EXPIRED = 'test_renewable_expired'
MOCK_NONRENEWABLE_EXPIRED = 'test_nonrenewable_expired'
MOCK_DELAYED_SUCCESS = 'test_delayed_success'
MOCK_PENDING = 'test_pending'
MOCK_INSUFFICIENT_BALANCE = 'test_insufficient_balance'
MOCK_NO_NUMBERS = 'test_no_numbers'
MOCK_TOO_MANY_UNFINISHED_VERIFICATIONS = 'test_too_many_unfinished_verifications'
MOCK_TIMEOUT = 'test_timeout'
MOCK_REACTIVATABLE = 'test_reactivatable'
MOCK_BACKORDER = 'test_backorder'
class AccountAPI(client: _ActionPerformer)[source]

Bases: object

API endpoints related to account management.

me() → Account[source]
Returns:

The current account details.

Return type:

Account

property balance: float

Get the current account balance.

property username: str

Get the current account username.

class BillingCycleAPI(client: _ActionPerformer)[source]

Bases: object

API endpoints related to billing cycles. Renewable rentals are associated with billing cycles and can be manually assigned on rental creation or automatically assigned. A single billing cycle can have multiple renewable rentals. Billing cycles can be updated, renewed, and queried for invoices.

list() → PaginatedList[BillingCycleCompact][source]

Fetch all billing cycles associated with this account.

get(billing_cycle_id: str) → BillingCycleExpanded[source]

Get the details of a billing cycle by ID.

Parameters:

billing_cycle_id (str) – The ID of the billing cycle to retrieve.

Returns:

The detailed information about the billing cycle.

Return type:

BillingCycleExpanded

update(billing_cycle: str | BillingCycleCompact | BillingCycleExpanded, data: BillingCycleUpdateRequest = None, *, reminders_enabled: bool = None, nickname: str = None) → bool[source]

Update a billing cycle.

Parameters:
  • billing_cycle (Union[str, BillingCycleCompact, BillingCycleExpanded]) – The ID or instance of the billing cycle to update.

  • data (BillingCycleUpdateRequest, optional) – Data to update. Overwritten by kwargs. Defaults to None.

  • reminders_enabled (bool, optional) – Whether email reminders are enabled. Defaults to None.

  • nickname (str, optional) – Your custom string to identify the billing cycle. Defaults to None.

Raises:

ValueError – If billing_cycle is not a valid ID or instance, or if no fields are provided to update.

Returns:

True if the update was successful, False otherwise.

Return type:

bool

invoices(billing_cycle_id: str | BillingCycleCompact | BillingCycleExpanded) → PaginatedList[BillingCycleRenewalInvoice][source]

Get invoices for a specific billing cycle.

Parameters:

billing_cycle_id (Union[str, BillingCycleCompact, BillingCycleExpanded]) – The ID or instance of the billing cycle to retrieve invoices for.

Raises:

ValueError – If billing_cycle_id is not a valid ID or instance.

Returns:

A paginated list of billing cycle renewal invoices.

Return type:

PaginatedList[BillingCycleRenewalInvoice]

preview(billing_cycle_id: str | BillingCycleCompact | BillingCycleExpanded) → BillingCycleRenewalInvoice[source]

Preview the next billing cycle invoice.

Parameters:

billing_cycle_id (Union[str, BillingCycleCompact, BillingCycleExpanded]) – The ID or instance of the billing cycle to preview.

Raises:

ValueError – If billing_cycle_id is not a valid ID or instance.

Returns:

The preview of the next billing cycle invoice.

Return type:

BillingCycleRenewalInvoice

renew(billing_cycle_id: str | BillingCycleCompact | BillingCycleExpanded) → bool[source]

Renew the active rentals on your billing cycle. Will not renew overdue rentals. To renew overdue rentals, you must explicitly call textverified.reservations.renew_overdue_renewable_reservation on each overdue rental.

Parameters:

billing_cycle_id (Union[str, BillingCycleCompact, BillingCycleExpanded]) – The ID or instance of the billing cycle to renew.

Raises:

ValueError – If billing_cycle_id is not a valid ID or instance.

Returns:

True if the billing cycle was renewed successfully, False otherwise.

Return type:

bool

class ReservationsAPI(client: _ActionPerformer)[source]

Bases: object

API endpoints related to reservations. This includes both renewable and non-renewable rentals, as well as backorder reservations.

Note that reservations which are not always-on require a wakeup to receive sms. To wake a resrvation, use textverified.wake_requests.create_wake_request(…).

create(data: NewRentalRequest = None, *, allow_back_order_reservations: bool = None, always_on: bool = None, area_code_select_option: List[str] = None, duration: RentalDuration = None, is_renewable: bool = None, number_type: NumberType = None, billing_cycle_id_to_assign_to: str = None, service_name: str = None, capability: ReservationCapability = None, test=None) → ReservationSaleExpanded[source]

Purchase a new rental. Returns a ReservationSaleExpanded, which contains a list of reservations and backorder reservations. You will need to call .details(obj) on each reservation to get its full details.

service_name can be found by calling textverified.ServiceAPI.get_services().

This will cost api balance, so ensure you have sufficient funds before calling this method. To estimate the cost, use get_rental_pricing() with the same parameters. You can pass the same NewRentalRequest object to both methods.

Parameters:
  • data (NewRentalRequest, optional) – The rental details to create. All kwargs will overwrite values in this object. Defaults to None.

  • allow_back_order_reservations (bool, optional) – If true, a rental back order will be created if the requested rental is out of stock. Defaults to None.

  • always_on (bool, optional) – If set to true, a line that does not require wake up will be assigned if in stock. Otherwise, wakeup will be required. Defaults to None.

  • area_code_select_option (List[str], optional) – List of allowed area codes. Defaults to None.

  • duration (RentalDuration, optional) – Requested duration of the rental. Defaults to None.

  • is_renewable (bool, optional) – Whether the rental is renewable. Defaults to None.

  • number_type (NumberType, optional) – The underlying type of the number. Defaults to None.

  • billing_cycle_id_to_assign_to (str, optional) – Optional billing cycle to which the rental is assigned. If left empty, a new billing cycle will be created for the rental. Only renewable rentals can be assigned to a billing cycle. Defaults to None.

  • service_name (str, optional) – Name of the service. Defaults to None.

  • capability (ReservationCapability, optional) – The capabilities (voice, sms, or both) of this rental. Defaults to None.

Raises:

ValueError – If any required fields are missing or invalid.

Returns:

The details of the created rental reservation.

Return type:

ReservationSaleExpanded

pricing(data: NewRentalRequest | RentalPriceCheckRequest = None, *, service_name: str = None, area_code: bool = None, number_type: NumberType = None, capability: ReservationCapability = None, always_on: bool = None, call_forwarding: bool = None, billing_cycle_id_to_assign_to: str = None, is_renewable: bool = None, duration: RentalDuration = None, test=None) → PricingSnapshot[source]

Get rental pricing information for a potential rental reservation.

This method allows you to check the cost of a rental before purchasing it. You can pass the a NewRentalRequest to verify the pricing for that specific configuration before creating it, or provide individual parameters to check pricing for a specific service, area code, capability, or number type.

Parameters:
  • data (Union[NewRentalRequest, RentalPriceCheckRequest], optional) – The rental details to price. All kwargs will overwrite values in this object. Defaults to None.

  • service_name (str, optional) – Name of the service. Defaults to None.

  • area_code (bool, optional) – Whether to request a specific area code. Defaults to None.

  • number_type (NumberType, optional) – The underlying type of the number. Defaults to None.

  • capability (ReservationCapability, optional) – The capabilities (voice, sms, or both) of this rental. Defaults to None.

  • always_on (bool, optional) – If set to true, a line that does not require wake up will be assigned if in stock. Defaults to None.

  • call_forwarding (bool, optional) – Whether call forwarding is enabled. Defaults to None.

  • billing_cycle_id_to_assign_to (str, optional) – Optional billing cycle to which the rental would be assigned. Defaults to None.

  • is_renewable (bool, optional) – Whether the rental is renewable. Defaults to None.

  • duration (RentalDuration, optional) – Requested duration of the rental. Defaults to None.

Raises:

ValueError – If any required fields are missing or invalid.

Returns:

The pricing information for the requested rental configuration.

Return type:

PricingSnapshot

backorder(reservation_id: str | BackOrderReservationCompact | BackOrderReservationExpanded) → BackOrderReservationExpanded[source]

Get details of a backorder reservation by ID.

Parameters:

reservation_id (Union[str, BackOrderReservationCompact, BackOrderReservationExpanded]) – The ID or instance of the backorder reservation to retrieve.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

The detailed information about the backorder reservation.

Return type:

BackOrderReservationExpanded

details(reservation_id: str | Reservation | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → RenewableRentalExpanded | NonrenewableRentalExpanded[source]

Get detailed information about a reservation (renewable or non-renewable).

Parameters:

reservation_id (Union[str, RenewableRentalCompact, RenewableRentalExpanded, NonrenewableRentalCompact, NonrenewableRentalExpanded]) – The ID or instance of the reservation to retrieve.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

The detailed information about the reservation. Type depends on whether the reservation is renewable or not.

Return type:

Union[RenewableRentalExpanded, NonrenewableRentalExpanded]

list_renewable() → PaginatedList[RenewableRentalCompact][source]

Get a paginated list of all renewable reservations associated with this account.

Returns:

A paginated list of renewable rental reservations.

Return type:

PaginatedList[RenewableRentalCompact]

list_nonrenewable() → PaginatedList[NonrenewableRentalCompact][source]

Get a paginated list of all non-renewable reservations associated with this account.

Returns:

A paginated list of non-renewable rental reservations.

Return type:

PaginatedList[NonrenewableRentalCompact]

renewable_details(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded) → RenewableRentalExpanded[source]

Get detailed information about a renewable reservation by ID.

Parameters:

reservation_id (Union[str, RenewableRentalCompact, RenewableRentalExpanded]) – The ID or instance of the renewable reservation to retrieve.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

The detailed information about the renewable reservation.

Return type:

RenewableRentalExpanded

nonrenewable_details(reservation_id: str | NonrenewableRentalCompact | NonrenewableRentalExpanded) → NonrenewableRentalExpanded[source]

Get detailed information about a non-renewable reservation by ID.

Parameters:

reservation_id (Union[str, NonrenewableRentalCompact, NonrenewableRentalExpanded]) – The ID or instance of the non-renewable reservation to retrieve.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

The detailed information about the non-renewable reservation.

Return type:

NonrenewableRentalExpanded

check_health(reservation_id: str | Reservation | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → LineHealth[source]

Check the health status of a reservation.

Parameters:

reservation_id (Union[str, RenewableRentalCompact, RenewableRentalExpanded, NonrenewableRentalCompact, NonrenewableRentalExpanded]) – The ID or instance of the reservation to check.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

The health status information for the reservation.

Return type:

LineHealth

user_notes(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → RentalUserNotes[source]

Get the user notes for a rental.

reactivation_cost(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → RentalReactivationCost[source]

Get the current cost to reactivate an expired rental.

reactivate(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded, data: RentalReactivationRequest = None, *, max_price: float = None) → bool[source]

Attempt to reactivate an expired rental, up to max_price.

search_tags(data: RentalTagsSearch = None, *, reservation_ids: List[str] = None) → PaginatedList[RentalTags][source]

Return tags for up to 500 supplied rental reservation IDs.

billing_cycle_upgrade_options(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → List[RentalDuration][source]

List billing-cycle durations available for a rental upgrade.

schedule_billing_cycle_upgrade(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded, data: RentalBillingCycleUpgradeRequest = None, *, desired_duration: RentalDuration = None) → RentalBillingCycleUpgrade[source]

Schedule a billing-cycle upgrade for a rental.

billing_cycle_upgrade(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → RentalBillingCycleUpgrade[source]

Get a rental’s pending billing-cycle upgrade.

cancel_billing_cycle_upgrade(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded, job_id: str) → bool[source]

Cancel a pending billing-cycle upgrade.

update_renewable(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded, data: RenewableRentalUpdateRequest = None, *, user_notes: str = None, include_for_renewal: bool = None, mark_all_sms_read: bool = None, tags: List[str] = None) → bool[source]

Update properties of a renewable reservation.

Parameters:
  • reservation_id (Union[str, RenewableRentalCompact, RenewableRentalExpanded]) – The ID or instance of the renewable reservation to update.

  • data (RenewableRentalUpdateRequest, optional) – Data to update. All kwargs will overwrite values in this object. Defaults to None.

  • user_notes (str, optional) – Custom notes for the reservation. Defaults to None.

  • include_for_renewal (bool, optional) – Whether to include this reservation in automatic renewals. Defaults to None.

  • mark_all_sms_read (bool, optional) – Whether to mark all SMS messages as read. Defaults to None.

  • tags (List[str], optional) – Tags to replace on the reservation. An empty list clears all tags. Defaults to None.

Raises:

ValueError – If reservation_id is not valid or if no fields are provided to update.

Returns:

True if the update was successful, False otherwise.

Return type:

bool

update_nonrenewable(reservation_id: str | NonrenewableRentalCompact | NonrenewableRentalExpanded, data: NonrenewableRentalUpdateRequest = None, *, user_notes: str = None, mark_all_sms_read: bool = None, tags: List[str] = None) → bool[source]

Update properties of a non-renewable reservation.

Parameters:
  • reservation_id (Union[str, NonrenewableRentalCompact, NonrenewableRentalExpanded]) – The ID or instance of the non-renewable reservation to update.

  • data (NonrenewableRentalUpdateRequest, optional) – Data to update. All kwargs will overwrite values in this object. Defaults to None.

  • user_notes (str, optional) – Custom notes for the reservation. Defaults to None.

  • mark_all_sms_read (bool, optional) – Whether to mark all SMS messages as read. Defaults to None.

  • tags (List[str], optional) – Tags to replace on the reservation. An empty list clears all tags. Defaults to None.

Raises:

ValueError – If reservation_id is not valid or if no fields are provided to update.

Returns:

True if the update was successful, False otherwise.

Return type:

bool

refund_renewable(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded) → bool[source]

Request a refund for a renewable reservation.

Parameters:

reservation_id (Union[str, RenewableRentalCompact, RenewableRentalExpanded]) – The ID or instance of the renewable reservation to refund.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

True if the refund request was successful, False otherwise.

Return type:

bool

refund_nonrenewable(reservation_id: str | NonrenewableRentalCompact | NonrenewableRentalExpanded) → bool[source]

Request a refund for a non-renewable reservation.

Parameters:

reservation_id (Union[str, NonrenewableRentalCompact, NonrenewableRentalExpanded]) – The ID or instance of the non-renewable reservation to refund.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

True if the refund request was successful, False otherwise.

Return type:

bool

renew_overdue(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded) → bool[source]

Renew an overdue renewable reservation.

This will cost api balance, so ensure you have sufficient funds before calling this method.

This method is used to manually renew individual overdue renewable reservations. For bulk renewal of active rentals, use the billing cycle renewal method instead.

Parameters:

reservation_id (Union[str, RenewableRentalCompact, RenewableRentalExpanded]) – The ID or instance of the overdue renewable reservation to renew.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

True if the renewal was successful, False otherwise.

Return type:

bool

extend_nonrenewable(data: RentalExtensionRequest = None, *, extension_duration: RentalDuration = None, rental_id: str | NonrenewableRentalCompact | NonrenewableRentalExpanded = None) → bool[source]

Extend the duration of a non-renewable reservation.

This will cost api balance, so ensure you have sufficient funds before calling this method.

Parameters:
Raises:

ValueError – If both extension_duration and rental_id are not provided.

Returns:

True if the extension was successful, False otherwise.

Return type:

bool

class SalesAPI(client: _ActionPerformer)[source]

Bases: object

API endpoints related to sales. Sales are created when a reservation or verification is sold, and can be queried for details.

list() → PaginatedList[ReservationSaleCompact][source]

Fetch all sales associated with this account.

Returns:

A paginated list of sales.

Return type:

PaginatedList[ReservationSaleCompact]

get(sale_id: str | ReservationSaleCompact | ReservationSaleExpanded) → ReservationSaleExpanded[source]

Retrieve details of a specific sale

Parameters:

sale_id (Union[str, ReservationSaleCompact, ReservationSaleExpanded]) – The ID or instance of the sale to retrieve.

Raises:

ValueError – If sale_id is not a valid ID or instance.

Returns:

The details of the requested sale.

Return type:

ReservationSaleExpanded

class ServicesAPI(client: _ActionPerformer)[source]

Bases: object

API endpoints related to services and area codes. This includes fetching available area codes and services for rental or verification.

Please fetch area codes and services, as we update our available area codes and services frequently.

area_codes() → List[AreaCode][source]

Fetch all area codes available for rental or verification services, and their associated US state.

Returns:

A list of area codes with their associated US state.

Return type:

List[AreaCode]

list(number_type: NumberType, reservation_type: ReservationType) → List[Service][source]

Fetch all services available for rental or verification.

Special cases: Use ‘allservices’ (rentals) or ‘servicenotlisted’ (verifications), note that ‘servicenotlisted’ only receives sms from services that are not listed by us.

Parameters:
  • number_type (NumberType) – The type of number. Most frequently NumberType.MOBILE.

  • reservation_type (ReservationType) – The type of reservation (e.g., renewable, nonrenewable, verification).

Returns:

A list of services available for rental or verification.

Return type:

List[Service]

rental_inventory(data: RentalInventoryCheckRequest = None, *, duration: RentalDuration = None, number_type: NumberType = None, service_name: str = None, capability: ReservationCapability = None, test=None) → InventoryQuantity[source]

Get available inventory for a rental configuration.

data may be supplied instead of individual arguments; explicit arguments take precedence over its values.

verification_inventory(data: VerificationInventoryCheckRequest = None, *, number_type: NumberType = None, service_name: str = None, capability: ReservationCapability = None, test=None) → InventoryQuantity[source]

Get available inventory for a verification configuration.

data may be supplied instead of individual arguments; explicit arguments take precedence over its values.

class SMSApi(client: _ActionPerformer)[source]

Bases: object

API endpoints related to SMS This includes listing SMS messages for rentals and verifications, as well as handling incoming SMS.

Note that SMS messages are only received by rentals that are awake or always-on.

list(data: Reservation | NonrenewableRentalCompact | NonrenewableRentalExpanded | RenewableRentalCompact | RenewableRentalExpanded | VerificationCompact | VerificationExpanded = None, *, to_number: str = None, reservation_type: ReservationType = None) → PaginatedList[Sms][source]

List SMS messages for rentals and verifications associated with this account.

You can retrieve all SMS messages across all your rentals and verifications, or filter by specific criteria. When providing a rental or verification object, SMS messages for that specific number will be returned.

Parameters:
Raises:

ValueError – If both data and to_number are provided, or if reservation_type is specified when using a rental/verification object.

Returns:

A paginated list of SMS messages matching the specified criteria.

Return type:

PaginatedList[Sms]

incoming(data: NonrenewableRentalCompact | NonrenewableRentalExpanded | RenewableRentalCompact | RenewableRentalExpanded | VerificationCompact | VerificationExpanded = None, *, to_number: str = None, reservation_type: ReservationType = None, timeout: float = 10.0, polling_interval: float = 1.0, wake_number: bool = False, since: datetime = None) → Iterator[Sms][source]

Wait for and yield incoming SMS messages in real-time.

This method polls for new SMS messages and yields them as they arrive. It will wait up to the specified timeout for new messages. The polling stops after the first batch of new messages is received or the timeout is reached.

Note: Only rentals that are awake or always-on can receive SMS messages. Use wake_number=True to automatically wake a rental before polling for messages.

Parameters:
  • data (Union[NonrenewableRentalCompact, NonrenewableRentalExpanded, RenewableRentalCompact, RenewableRentalExpanded, VerificationCompact, VerificationExpanded], optional) – A rental or verification object to monitor for incoming SMS. Defaults to None.

  • to_number (str, optional) – Filter incoming SMS by destination phone number. Cannot be used together with data parameter. Defaults to None.

  • reservation_type (ReservationType, optional) – Filter incoming SMS by reservation type. Cannot be used when providing a data object. Defaults to None.

  • timeout (float, optional) – Maximum time in seconds to wait for incoming messages. If negative, no timeout will be applied. Defaults to 10.0.

  • polling_interval (float, optional) – Time in seconds between polling attempts. Defaults to 1.0.

  • wake_number (bool, optional) – Whether to automatically wake the rental before polling. Only works with rental objects, not verifications. Defaults to False.

  • since (datetime.datetime, optional) – Only yield messages created after this timestamp. Defaults to datetime.datetime.now().

Raises:

ValueError – If wake_number is True but no rental data is provided, or if attempting to wake a verification.

Yields:

Sms – New SMS messages as they arrive.

send(data: SendSmsRequest = None, *, reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded = None, send_to: str = None, content: str = None) → bool[source]

Send an SMS message from a renewable reservation.

This method allows you to send an SMS message from one of your renewable rental numbers to any destination phone number. The rental must be active and have SMS capability enabled.

Parameters:
  • data (SendSmsRequest, optional) – The SMS sending details. All kwargs will overwrite values in this object. Defaults to None.

  • reservation_id (Union[str, RenewableRentalCompact, RenewableRentalExpanded], optional) – The ID or instance of the renewable reservation to send from. Defaults to None.

  • send_to (str, optional) – The destination phone number in the format 1112223333 (digits only). Defaults to None.

  • content (str, optional) – The message content to send. Defaults to None.

Raises:

ValueError – If reservation_id is not valid, send_to is not a valid phone number, or content is empty.

Returns:

True if the SMS was sent successfully, False otherwise.

Return type:

bool

reply(data: ReplySmsRequest = None, *, reply_to_sms_id: str | Sms = None, content: str = None) → bool[source]

Reply to an incoming SMS message.

This method allows you to reply to a specific SMS message that was received on one of your rentals. The reply will be sent from the same number that received the original message.

Parameters:
  • data (ReplySmsRequest, optional) – The SMS reply details. All kwargs will overwrite values in this object. Defaults to None.

  • reply_to_sms_id (Union[str, Sms], optional) – The ID or instance of the SMS message to reply to. Defaults to None.

  • content (str, optional) – The reply message content to send. Defaults to None.

Raises:

ValueError – If reply_to_sms_id is not valid or content is empty.

Returns:

True if the reply was sent successfully, False otherwise.

Return type:

bool

class VerificationsAPI(client: _ActionPerformer)[source]

Bases: object

API endpoints related to verifications.

create(data: NewVerificationRequest = None, *, area_code_select_option: List[str] = None, carrier_select_option: List[str] = None, service_name: str = None, capability: ReservationCapability = None, service_not_listed_name: str = None, max_price: float = None, test=None) → VerificationExpanded[source]

Create a new verification for phone number verification purposes.

Verifications are used to receive SMS or voice calls for account verification on various services. This will cost API balance, so ensure you have sufficient funds before calling this method. To estimate the cost, use get_verification_pricing() with the same parameters.

Parameters:
  • data (NewVerificationRequest, optional) – The verification details to create. All kwargs will overwrite values in this object. Defaults to None.

  • area_code_select_option (List[str], optional) – List of preferred area codes for the verification number. Defaults to None.

  • carrier_select_option (List[str], optional) – List of preferred carriers for the verification number. Defaults to None.

  • service_name (str, optional) – Name of the service requiring verification. Can be found by calling textverified.services.get_services(). Defaults to None.

  • capability (ReservationCapability, optional) – The capabilities required (voice, sms, or both) for this verification. Defaults to None.

  • service_not_listed_name (str, optional) – Custom service name if the service is not listed in available services. Defaults to None.

  • max_price (float, optional) – Maximum price you’re willing to pay for this verification. Defaults to None.

Raises:

ValueError – If required fields service_name and capability are not provided.

Returns:

The details of the created verification.

Return type:

VerificationExpanded

pricing(data: NewVerificationRequest | VerificationPriceCheckRequest = None, *, service_name: str = None, area_code: bool = None, carrier: bool = None, number_type: NumberType = None, capability: ReservationCapability = None, test=None) → PricingSnapshot[source]

Get pricing information for a verification before creating it.

This method allows you to check the cost of a verification before purchasing it. You can pass the a NewVerificationRequest to verify the pricing for that specific configuration before creating it, or provide individual parameters to check pricing for a specific service, area code, carrier, number type, and capability.

Parameters:
  • data (Union[NewVerificationRequest, VerificationPriceCheckRequest], optional) – The verification details to price. All kwargs will overwrite values in this object. Defaults to None.

  • service_name (str, optional) – Name of the service requiring verification. Defaults to None.

  • area_code (bool, optional) – Whether to request a specific area code. Defaults to None.

  • carrier (bool, optional) – Whether to request a specific carrier. Defaults to None.

  • number_type (NumberType, optional) – The underlying type of the number (mobile, voip, etc.). Defaults to None.

  • capability (ReservationCapability, optional) – The capabilities required (voice, sms, or both) for this verification. Defaults to None.

Raises:

ValueError – If any required fields are missing or invalid.

Returns:

The pricing information for the requested verification configuration.

Return type:

PricingSnapshot

details(verification_id: str | VerificationCompact | VerificationExpanded) → VerificationExpanded[source]

Get detailed information about a verification by ID.

Parameters:

verification_id (Union[str, VerificationCompact, VerificationExpanded]) – The ID or instance of the verification to retrieve.

Raises:

ValueError – If verification_id is not a valid ID or instance.

Returns:

The detailed information about the verification.

Return type:

VerificationExpanded

list() → PaginatedList[VerificationCompact][source]

Get a paginated list of all verifications associated with this account.

Returns:

A paginated list of verification records.

Return type:

PaginatedList[VerificationCompact]

cancel(verification_id: str | VerificationCompact | VerificationExpanded) → bool[source]

Cancel an active verification.

This will stop the verification process and may result in a refund depending on the verification status.

Parameters:

verification_id (Union[str, VerificationCompact, VerificationExpanded]) – The ID or instance of the verification to cancel.

Raises:

ValueError – If verification_id is not a valid ID or instance.

Returns:

True if the cancellation was successful, False otherwise.

Return type:

bool

reactivate(verification_id: str | VerificationCompact | VerificationExpanded) → bool[source]

Reactivate a previously cancelled or expired verification.

This allows you to resume using a verification that was previously cancelled or has expired, making it available to receive SMS or voice calls again.

Parameters:

verification_id (Union[str, VerificationCompact, VerificationExpanded]) – The ID or instance of the verification to reactivate.

Raises:

ValueError – If verification_id is not a valid ID or instance.

Returns:

True if the reactivation was successful, False otherwise.

Return type:

bool

reuse(verification_id: str | VerificationCompact | VerificationExpanded) → bool[source]

Reuse an existing verification for another service verification.

This allows you to use the same verification number for multiple service verifications, potentially saving on costs when you need to verify accounts with multiple services.

Parameters:

verification_id (Union[str, VerificationCompact, VerificationExpanded]) – The ID or instance of the verification to reuse.

Raises:

ValueError – If verification_id is not a valid ID or instance.

Returns:

True if the reuse was successful, False otherwise.

Return type:

bool

report(verification_id: str | VerificationCompact | VerificationExpanded) → bool[source]

Report an issue with a verification.

Use this method to report problems with a verification, such as not receiving SMS/calls, number not working, or other issues. This may result in a refund or credit.

Parameters:

verification_id (Union[str, VerificationCompact, VerificationExpanded]) – The ID or instance of the verification to report.

Raises:

ValueError – If verification_id is not a valid ID or instance.

Returns:

True if the report was submitted successfully, False otherwise.

Return type:

bool

class WakeAPI(client: _ActionPerformer)[source]

Bases: object

API endpoints related to waking lines.

create(reservation_id: str | Reservation | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → WakeResponse[source]

Create a wake request for a rental reservation.

Wake requests are used to activate rental numbers that are in sleep mode, making them available to receive SMS messages and voice calls. The wake process schedules a usage window during which the number will be active.

Parameters:

reservation_id (Union[str, Reservation, RenewableRentalCompact, RenewableRentalExpanded, NonrenewableRentalCompact, NonrenewableRentalExpanded]) – The ID or instance of the reservation to wake.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

The wake request details including scheduling information and usage window.

Return type:

WakeResponse

get(wake_request_id: str | WakeResponse) → WakeResponse[source]

Get detailed information about a wake request by ID.

Parameters:

wake_request_id (Union[str, WakeResponse]) – The ID or instance of the wake request to retrieve.

Raises:

ValueError – If wake_request_id is not a valid ID or instance.

Returns:

The detailed information about the wake request including status and timing.

Return type:

WakeResponse

estimate_usage_window(reservation_id: str | Reservation | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded) → UsageWindowEstimateRequest[source]

Estimate the usage window timing for a reservation wake request.

This method provides an estimate of when a wake request would be scheduled without actually creating the wake request. Useful for planning when to wake a number for time-sensitive operations.

Parameters:

reservation_id (Union[str, Reservation, RenewableRentalCompact, RenewableRentalExpanded, NonrenewableRentalCompact, NonrenewableRentalExpanded]) – The ID or instance of the reservation to estimate wake timing for.

Raises:

ValueError – If reservation_id is not a valid ID or instance.

Returns:

The estimated usage window timing information.

Return type:

UsageWindowEstimateRequest

wait_for_number_wake(reservation_id: str | RenewableRentalCompact | RenewableRentalExpanded | NonrenewableRentalCompact | NonrenewableRentalExpanded, poll_frequency: float = 5.0) → WakeResponse[source]

Create a wake request and wait for the number to become active.

This is a convenience method that combines creating a wake request and waiting for it to complete. The method will block until the usage window begins and the number is ready to receive SMS/calls.

Parameters:
Raises:

ValueError – If reservation_id is not valid or if the wake request creation fails.

Returns:

The wake response containing the usage window start time, end time, and other details.

Return type:

WakeResponse

wait_for_wake_request(wake_request_id: str | WakeResponse, poll_frequency: float = 5.0) → WakeResponse[source]

Wait for an existing wake request to complete and become active.

This method blocks execution until the wake request’s usage window starts, meaning the number is ready to receive SMS messages and voice calls. Use this when you have an existing wake request and need to wait for it to become active.

Parameters:
  • wake_request_id (Union[str, WakeResponse]) – The ID or instance of the wake request to wait for.

  • poll_frequency (float) – The frequency (in seconds) to poll for the wake request status. Estimated usage window may change after wake request creation.

Raises:

ValueError – If wake_request_id is not valid or if the wake request is not properly scheduled.

Returns:

The wake response containing the usage window start time, end time, and other details.

Return type:

WakeResponse

class Account(username: str, current_balance: float)[source]

Bases: object

username: str

The username of the account holder.

current_balance: float

The current balance of the account.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → Account[source]
class AddOnSnapshot(add_on_id: str, description: str, renewal_cost: float, already_renewed: bool)[source]

Bases: object

add_on_id: str
description: str
renewal_cost: float
already_renewed: bool
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → AddOnSnapshot[source]
class AreaCode(area_code: str, state: str)[source]

Bases: object

area_code: str

Area code. Optionally supply this value when an `areaCodeSelectOption` is in the request body or parameter.

state: str

The US state associated with the area code.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → AreaCode[source]
class BackOrderReservationCompact(id: str, service_name: str, status: textverified.data.dtypes.BackOrderState)[source]

Bases: object

id: str
service_name: str

Name of service

status: BackOrderState
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BackOrderReservationCompact[source]
class BackOrderReservationExpanded(id: str, service_name: str, sale_id: str, status: textverified.data.dtypes.BackOrderState, reservation_id: str | None = None)[source]

Bases: object

id: str
service_name: str
sale_id: str
status: BackOrderState
reservation_id: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BackOrderReservationExpanded[source]
class BackOrderReservationWebhookEvent(back_order_id: str)[source]

Bases: object

back_order_id: str

ID of the back order reservation.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BackOrderReservationWebhookEvent[source]
class BackOrderState(value)[source]

Bases: Enum

CREATED = 'created'
FULFILLED = 'fulfilled'
CANCELED = 'canceled'
to_api() → str[source]
classmethod from_api(value: str) → BackOrderState[source]
class BearerToken(token: str, expires_in: float, expires_at: datetime.datetime)[source]

Bases: object

token: str

Bearer token

expires_in: float

Seconds remaining until bearer token expires

expires_at: datetime

Timestamp of when the token will expire

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BearerToken[source]
class BillingCycleCompact(id: str, billing_cycle_ends_at: datetime.datetime, email_notifications_enabled: bool, state: str)[source]

Bases: object

id: str

ID of the billing cycle

billing_cycle_ends_at: datetime
email_notifications_enabled: bool
state: str
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BillingCycleCompact[source]
class BillingCycleExpanded(id: str, renewed_through: datetime.datetime, billing_cycle_ends_at: datetime.datetime, email_notifications_enabled: bool, state: str, next_auto_renew_attempt: datetime.datetime | None = None)[source]

Bases: object

id: str

ID of the billing cycle

renewed_through: datetime
billing_cycle_ends_at: datetime
email_notifications_enabled: bool
state: str
next_auto_renew_attempt: datetime | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BillingCycleExpanded[source]
class BillingCycleRenewalInvoice(created_at: datetime.datetime, id: str, excluded_rentals: List[textverified.data.dtypes.RentalSnapshot], included_rentals: List[textverified.data.dtypes.RentalSnapshot], is_paid_for: bool, total_cost: float)[source]

Bases: object

created_at: datetime
id: str
excluded_rentals: List[RentalSnapshot]
included_rentals: List[RentalSnapshot]
is_paid_for: bool
total_cost: float

Total amount cost of the invoice, in account credits.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BillingCycleRenewalInvoice[source]
class BillingCycleRenewalInvoicePreview(billing_cycle_id: str, renewal_estimate: textverified.data.dtypes.BillingCycleRenewalInvoice)[source]

Bases: object

billing_cycle_id: str
renewal_estimate: BillingCycleRenewalInvoice
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BillingCycleRenewalInvoicePreview[source]
class BillingCycleUpdateRequest(reminders_enabled: bool | None = None, nickname: str | None = None)[source]

Bases: object

Supplying a value of ‘null’ or not supplying a value for any nullable properties will cause the property to be ignored.

reminders_enabled: bool | None = None
nickname: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BillingCycleUpdateRequest[source]
class BillingCycleWebhookEvent(billing_cycle_id: str)[source]

Bases: object

billing_cycle_id: str

ID of the billing cycle.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → BillingCycleWebhookEvent[source]
class Call(to_value: str, created_at: datetime.datetime, id: str, from_value: str | None = None, recording_uri: str | None = None)[source]

Bases: object

to_value: str
created_at: datetime
id: str
from_value: str | None = None
recording_uri: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → Call[source]
class CallContext(reservation_id: str, twilio_context: textverified.data.dtypes.TwilioCallingContextDto)[source]

Bases: object

reservation_id: str

ID of the verification that this call context is associated with.

twilio_context: TwilioCallingContextDto
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → CallContext[source]
class CallSessionRequest(reservation_id: str)[source]

Bases: object

reservation_id: str
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → CallSessionRequest[source]
class CancelAction(can_cancel: bool)[source]

Bases: object

can_cancel: bool
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → CancelAction[source]
class Error(error_code: str | None = None, error_description: str | None = None)[source]

Bases: object

error_code: str | None = None
error_description: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → Error[source]
class InventoryQuantity(available_quantity: int)[source]

Bases: object

available_quantity: int

Available inventory quantity for the requested selection. A value of `9000` means `9000 or more` are available.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → InventoryQuantity[source]
class KeysetPaginationDirectionality(value)[source]

Bases: Enum

FORWARD = 'forward'
REVERSE = 'reverse'
to_api() → str[source]
classmethod from_api(value: str) → KeysetPaginationDirectionality[source]
class LineHealth(line_number: str, checked_at: datetime.datetime | None = None)[source]

Bases: object

line_number: str

Line number associated with the reservation.

checked_at: datetime | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → LineHealth[source]
class LineReservationType(value)[source]

Bases: Enum

VERIFICATION = 'verification'
RENTAL = 'rental'
to_api() → str[source]
classmethod from_api(value: str) → LineReservationType[source]
class NewRentalRequest(allow_back_order_reservations: bool, duration: textverified.data.dtypes.RentalDuration, is_renewable: bool, number_type: textverified.data.dtypes.NumberType, service_name: str, capability: textverified.data.dtypes.ReservationCapability, always_on: bool | None = None, area_code_select_option: List[str] | None = None, billing_cycle_id_to_assign_to: str | None = None)[source]

Bases: object

allow_back_order_reservations: bool

If set to true, a rental back order will be created if the requested rental is out of stock

duration: RentalDuration
is_renewable: bool

Set to true to create a renewable rental. Set to false to create a non-renewable rental.

number_type: NumberType
service_name: str

Service name returned by Service List, or a supported `test_*` mock service name.

capability: ReservationCapability
always_on: bool | None = None
area_code_select_option: List[str] | None = None
billing_cycle_id_to_assign_to: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → NewRentalRequest[source]
class NewVerificationRequest(service_name: str, capability: textverified.data.dtypes.ReservationCapability, area_code_select_option: List[str] | None = None, carrier_select_option: List[str] | None = None, service_not_listed_name: str | None = None, max_price: float | None = None)[source]

Bases: object

service_name: str

Service name returned by Service List, or a supported `test_*` mock service name.

capability: ReservationCapability
area_code_select_option: List[str] | None = None
carrier_select_option: List[str] | None = None
service_not_listed_name: str | None = None
max_price: float | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → NewVerificationRequest[source]
class NonrenewableRentalCompact(created_at: datetime.datetime, id: str, service_name: str, state: textverified.data.dtypes.ReservationState, number: str, always_on: bool, sale_id: str | None = None)[source]

Bases: object

created_at: datetime
id: str
service_name: str
state: ReservationState
number: str
always_on: bool
sale_id: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → NonrenewableRentalCompact[source]
class NonrenewableRentalExpanded(created_at: datetime.datetime, ends_at: datetime.datetime, id: str, refund: textverified.data.dtypes.RefundAction, service_name: str, state: textverified.data.dtypes.ReservationState, number: str, always_on: bool, sale_id: str | None = None)[source]

Bases: object

created_at: datetime
ends_at: datetime
id: str
refund: RefundAction
service_name: str
state: ReservationState
number: str
always_on: bool
sale_id: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → NonrenewableRentalExpanded[source]
class NonrenewableRentalUpdateRequest(user_notes: str | None = None, mark_all_sms_read: bool | None = None, tags: List[str] | None = None)[source]

Bases: object

Supplying a value of ‘null’ or not supplying a value for any nullable properties will cause the property to be ignored.

user_notes: str | None = None
mark_all_sms_read: bool | None = None
tags: List[str] | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → NonrenewableRentalUpdateRequest[source]
class NumberType(value)[source]

Bases: Enum

MOBILE = 'mobile'
VOIP = 'voip'
LANDLINE = 'landline'
to_api() → str[source]
classmethod from_api(value: str) → NumberType[source]
class PricingSnapshot(service_name: str, price: float)[source]

Bases: object

service_name: str

Name of the service.

price: float

Total cost.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → PricingSnapshot[source]
class ReactivationAction(can_reactivate: bool)[source]

Bases: object

can_reactivate: bool
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → ReactivationAction[source]
class RefundAction(can_refund: bool, refundable_until: datetime.datetime | None = None)[source]

Bases: object

can_refund: bool
refundable_until: datetime | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RefundAction[source]
class RenewableRentalCompact(created_at: datetime.datetime, id: str, service_name: str, state: textverified.data.dtypes.ReservationState, billing_cycle_id: str, is_included_for_next_renewal: bool, number: str, always_on: bool, sale_id: str | None = None)[source]

Bases: object

created_at: datetime
id: str
service_name: str

yahoo

Type:

Example

state: ReservationState
billing_cycle_id: str
is_included_for_next_renewal: bool
number: str

2223334444

Type:

Example

always_on: bool
sale_id: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RenewableRentalCompact[source]
class RenewableRentalExpanded(created_at: datetime.datetime, id: str, refund: textverified.data.dtypes.RefundAction, service_name: str, state: textverified.data.dtypes.ReservationState, billing_cycle_id: str, is_included_for_next_renewal: bool, number: str, always_on: bool, ends_at: datetime.datetime | None = None, sale_id: str | None = None)[source]

Bases: object

created_at: datetime
id: str
refund: RefundAction
service_name: str
state: ReservationState
billing_cycle_id: str
is_included_for_next_renewal: bool
number: str

2223334444

Type:

Example

always_on: bool
ends_at: datetime | None = None
sale_id: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RenewableRentalExpanded[source]
class RenewableRentalUpdateRequest(user_notes: str | None = None, include_for_renewal: bool | None = None, mark_all_sms_read: bool | None = None, tags: List[str] | None = None)[source]

Bases: object

Supplying a value of ‘null’ or not supplying a value for any nullable properties will cause the property to be ignored.

user_notes: str | None = None
include_for_renewal: bool | None = None
mark_all_sms_read: bool | None = None
tags: List[str] | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RenewableRentalUpdateRequest[source]
class RentalBillingCycleUpgrade(reservation_id: str, desired_rental_duration: textverified.data.dtypes.RentalDuration, scheduled_for: datetime.datetime, cancellable_before: datetime.datetime, next_renewal_after_job_completed: datetime.datetime, cost: float, state: textverified.data.dtypes.RentalBillingCycleUpgradeState, id: str)[source]

Bases: object

reservation_id: str

ID of the rental.

desired_rental_duration: RentalDuration
scheduled_for: datetime

Time when the upgrade is scheduled to run.

cancellable_before: datetime

Last time the pending upgrade can be canceled.

next_renewal_after_job_completed: datetime

Next renewal time after the upgrade completes.

cost: float

Cost charged when the upgrade is scheduled.

state: RentalBillingCycleUpgradeState
id: str

ID of the pending upgrade job.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalBillingCycleUpgrade[source]
class RentalBillingCycleUpgradeRequest(desired_duration: textverified.data.dtypes.RentalDuration)[source]

Bases: object

desired_duration: RentalDuration
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalBillingCycleUpgradeRequest[source]
class RentalBillingCycleUpgradeState(value)[source]

Bases: Enum

CREATED = 'created'
CANCELLED = 'cancelled'
SUCCEEDED = 'succeeded'
SUSPENDED = 'suspended'
to_api() → str[source]
classmethod from_api(value: str) → RentalBillingCycleUpgradeState[source]
class RentalDuration(value)[source]

Bases: Enum

ONE_DAY = 'oneDay'
THREE_DAY = 'threeDay'
SEVEN_DAY = 'sevenDay'
FOURTEEN_DAY = 'fourteenDay'
THIRTY_DAY = 'thirtyDay'
NINETY_DAY = 'ninetyDay'
ONE_YEAR = 'oneYear'
to_api() → str[source]
classmethod from_api(value: str) → RentalDuration[source]
class RentalExtension(reservation_id: str, extension_amount: str, cost: float, created_at: datetime.datetime, original_ends_at: datetime.datetime, new_ends_at: datetime.datetime, id: str)[source]

Bases: object

reservation_id: str
extension_amount: str
cost: float
created_at: datetime
original_ends_at: datetime
new_ends_at: datetime
id: str
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalExtension[source]
class RentalExtensionRequest(extension_duration: textverified.data.dtypes.RentalDuration, rental_id: str)[source]

Bases: object

extension_duration: RentalDuration
rental_id: str
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalExtensionRequest[source]
class RentalInventoryCheckRequest(duration: textverified.data.dtypes.RentalDuration, number_type: textverified.data.dtypes.NumberType, service_name: str, capability: textverified.data.dtypes.ReservationCapability)[source]

Bases: object

duration: RentalDuration
number_type: NumberType
service_name: str

Service name to check inventory for. Use the same value you plan to send when creating the rental.

capability: ReservationCapability
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalInventoryCheckRequest[source]
class RentalPriceCheckRequest(service_name: str, area_code: bool, number_type: textverified.data.dtypes.NumberType, capability: textverified.data.dtypes.ReservationCapability, is_renewable: bool, duration: textverified.data.dtypes.RentalDuration, always_on: bool | None = None, call_forwarding: bool | None = None, billing_cycle_id_to_assign_to: str | None = None)[source]

Bases: object

service_name: str

Service name to price. Use the same value you plan to send when creating the rental.

area_code: bool

Set to true if a specific area code will be requested when creating a rental, false if any area code can be used.

number_type: NumberType
capability: ReservationCapability
is_renewable: bool

Set to true to price a renewable rental. Set to false to price a non-renewable rental.

duration: RentalDuration
always_on: bool | None = None
call_forwarding: bool | None = None
billing_cycle_id_to_assign_to: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalPriceCheckRequest[source]
class RentalReactivationCost(price: float)[source]

Bases: object

price: float

Current total cost to reactivate the rental.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalReactivationCost[source]
class RentalReactivationRequest(max_price: float)[source]

Bases: object

max_price: float

Maximum total price you are willing to pay for the reactivation. The server recomputes the price at execution time and rejects the request if the total exceeds this value.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalReactivationRequest[source]
class RentalSnapshot(number: str, renewal_cost: float, service_name: str, already_renewed: bool, included_add_ons: List[textverified.data.dtypes.AddOnSnapshot], excluded_add_ons: List[textverified.data.dtypes.AddOnSnapshot])[source]

Bases: object

number: str
renewal_cost: float

Renewal cost, in account credits.

service_name: str
already_renewed: bool
included_add_ons: List[AddOnSnapshot]
excluded_add_ons: List[AddOnSnapshot]
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalSnapshot[source]
class RentalTags(reservation_id: str, tags: List[str] | None = None)[source]

Bases: object

reservation_id: str
tags: List[str] | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalTags[source]
class RentalTagsSearch(reservation_ids: List[str])[source]

Bases: object

reservation_ids: List[str]
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalTagsSearch[source]
class RentalUserNotes(reservation_id: str, user_notes: str)[source]

Bases: object

reservation_id: str
user_notes: str
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → RentalUserNotes[source]
class ReplySmsRequest(reply_to_sms_id: str, content: str)[source]

Bases: object

reply_to_sms_id: str

The SMS ID to reply to. If a valid SMS does not exist or the SMS cannot be replied to, a 400 response will be returned.

content: str

The SMS content to send. If the content is invalid, a 400 response will be returned.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → ReplySmsRequest[source]
class ReportAction(can_report: bool)[source]

Bases: object

can_report: bool
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → ReportAction[source]
class Reservation(id: str, reservation_type: textverified.data.dtypes.ReservationType, service_name: str)[source]

Bases: object

id: str

ID of the reservation

reservation_type: ReservationType
service_name: str

Name of service

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → Reservation[source]
class ReservationCapability(value)[source]

Bases: Enum

SMS = 'sms'
VOICE = 'voice'
SMS_AND_VOICE_COMBO = 'smsAndVoiceCombo'
to_api() → str[source]
classmethod from_api(value: str) → ReservationCapability[source]
class ReservationCreatedWebhookEvent(id: str, type: textverified.data.dtypes.LineReservationType)[source]

Bases: object

id: str

ID of the created reservation.

type: LineReservationType
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → ReservationCreatedWebhookEvent[source]
class ReservationSaleCompact(created_at: datetime.datetime, id: str, state: textverified.data.dtypes.ReservationSaleState, total_cost: float, updated_at: datetime.datetime)[source]

Bases: object

created_at: datetime
id: str
state: ReservationSaleState
total_cost: float

0.95

Type:

Example

updated_at: datetime
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → ReservationSaleCompact[source]
class ReservationSaleExpanded(created_at: datetime.datetime, id: str, back_order_reservations: List[textverified.data.dtypes.BackOrderReservationCompact], reservations: List[textverified.data.dtypes.Reservation], state: textverified.data.dtypes.ReservationSaleState, total: float, updated_at: datetime.datetime)[source]

Bases: object

created_at: datetime
id: str
back_order_reservations: List[BackOrderReservationCompact]
reservations: List[Reservation]
state: ReservationSaleState
total: float

Total amount of the sale, in account credits.

updated_at: datetime
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → ReservationSaleExpanded[source]
class ReservationSaleState(value)[source]

Bases: Enum

CREATED = 'created'
PROCESSING = 'processing'
FAILED = 'failed'
SUCCEEDED = 'succeeded'
to_api() → str[source]
classmethod from_api(value: str) → ReservationSaleState[source]
class ReservationState(value)[source]

Bases: Enum

VERIFICATION_PENDING = 'verificationPending'
VERIFICATION_COMPLETED = 'verificationCompleted'
VERIFICATION_CANCELED = 'verificationCanceled'
VERIFICATION_TIMED_OUT = 'verificationTimedOut'
VERIFICATION_REPORTED = 'verificationReported'
VERIFICATION_REFUNDED = 'verificationRefunded'
VERIFICATION_REUSED = 'verificationReused'
VERIFICATION_REACTIVATED = 'verificationReactivated'
RENEWABLE_ACTIVE = 'renewableActive'
RENEWABLE_OVERDUE = 'renewableOverdue'
RENEWABLE_EXPIRED = 'renewableExpired'
RENEWABLE_REFUNDED = 'renewableRefunded'
NONRENEWABLE_ACTIVE = 'nonrenewableActive'
NONRENEWABLE_EXPIRED = 'nonrenewableExpired'
NONRENEWABLE_REFUNDED = 'nonrenewableRefunded'
to_api() → str[source]
classmethod from_api(value: str) → ReservationState[source]
class ReservationType(value)[source]

Bases: Enum

RENEWABLE = 'renewable'
NONRENEWABLE = 'nonrenewable'
VERIFICATION = 'verification'
to_api() → str[source]
classmethod from_api(value: str) → ReservationType[source]
class ReuseAction(reusable_until: datetime.datetime | None = None)[source]

Bases: object

reusable_until: datetime | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → ReuseAction[source]
class SendSmsRequest(reservation_id: str, send_to: str, content: str)[source]

Bases: object

reservation_id: str

The reservation ID to send from. If a valid reservation does not exist or the reservation does not have sending capabilities, a 400 response will be returned.

send_to: str

The number to send to. If the number is invalid, a 400 response will be returned.

content: str

The SMS content to send. If the content is invalid, a 400 response will be returned.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → SendSmsRequest[source]
class Service(service_name: str, capability: textverified.data.dtypes.ReservationCapability, description: str | None = None)[source]

Bases: object

service_name: str

Name of the service. Supply this value when a `ServiceName` is required.

capability: ReservationCapability
description: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → Service[source]
class Sms(id: str, to_value: str, created_at: datetime, encrypted: bool, from_value: str | None = None, sms_content: str | None = None, parsed_code: str | None = None)[source]

Bases: object

SMS

id: str
to_value: str
created_at: datetime
encrypted: bool
from_value: str | None = None
sms_content: str | None = None
parsed_code: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → Sms[source]
class SmsWebhookEvent(to_value: str, created_at: datetime.datetime, encrypted: bool, from_value: str | None = None, sms_content: str | None = None, parsed_code: str | None = None, reservation_id: str | None = None)[source]

Bases: object

to_value: str
created_at: datetime
encrypted: bool

True if the contents of the SMS are encrypted at rest.

from_value: str | None = None
sms_content: str | None = None
parsed_code: str | None = None
reservation_id: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → SmsWebhookEvent[source]
class TwilioCallingContextDto(token: str | None = None)[source]

Bases: object

token: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → TwilioCallingContextDto[source]
class UsageWindowEstimateRequest(reservation_id: str)[source]

Bases: object

reservation_id: str

The reservation ID to get the estimated usage window for. If a valid reservation does not exist, a 400 response will be returned.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → UsageWindowEstimateRequest[source]
class UsageWindowEstimateResponse(reservation_id: str, estimated_window_start: datetime.datetime | None = None, estimated_window_end: datetime.datetime | None = None)[source]

Bases: object

reservation_id: str

ID of the reservation that this usage window estimate is associated with.

estimated_window_start: datetime | None = None
estimated_window_end: datetime | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → UsageWindowEstimateResponse[source]
class VerificationCompact(created_at: datetime.datetime, id: str, service_name: str, state: textverified.data.dtypes.ReservationState, total_cost: float, number: str)[source]

Bases: object

created_at: datetime
id: str
service_name: str
state: ReservationState
total_cost: float

0.95

Type:

Example

number: str
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → VerificationCompact[source]
class VerificationExpanded(number: str, created_at: datetime.datetime, ends_at: datetime.datetime, id: str, cancel: textverified.data.dtypes.CancelAction, reactivate: textverified.data.dtypes.ReactivationAction, report: textverified.data.dtypes.ReportAction, reuse: textverified.data.dtypes.ReuseAction, service_name: str, state: textverified.data.dtypes.ReservationState, total_cost: float)[source]

Bases: object

number: str
created_at: datetime
ends_at: datetime
id: str
cancel: CancelAction
reactivate: ReactivationAction
report: ReportAction
reuse: ReuseAction
service_name: str
state: ReservationState
total_cost: float

0.95

Type:

Example

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → VerificationExpanded[source]
class VerificationInventoryCheckRequest(number_type: textverified.data.dtypes.NumberType, service_name: str, capability: textverified.data.dtypes.ReservationCapability)[source]

Bases: object

number_type: NumberType
service_name: str

Service name to check inventory for. Use the same value you plan to send when creating the verification.

capability: ReservationCapability
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → VerificationInventoryCheckRequest[source]
class VerificationPriceCheckRequest(service_name: str, area_code: bool, carrier: bool, number_type: textverified.data.dtypes.NumberType, capability: textverified.data.dtypes.ReservationCapability)[source]

Bases: object

service_name: str

Service name to price. Use the same value you plan to send when creating the verification.

area_code: bool

Set to true if a specific area code will be requested when creating a verification, false if any area code can be used.

carrier: bool

Set to true if a specific carrier will be requested when creating a verification, false if any carrier can be used.

number_type: NumberType
capability: ReservationCapability
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → VerificationPriceCheckRequest[source]
class WakeRequest(reservation_id: str)[source]

Bases: object

reservation_id: str

The reservation ID to create a wake request for. If a valid reservation does not exist, a 400 response will be returned.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → WakeRequest[source]
class WakeResponse(id: str, is_scheduled: bool, usage_window_start: datetime.datetime | None = None, usage_window_end: datetime.datetime | None = None, reservation_id: str | None = None)[source]

Bases: object

id: str

The ID of this wake request.

is_scheduled: bool

Indicates whether the wake request was successfully scheduled. If a wake request fails to schedule, submit a new wake request. Too many wake requests may result in wake request throttling.

usage_window_start: datetime | None = None
usage_window_end: datetime | None = None
reservation_id: str | None = None
to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → WakeResponse[source]
class WebhookEventBackOrderReservationWebhookEvent(attempt: int, occurred_at: datetime.datetime, data: textverified.data.dtypes.BackOrderReservationWebhookEvent, event: str, id: str, idempotency_key: str)[source]

Bases: object

attempt: int

Send attempt count

occurred_at: datetime

When the event occurred

data: BackOrderReservationWebhookEvent
event: str

Name of the event

id: str

ID of the event.

idempotency_key: str

Idempotency key for webhook delivery deduplication.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → WebhookEventBackOrderReservationWebhookEvent[source]
class WebhookEventBillingCycleWebhookEvent(attempt: int, occurred_at: datetime.datetime, data: textverified.data.dtypes.BillingCycleWebhookEvent, event: str, id: str, idempotency_key: str)[source]

Bases: object

attempt: int

Send attempt count

occurred_at: datetime

When the event occurred

data: BillingCycleWebhookEvent
event: str

Name of the event

id: str

ID of the event.

idempotency_key: str

Idempotency key for webhook delivery deduplication.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → WebhookEventBillingCycleWebhookEvent[source]
class WebhookEventReservationCreatedWebhookEvent(attempt: int, occurred_at: datetime.datetime, data: textverified.data.dtypes.ReservationCreatedWebhookEvent, event: str, id: str, idempotency_key: str)[source]

Bases: object

attempt: int

Send attempt count

occurred_at: datetime

When the event occurred

data: ReservationCreatedWebhookEvent
event: str

Name of the event

id: str

ID of the event.

idempotency_key: str

Idempotency key for webhook delivery deduplication.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → WebhookEventReservationCreatedWebhookEvent[source]
class WebhookEventSmsWebhookEvent(attempt: int, occurred_at: datetime.datetime, data: textverified.data.dtypes.SmsWebhookEvent, event: str, id: str, idempotency_key: str)[source]

Bases: object

attempt: int

Send attempt count

occurred_at: datetime

When the event occurred

data: SmsWebhookEvent
event: str

Name of the event

id: str

ID of the event.

idempotency_key: str

Idempotency key for webhook delivery deduplication.

to_api() → Dict[str, Any][source]
classmethod from_api(data: Dict[str, Any]) → WebhookEventSmsWebhookEvent[source]

Indices and tables