### Add and Run Python Example Source: https://github.com/team-telnyx/telnyx-python/blob/master/CONTRIBUTING.md Add new examples to the 'examples/' directory and make them executable. Run the example against your API. ```python # add an example to examples/.py #!/usr/bin/env -S uv run python … ``` ```sh chmod +x examples/.py # run the example against your api $ ./examples/.py ``` -------------------------------- ### Install from Git Source: https://github.com/team-telnyx/telnyx-python/blob/master/CONTRIBUTING.md Install the Telnyx Python library directly from its GitHub repository using pip. ```sh pip install git+ssh://git@github.com/team-telnyx/telnyx-python#master.git ``` -------------------------------- ### Install Telnyx Python Library Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Install the Telnyx library from PyPI using pip. ```sh pip install telnyx ``` -------------------------------- ### Build and Install Wheel File Source: https://github.com/team-telnyx/telnyx-python/blob/master/CONTRIBUTING.md Build a distributable version of the library using uv or python-build, then install the generated wheel file. ```sh uv build # or $ python -m build ``` ```sh pip install ./path-to-wheel-file.whl ``` -------------------------------- ### Sync Dependencies with uv Source: https://github.com/team-telnyx/telnyx-python/blob/master/CONTRIBUTING.md Install all project dependencies, including extras, using uv. Ensure uv is installed manually if not using the bootstrap script. ```sh uv sync --all-extras ``` -------------------------------- ### Install Telnyx with aiohttp Support Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Install the Telnyx library with the optional aiohttp dependency for improved concurrency performance in asynchronous operations. ```sh pip install telnyx[aiohttp] ``` -------------------------------- ### Start Recording Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts the recording of a conference. ```APIDOC ## POST /conferences/{id}/actions/record_start ### Description Starts the recording of a conference. ### Method POST ### Endpoint /conferences/{id}/actions/record_start ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the conference. #### Request Body - **params** (object) - Optional - Parameters for starting the recording. Refer to `ActionRecordStartResponse` for details. ### Response #### Success Response (200) - **data** (ActionRecordStartResponse) - Details of the start recording action. ``` -------------------------------- ### Start Conference Recording Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use this method to start recording a conference. Requires a conference ID and optional parameters. ```python client.conferences.actions.record_start(id, **params) -> ActionRecordStartResponse ``` -------------------------------- ### Start Playback Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts audio playback on a call. Requires the call control ID and playback parameters. ```python client.calls.actions.start_playback(call_control_id, **params) ``` -------------------------------- ### Start Streaming Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts streaming call audio. Requires the call control ID and streaming parameters. ```python client.calls.actions.start_streaming(call_control_id, **params) ``` -------------------------------- ### Install Dev Dependencies with pip Source: https://github.com/team-telnyx/telnyx-python/blob/master/CONTRIBUTING.md Install development dependencies using pip if uv is not used. Ensure the Python version in .python-version is met and a virtual environment is created. ```sh pip install -r requirements-dev.lock ``` -------------------------------- ### Start Forking Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts forking an active call. Requires the call control ID and optional parameters. ```APIDOC ## POST /calls/{call_control_id}/actions/fork_start ### Description Starts forking an active call. ### Method POST ### Endpoint /calls/{call_control_id}/actions/fork_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call. #### Request Body - **params** (object) - Optional - Additional parameters for starting forking. ``` -------------------------------- ### Start AI Assistant Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts an AI assistant for an active call. Requires the call control ID and optional parameters. ```APIDOC ## POST /calls/{call_control_id}/actions/ai_assistant_start ### Description Starts an AI assistant for an active call. ### Method POST ### Endpoint /calls/{call_control_id}/actions/ai_assistant_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call. #### Request Body - **params** (object) - Optional - Additional parameters for starting the AI assistant. ``` -------------------------------- ### Start SIPREC Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiates SIPREC (SIP Recording) for a call. Requires the call control ID and SIPREC parameters. ```python client.calls.actions.start_siprec(call_control_id, **params) ``` -------------------------------- ### Start Recording Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Begins recording a call. Requires the call control ID and recording parameters. ```python client.calls.actions.start_recording(call_control_id, **params) ``` -------------------------------- ### List Migration Sources Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Lists all available migration sources. This is helpful for getting an overview of all configured migration sources. ```python client.storage.migration_sources.list() ``` -------------------------------- ### start_siprec Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts SIPREC (SIP Recording) for a call. This allows for advanced call recording scenarios. ```APIDOC ## POST /calls/{call_control_id}/actions/siprec_start ### Description Starts SIPREC (SIP Recording) for a call. ### Method POST ### Endpoint /calls/{call_control_id}/actions/siprec_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call control. #### Request Body - **params** (object) - Optional - Additional parameters for starting SIPREC. ``` -------------------------------- ### List Access IP Addresses with Pagination Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Demonstrates how to list access IP addresses using the library's auto-paginating iterators. This example shows fetching all items across multiple pages automatically. ```APIDOC ## List Access IP Addresses (Paginated) ### Description Fetches a list of access IP addresses, with automatic handling of pagination to retrieve all results across multiple pages. ### Method `client.access_ip_address.list()` ### Parameters - `page_number` (int) - The page number to retrieve. - `page_size` (int) - The number of items to return per page. ### Request Example (Synchronous) ```python from telnyx import Telnyx client = Telnyx() all_access_ip_addresses = [] for access_ip_address in client.access_ip_address.list( page_number=1, page_size=50, ): all_access_ip_addresses.append(access_ip_address) print(all_access_ip_addresses) ``` ### Request Example (Asynchronous) ```python import asyncio from telnyx import AsyncTelnyx client = AsyncTelnyx() async def main() -> None: all_access_ip_addresses = [] async for access_ip_address in client.access_ip_address.list( page_number=1, page_size=50, ): all_access_ip_addresses.append(access_ip_address) print(all_access_ip_addresses) asyncio.run(main()) ``` ### Response - `data` (list) - A list of access IP address objects. - `meta` (object) - Metadata about the pagination, including `page_number`. ``` -------------------------------- ### Start AI assistant on a call Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiate an AI assistant on an active call. Requires the call control ID and parameters for starting the AI assistant. ```python client.calls.actions.start_ai_assistant(call_control_id, **params) ``` -------------------------------- ### List Migrations Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Lists all migrations. This is useful for getting an overview of all migration activities. ```python client.storage.migrations.list() ``` -------------------------------- ### start_playback Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts audio playback on a call. This can be used to play pre-recorded messages or audio files to participants. ```APIDOC ## POST /calls/{call_control_id}/actions/playback_start ### Description Starts audio playback on a call. ### Method POST ### Endpoint /calls/{call_control_id}/actions/playback_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call control. #### Request Body - **params** (object) - Optional - Additional parameters for starting audio playback. ``` -------------------------------- ### start_streaming Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts streaming of call audio. This can be used for real-time analysis or processing. ```APIDOC ## POST /calls/{call_control_id}/actions/streaming_start ### Description Starts streaming of call audio. ### Method POST ### Endpoint /calls/{call_control_id}/actions/streaming_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call control. #### Request Body - **params** (object) - Optional - Additional parameters for starting audio streaming. ``` -------------------------------- ### Asynchronous API Call Example Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Shows how to make an asynchronous API call to dial a number using the AsyncTelnyx client. This requires using `await` and running the main function with `asyncio.run()`. ```python import os import asyncio from telnyx import AsyncTelnyx client = AsyncTelnyx( api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted ) async def main() -> None: response = await client.calls.dial( connection_id="conn12345", from_="+15557654321", to="+15551234567", webhook_url="https://your-webhook.url/events", ) print(response.data) asyncio.run(main()) ``` -------------------------------- ### Synchronous API Call Example Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Demonstrates making a synchronous API call to dial a number using the Telnyx client. Ensure the TELNYX_API_KEY environment variable is set. ```python import os from telnyx import Telnyx client = Telnyx( api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted ) response = client.calls.dial( connection_id="conn12345", from_="+15557654321", to="+15551234567", webhook_url="https://your-webhook.url/events", ) print(response.data) ``` -------------------------------- ### Start call forking Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiate call forking to duplicate call streams. Requires the call control ID and parameters for forking. ```python client.calls.actions.start_forking(call_control_id, **params) ``` -------------------------------- ### Create an AI Mission Run Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use the `create` method to start a new run for a specific AI mission. Requires `mission_id` and run parameters. ```python client.ai.missions.runs.create(mission_id, **params) ``` -------------------------------- ### Get Campaign OSR Attributes Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves the One-Time Setup Request (OSR) attributes for a specific 10DLC campaign. ```APIDOC ## GET /10dlc/campaign/{campaignId}/osr/attributes ### Description Retrieves the OSR attributes for a specified 10DLC campaign. ### Method GET ### Endpoint /10dlc/campaign/{campaignId}/osr/attributes ### Parameters #### Path Parameters - **campaignId** (string) - Required - The ID of the campaign. ### Request Example ```python client.messaging_10dlc.campaign.osr.get_attributes(campaign_id) ``` ### Response #### Success Response (200) - **OsrGetAttributesResponse** - The response object containing OSR attributes. ``` -------------------------------- ### Get SimCard Activation Code Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieve the activation code for a specific SimCard using its ID. This is often required for initial setup or provisioning. ```python client.sim_cards.get_activation_code(id) ``` -------------------------------- ### Plan API Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Manage the plan for an AI mission run, including creating, retrieving, adding steps, getting step details, and updating steps. ```APIDOC ## POST /ai/missions/{mission_id}/runs/{run_id}/plan ### Description Creates a new plan for a specific AI mission run. ### Method POST ### Endpoint /ai/missions/{mission_id}/runs/{run_id}/plan ### Parameters #### Path Parameters - **mission_id** (string) - Required - The ID of the mission. - **run_id** (string) - Required - The ID of the run. #### Request Body - **params** (object) - Optional - Parameters for creating the plan. ### Response #### Success Response (200) - **data** (PlanCreateResponse) - The response containing details of the created plan. ### Response Example { "data": { "id": "plan_abc123", "type": "plan", "attributes": { "created_at": "2023-10-27T11:00:00Z", "updated_at": "2023-10-27T11:00:00Z" } } } ``` ```APIDOC ## GET /ai/missions/{mission_id}/runs/{run_id}/plan ### Description Retrieves the plan for a specific AI mission run. ### Method GET ### Endpoint /ai/missions/{mission_id}/runs/{run_id}/plan ### Parameters #### Path Parameters - **mission_id** (string) - Required - The ID of the mission. - **run_id** (string) - Required - The ID of the run. ### Response #### Success Response (200) - **data** (PlanRetrieveResponse) - The response containing details of the plan. ### Response Example { "data": { "id": "plan_abc123", "type": "plan", "attributes": { "created_at": "2023-10-27T11:00:00Z", "updated_at": "2023-10-27T11:05:00Z", "steps": [] } } } ``` ```APIDOC ## POST /ai/missions/{mission_id}/runs/{run_id}/plan/steps ### Description Adds steps to an existing plan for an AI mission run. ### Method POST ### Endpoint /ai/missions/{mission_id}/runs/{run_id}/plan/steps ### Parameters #### Path Parameters - **mission_id** (string) - Required - The ID of the mission. - **run_id** (string) - Required - The ID of the run. #### Request Body - **params** (object) - Optional - Parameters for adding steps to the plan. ### Response #### Success Response (200) - **data** (PlanAddStepsToPlanResponse) - The response indicating the steps were added. ### Response Example { "data": { "id": "plan_abc123", "type": "plan", "attributes": { "created_at": "2023-10-27T11:00:00Z", "updated_at": "2023-10-27T11:10:00Z", "steps": [ { "id": "step_def456", "type": "plan_step", "attributes": { "name": "Step 1", "description": "First step in the plan." } } ] } } } ``` ```APIDOC ## GET /ai/missions/{mission_id}/runs/{run_id}/plan/steps/{step_id} ### Description Retrieves the details of a specific step within a plan for an AI mission run. ### Method GET ### Endpoint /ai/missions/{mission_id}/runs/{run_id}/plan/steps/{step_id} ### Parameters #### Path Parameters - **mission_id** (string) - Required - The ID of the mission. - **run_id** (string) - Required - The ID of the run. - **step_id** (string) - Required - The ID of the step. ### Response #### Success Response (200) - **data** (PlanGetStepDetailsResponse) - The details of the plan step. ### Response Example { "data": { "id": "step_def456", "type": "plan_step", "attributes": { "name": "Step 1", "description": "First step in the plan.", "status": "pending" } } } ``` ```APIDOC ## PATCH /ai/missions/{mission_id}/runs/{run_id}/plan/steps/{step_id} ### Description Updates a specific step within a plan for an AI mission run. ### Method PATCH ### Endpoint /ai/missions/{mission_id}/runs/{run_id}/plan/steps/{step_id} ### Parameters #### Path Parameters - **mission_id** (string) - Required - The ID of the mission. - **run_id** (string) - Required - The ID of the run. - **step_id** (string) - Required - The ID of the step. #### Request Body - **params** (object) - Optional - Parameters for updating the step. ### Response #### Success Response (200) - **data** (PlanUpdateStepResponse) - The response indicating the step was updated. ### Response Example { "data": { "id": "step_def456", "type": "plan_step", "attributes": { "name": "Step 1 Updated", "description": "First step in the plan, now updated.", "status": "in_progress" } } } ``` -------------------------------- ### Bootstrap Environment with uv Source: https://github.com/team-telnyx/telnyx-python/blob/master/CONTRIBUTING.md Run this script to automatically provision a Python environment with the expected Python version using uv. ```sh ./scripts/bootstrap ``` -------------------------------- ### Create a Texml Application Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new Texml application. Accepts parameters for configuration. ```python from telnyx.types import ( TexmlApplication, TexmlApplicationCreateResponse, TexmlApplicationRetrieveResponse, TexmlApplicationUpdateResponse, TexmlApplicationDeleteResponse, ) client.texml_applications.create(**params) ``` -------------------------------- ### Create a Queue Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new queue. Configuration parameters should be passed as keyword arguments. ```python client.queues.create(**params) ``` -------------------------------- ### Create a Queue Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use this method to create a new queue for your account. Requires account SID and queue parameters. ```python from telnyx.types.texml.accounts import ( QueueCreateResponse, QueueRetrieveResponse, QueueUpdateResponse, QueueListResponse, ) client.texml.accounts.queues.create(account_sid, **params) ``` -------------------------------- ### Start Conversation Relay Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts a conversation relay for an active call. Requires the call control ID and optional parameters. ```APIDOC ## POST /calls/{call_control_id}/actions/conversation_relay_start ### Description Starts a conversation relay for an active call. ### Method POST ### Endpoint /calls/{call_control_id}/actions/conversation_relay_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call. #### Request Body - **params** (object) - Optional - Additional parameters for starting the conversation relay. ``` -------------------------------- ### Create Canary Deploy Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new canary deployment for an AI assistant. Requires an assistant ID and deployment parameters. ```python client.ai.assistants.canary_deploys.create(assistant_id, **params) ``` -------------------------------- ### Create a Public Internet Gateway Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiates the creation of a Public Internet Gateway. Configuration is passed as keyword arguments. ```python client.public_internet_gateways.create(**params) ``` -------------------------------- ### Preview Porting LoaConfiguration Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Generates a preview of a porting LOA configuration with specified parameters. ```python client.porting.loa_configurations.preview(**params) ``` -------------------------------- ### Create a Verify Profile Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Create a new verify profile with the specified parameters. ```python client.verify_profiles.create(**params) ``` -------------------------------- ### Create FQDN Connection Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Establishes a new FQDN connection. Requires configuration parameters. ```python client.fqdn_connections.create(**params) ``` -------------------------------- ### Determine Installed Telnyx Python Version Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Check the installed version of the `telnyx` library at runtime by importing the library and accessing the `__version__` attribute. ```python import telnyx print(telnyx.__version__) ``` -------------------------------- ### Run Tests Source: https://github.com/team-telnyx/telnyx-python/blob/master/CONTRIBUTING.md Execute the project's test suite using the provided script. ```sh ./scripts/test ``` -------------------------------- ### Users - Get Groups Report Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves a report of user groups. ```APIDOC ## GET /organizations/users/users_groups_report ### Description Fetches a report detailing user group information. ### Method GET ### Endpoint /organizations/users/users_groups_report ### Request Example ```python client.organizations.users.get_groups_report() ``` ### Response #### Success Response (200) - **UserGetGroupsReportResponse** (object) - Contains the user groups report data. ``` -------------------------------- ### List Porting LoaConfigurations Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Lists porting LOA configurations with optional parameters for filtering and pagination. ```python client.porting.loa_configurations.list(**params) ``` -------------------------------- ### Storage Buckets Usage Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Get usage statistics for storage buckets. ```APIDOC ## GET /storage/buckets/{bucketName}/usage/api ### Description Retrieves API usage statistics for a specific storage bucket. ### Method GET ### Endpoint /storage/buckets/{bucketName}/usage/api ### Parameters #### Path Parameters - **bucketName** (string) - Required - The name of the bucket. #### Query Parameters - **params** (object) - Optional - Parameters for filtering or paginating API usage. ### Request Example ```json { "example": "request body for get_api_usage" } ``` ### Response #### Success Response (200) - **response** (UsageGetAPIUsageResponse) - The response object containing API usage statistics. ### Response Example ```json { "example": "response body for get_api_usage" } ``` ``` ```APIDOC ## GET /storage/buckets/{bucketName}/usage/storage ### Description Retrieves storage usage statistics for a specific storage bucket. ### Method GET ### Endpoint /storage/buckets/{bucketName}/usage/storage ### Parameters #### Path Parameters - **bucketName** (string) - Required - The name of the bucket. ### Response #### Success Response (200) - **response** (UsageGetBucketUsageResponse) - The response object containing storage usage statistics. ### Response Example ```json { "example": "response body for get_bucket_usage" } ``` ``` -------------------------------- ### Get SimCard Device Details Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves device-specific details for a SimCard. ```APIDOC ## GET /sim_cards/{id}/device_details ### Description Retrieves detailed information about the device associated with a SimCard. ### Method GET ### Endpoint `/sim_cards/{id}/device_details` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the SimCard. ``` -------------------------------- ### Get SimCard Activation Code Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves the activation code for a specific SimCard. ```APIDOC ## GET /sim_cards/{id}/activation_code ### Description Fetches the activation code associated with a specific SimCard. ### Method GET ### Endpoint `/sim_cards/{id}/activation_code` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the SimCard. ``` -------------------------------- ### NumberLookup API Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Perform number lookups to get information about phone numbers. ```APIDOC ## GET /number_lookup/{phone_number} ### Description Retrieves information about a specific phone number. ### Method GET ### Endpoint /number_lookup/{phone_number} ### Parameters #### Path Parameters - **phone_number** (string) - Required - The phone number to look up. #### Query Parameters - **params** (object) - Optional - Additional parameters for the number lookup. ### Response #### Success Response (200) - **NumberLookupRetrieveResponse** (object) - The response object containing information about the phone number. ``` -------------------------------- ### Preview Porting LoaConfiguration (Variant 0) Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Generates a preview of a porting LOA configuration using a different preview method. ```python client.porting.loa_configurations.preview_0(**params) ``` -------------------------------- ### Get SimCard Public IP Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves the public IP address assigned to a SimCard. ```APIDOC ## GET /sim_cards/{id}/public_ip ### Description Fetches the public IP address currently assigned to a SimCard. ### Method GET ### Endpoint `/sim_cards/{id}/public_ip` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the SimCard. ``` -------------------------------- ### Create Migration Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new migration. This method is used to start a data migration process. ```python client.storage.migrations.create(**params) ``` -------------------------------- ### start_recording Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiates call recording. This is useful for compliance, quality assurance, or documentation purposes. ```APIDOC ## POST /calls/{call_control_id}/actions/record_start ### Description Initiates call recording. ### Method POST ### Endpoint /calls/{call_control_id}/actions/record_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call control. #### Request Body - **params** (object) - Optional - Additional parameters for starting call recording. ``` -------------------------------- ### Start Transcription Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Begins transcription of a call. Requires the call control ID and transcription parameters. ```python client.calls.actions.start_transcription(call_control_id, **params) ``` -------------------------------- ### Create a Porting LoaConfiguration Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new porting LOA configuration with specified parameters. ```python client.porting.loa_configurations.create(**params) ``` -------------------------------- ### Import Assistant Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Imports an AI assistant from a provided configuration. Allows for bulk creation or migration of assistants. ```APIDOC ## POST /ai/assistants/import ### Description Imports an AI assistant from a provided configuration. ### Method POST ### Endpoint /ai/assistants/import ### Parameters #### Request Body - **params** (object) - Required - Parameters for importing the assistant. ### Request Example ```json { "example": "request body for importing an assistant" } ``` ### Response #### Success Response (200) - **AssistantsList** (object) - A list of imported assistant objects. ### Response Example ```json { "example": "response body for imported assistants" } ``` ``` -------------------------------- ### Get Usecase Cost Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves the cost associated with a specific use case for 10DLC campaigns. ```APIDOC ## GET /10dlc/campaign/usecase/cost ### Description Retrieves the cost for a given use case in 10DLC campaigns. ### Method GET ### Endpoint /10dlc/campaign/usecase/cost ### Parameters #### Query Parameters - **params** (object) - Required - Parameters for the request, including use case details. ### Request Example ```python client.messaging_10dlc.campaign.usecase.get_cost(**params) ``` ### Response #### Success Response (200) - **UsecaseGetCostResponse** - The response object containing cost details. ``` -------------------------------- ### Create a Portout Supporting Document Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new supporting document for a specific portout, identified by its ID. ```python client.portouts.supporting_documents.create(id, **params) ``` -------------------------------- ### Configure HTTP Client with Proxies and Transports Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Customize the `httpx` client by passing it during `Telnyx` client initialization. This allows for advanced configurations such as setting proxies or custom transports. Ensure `httpx` and `Telnyx`, `DefaultHttpxClient` are imported. ```python import httpx from telnyx import Telnyx, DefaultHttpxClient client = Telnyx( # Or use the `TELNYX_BASE_URL` env var base_url="http://my.test.server.example.com:8083", http_client=DefaultHttpxClient( proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), ) ``` -------------------------------- ### Get Brand Feedback Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves feedback information for a specific brand, identified by its unique ID. ```APIDOC ## GET /10dlc/brand/feedback/{brandId} ### Description Retrieves feedback for a specific brand. ### Method GET ### Endpoint /10dlc/brand/feedback/{brandId} ### Parameters #### Path Parameters - **brand_id** (string) - Required - The unique identifier of the brand for which to retrieve feedback. ### Response #### Success Response (200) - **feedback** (BrandGetFeedbackResponse) - The feedback object for the brand. #### Response Example ```json { "example": "response body for brand feedback" } ``` ``` -------------------------------- ### Messaging 10DLC - Get Enum Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves an enum value for a specific 10DLC messaging endpoint. ```APIDOC ## GET /10dlc/enum/{endpoint} ### Description Retrieves an enum value for a specific 10DLC messaging endpoint. ### Method GET ### Endpoint /10dlc/enum/{endpoint} ### Parameters #### Path Parameters - **endpoint** (string) - Required - The specific 10DLC messaging endpoint. ``` -------------------------------- ### Create a Call Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiates a new call by providing the account SID and call parameters. ```python client.texml.accounts.calls.calls(account_sid, **params) -> CallCallsResponse ``` -------------------------------- ### Get Assistant TeXML Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves the TeXML representation of an AI assistant. Used for specific telephony integrations. ```APIDOC ## GET /ai/assistants/{assistant_id}/texml ### Description Retrieves the TeXML representation of an AI assistant. ### Method GET ### Endpoint /ai/assistants/{assistant_id}/texml ### Parameters #### Path Parameters - **assistant_id** (string) - Required - The unique identifier of the assistant. ### Response #### Success Response (200) - **string** - The TeXML string. ### Response Example ```json { "example": "..." } ``` ``` -------------------------------- ### Create a pronunciation dictionary Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new pronunciation dictionary. Accepts parameters for defining the dictionary's content and properties. ```python from telnyx.types import ( PronunciationDictAliasItem, PronunciationDictData, PronunciationDictPhonemeItem, PronunciationDictCreateResponse, PronunciationDictRetrieveResponse, PronunciationDictUpdateResponse, ) ``` ```python client.pronunciation_dicts.create(**params) -> PronunciationDictCreateResponse ``` -------------------------------- ### Create Migration Source Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new migration source. Use this to initiate the process of migrating data sources. ```python client.storage.migration_sources.create(**params) ``` -------------------------------- ### Start conversation relay Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Begin a conversation relay for a call. Requires the call control ID and parameters for the relay. ```python client.calls.actions.start_conversation_relay(call_control_id, **params) ``` -------------------------------- ### Retrieve Conference Recordings Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Get recordings for a specific conference using its conference SID. Requires the account SID. ```python client.texml.accounts.conferences.retrieve_recordings(conference_sid, *, account_sid) -> ConferenceRetrieveRecordingsResponse ``` -------------------------------- ### List Portout Supporting Documents Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Lists all supporting documents associated with a specific portout, identified by its ID. ```python client.portouts.supporting_documents.list(id) ``` -------------------------------- ### Configure Granular Timeouts with httpx.Timeout Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Illustrates how to use `httpx.Timeout` for fine-grained control over connect, read, and write timeouts when initializing the Telnyx client. Imports `Telnyx` and `httpx`. ```python from telnyx import Telnyx # More granular control: client = Telnyx( timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0), ) ``` -------------------------------- ### Get Storage Usage for Bucket Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves storage usage details for a specific bucket. Requires the bucket name. ```python client.storage.buckets.usage.get_bucket_usage(bucket_name) -> UsageGetBucketUsageResponse ``` -------------------------------- ### Get SimCard Device Details Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Fetch detailed information about the device associated with a specific SimCard, identified by its ID. ```python client.sim_cards.get_device_details(id) ``` -------------------------------- ### Create a verify profile Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new verify profile. ```APIDOC ## POST /verify_profiles ### Description Creates a new verify profile. ### Method POST ### Endpoint /verify_profiles ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating a verify profile. ``` -------------------------------- ### List Advanced Orders Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves a list of all advanced orders. This method can be used to get an overview of all created orders. ```python client.advanced_orders.list() -> AdvancedOrderListResponse ``` -------------------------------- ### Create Assistant Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new AI assistant. Accepts parameters for configuring the assistant's behavior and capabilities. ```APIDOC ## POST /ai/assistants ### Description Creates a new AI assistant. ### Method POST ### Endpoint /ai/assistants ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating the assistant. ### Request Example ```json { "example": "request body for creating an assistant" } ``` ### Response #### Success Response (200) - **InferenceEmbedding** (object) - The created assistant object. ### Response Example ```json { "example": "response body for created assistant" } ``` ``` -------------------------------- ### OAuth Introspection Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Introspect an OAuth token to get its status and associated information. Requires token details as parameters. ```python client.oauth.introspect(**params) -> OAuthIntrospectResponse ``` -------------------------------- ### start_noise_suppression Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Starts noise suppression for a given call. This action is useful for improving audio quality by reducing background noise. ```APIDOC ## POST /calls/{call_control_id}/actions/suppression_start ### Description Starts noise suppression for a given call. ### Method POST ### Endpoint /calls/{call_control_id}/actions/suppression_start ### Parameters #### Path Parameters - **call_control_id** (string) - Required - The unique identifier for the call control. #### Request Body - **params** (object) - Optional - Additional parameters for starting noise suppression. ``` -------------------------------- ### Making Calls with Nested Parameters Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Illustrates how to use nested parameters, specifically for the `answering_machine_detection_config` when making a call. ```APIDOC ## Making Calls with Nested Parameters ### Description Demonstrates how to pass complex, nested configuration objects as parameters to API methods, using `answering_machine_detection_config` as an example. ### Method `client.calls.dial()` ### Parameters - `connection_id` (string) - Required - The ID of the connection to use for the call. - `from_` (string) - Required - The phone number or SIP address to call from. - `to` (string) - Required - The phone number or SIP address to call. - `answering_machine_detection_config` (object) - Optional - Configuration for answering machine detection. - `after_greeting_silence_millis` (integer) - Milliseconds of silence after the greeting. - `between_words_silence_millis` (integer) - Milliseconds of silence between words. - `greeting_duration_millis` (integer) - Duration of the greeting. - `greeting_silence_duration_millis` (integer) - Milliseconds of silence within the greeting. - `greeting_total_analysis_time_millis` (integer) - Total time for greeting analysis. - `initial_silence_millis` (integer) - Milliseconds of initial silence. - `maximum_number_of_words` (integer) - Maximum number of words to detect. - `maximum_word_length_millis` (integer) - Maximum length of a detected word. - `silence_threshold` (integer) - Threshold for silence detection. - `total_analysis_time_millis` (integer) - Total time for analysis. ### Request Example ```python from telnyx import Telnyx client = Telnyx() response = client.calls.dial( connection_id="7267xxxxxxxxxxxxxx", from_="+18005550101", to="+18005550100 or sip:username@sip.telnyx.com;secure=srtp", answering_machine_detection_config={ "after_greeting_silence_millis": 1000, "between_words_silence_millis": 1000, "greeting_duration_millis": 1000, "greeting_silence_duration_millis": 2000, "greeting_total_analysis_time_millis": 50000, "initial_silence_millis": 1000, "maximum_number_of_words": 1000, "maximum_word_length_millis": 2000, "silence_threshold": 512, "total_analysis_time_millis": 5000, }, ) print(response.answering_machine_detection_config) ``` ### Response - `answering_machine_detection_config` (object) - The configuration used for answering machine detection. ``` -------------------------------- ### Start Noise Suppression Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiates noise suppression for a given call. Requires the call control ID and optional parameters. ```python client.calls.actions.start_noise_suppression(call_control_id, **params) ``` -------------------------------- ### Retrieve Call Status Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use the `retrieve_status` method to get the status of a call using its `call_control_id`. This returns a `CallRetrieveStatusResponse` object. ```python client.calls.retrieve_status(call_control_id) ``` -------------------------------- ### Run Portability Check Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiates a portability check for a phone number. Requires portability check parameters. ```python from telnyx.types import PortabilityCheckRunResponse client.portability_checks.run(**params) ``` -------------------------------- ### Create a Porting Report Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new porting report with specified parameters. ```python client.porting.reports.create(**params) ``` -------------------------------- ### Get SMS OTP by Reference Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves SMS OTP details using a reference ID. Useful for tracking OTP status. ```APIDOC ## GET /10dlc/brand/smsOtp/{referenceId} ### Description Retrieves SMS OTP details by reference ID. ### Method GET ### Endpoint /10dlc/brand/smsOtp/{referenceId} ### Parameters #### Path Parameters - **reference_id** (string) - Required - The reference ID for the SMS OTP. #### Query Parameters - **params** (object) - Optional - Additional parameters for retrieving SMS OTP details. ### Response #### Success Response (200) - **otp_details** (BrandGetSMSOtpByReferenceResponse) - The SMS OTP details. #### Response Example ```json { "example": "response body for SMS OTP by reference" } ``` ``` -------------------------------- ### Import Portout Supporting Document Types Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Imports necessary types for handling portout supporting documents. ```python from telnyx.types.portouts import ( PortOutSupportingDocument, SupportingDocumentCreateResponse, SupportingDocumentListResponse, ) ``` -------------------------------- ### Get Specific Siprec Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves details for a specific SIPREC session using its SID, along with the call SID and account SID. ```python client.texml.accounts.calls.siprec.siprec_sid_json(siprec_sid, *, account_sid, call_sid, **params) -> SiprecSiprecSidJsonResponse ``` -------------------------------- ### File Uploads Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Explains how to upload files using the library, specifying acceptable input types for file parameters. ```APIDOC ## File Uploads ### Description Details the accepted formats for file uploads to the API, including raw bytes, path-like objects, and tuples containing filename, content, and media type. ### Method `client.ai.audio.transcribe()` ### Parameters - `model` (string) - Required - The AI model to use for transcription. - `file` (bytes | PathLike | tuple) - Required - The file to upload. Can be provided as: - Raw bytes. - A `PathLike` object (e.g., `pathlib.Path`). - A tuple `(filename, contents, media_type)`. ### Request Example (using PathLike) ```python from pathlib import Path from telnyx import Telnyx client = Telnyx() client.ai.audio.transcribe( model="distil-whisper/distil-large-v2", file=Path("/path/to/your/audio/file.wav"), ) ``` ### Asynchronous File Uploads The asynchronous client supports the same interface. If a `PathLike` object is provided, the file contents will be read asynchronously. ``` -------------------------------- ### Create a Wireless Blocklist Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use this method to create a new wireless blocklist. Requires parameters for the blocklist configuration. ```python client.wireless_blocklists.create(**params) ``` -------------------------------- ### Get SimCard Public IP Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieve the public IP address assigned to a specific SimCard. This is useful for network connectivity checks. ```python client.sim_cards.get_public_ip(id) ``` -------------------------------- ### Summarize with AI Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Utilizes AI to summarize provided text or data. This method requires specific parameters to guide the summarization process. ```python client.ai.summarize(**params) -> AISummarizeResponse ``` -------------------------------- ### List Storage Migration Source Coverage Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves the migration source coverage for storage. Returns StorageListMigrationSourceCoverageResponse. ```python from telnyx.types import StorageListMigrationSourceCoverageResponse ``` ```python client.storage.list_migration_source_coverage() -> StorageListMigrationSourceCoverageResponse ``` -------------------------------- ### Get Specific Call Recording Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves details for a specific call recording using its SID, along with the call SID and account SID. ```python client.texml.accounts.calls.recordings.recording_sid_json(recording_sid, *, account_sid, call_sid, **params) -> RecordingRecordingSidJsonResponse ``` -------------------------------- ### Get AI Assistant TeXML Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves the TeXML representation of an AI assistant, identified by its ID. This is useful for understanding the assistant's structure. ```python client.ai.assistants.get_texml(assistant_id) ``` -------------------------------- ### Retrieve Porting LoaConfiguration Preview Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves a preview of a specific porting LOA configuration by its ID. ```python client.porting.loa_configurations.preview_1(id) ``` -------------------------------- ### List Verify Profiles Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md List all verify profiles with optional filtering parameters. ```python client.verify_profiles.list(**params) ``` -------------------------------- ### Retrieve a phone number's reputation Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use this method to get reputation data for a specific phone number. Requires the phone number as a parameter. ```python from telnyx.types.reputation import NumberRetrieveResponse ``` ```python client.reputation.numbers.retrieve(phone_number, **params) -> NumberRetrieveResponse ``` -------------------------------- ### Get Stream Streaming SID JSON Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieve JSON data for a specific stream using its streaming SID. Requires account and call SIDs. ```python client.texml.accounts.calls.streams.streaming_sid_json(streaming_sid, *, account_sid, call_sid, **params) -> StreamStreamingSidJsonResponse ``` -------------------------------- ### Create Room Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new room. Accepts optional parameters for room configuration. ```APIDOC ## POST /rooms ### Description Creates a new room with the specified parameters. ### Method POST ### Endpoint /rooms ### Parameters #### Request Body - **params** (object) - Optional - Parameters for room creation. ### Request Example ```json { "example": "request body for room creation" } ``` ### Response #### Success Response (200) - **RoomCreateResponse** (object) - Details of the created room. ### Response Example ```json { "example": "response body for room creation" } ``` ``` -------------------------------- ### Create a Portout Report Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Creates a new portout report with specified parameters. ```python client.portouts.reports.create(**params) ``` -------------------------------- ### Create Fax Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Initiates a new fax. Requires parameters specifying fax details. ```python client.faxes.create(**params) ``` -------------------------------- ### Get API Usage for Storage Bucket Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves API usage statistics for a specific storage bucket. Requires the bucket name and optional parameters for filtering. ```python from telnyx.types.storage.buckets import ( PaginationMetaSimple, UsageGetAPIUsageResponse, UsageGetBucketUsageResponse, ) ``` ```python client.storage.buckets.usage.get_api_usage(bucket_name, **params) -> UsageGetAPIUsageResponse ``` -------------------------------- ### List SIM Card Group Actions Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Lists all SIM card group actions with optional filtering parameters. Use this to get a paginated list of actions. ```python client.sim_card_groups.actions.list(**params) ``` -------------------------------- ### Retrieve Canary Deploy Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves an existing canary deployment for a specific AI assistant. Requires the assistant ID. ```python client.ai.assistants.canary_deploys.retrieve(assistant_id) ``` -------------------------------- ### Retrieve a SIM Card Group Action Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Retrieves a specific SIM card group action by its ID. This method is used to get details of a past action. ```python client.sim_card_groups.actions.retrieve(id) ``` -------------------------------- ### List Messaging Batch Detail Records Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Lists all available batch detail records for messaging. This endpoint can be used to get an overview of all generated messaging reports. ```APIDOC ## GET /legacy/reporting/batch_detail_records/messaging ### Description Lists all available batch detail records for messaging. ### Method GET ### Endpoint /legacy/reporting/batch_detail_records/messaging ### Response #### Success Response (200) - **MessagingListResponse** (object) - The response object containing a list of messaging batch detail records. ``` -------------------------------- ### Create AI Assistant Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use this method to create a new AI assistant. It requires parameters defined in `assistant_create_params.py`. ```python client.ai.assistants.create(**params) ``` -------------------------------- ### Create a Verify Profile Message Template Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Create a new message template for a verify profile using the provided parameters. ```python client.verify_profiles.create_template(**params) ``` -------------------------------- ### Create Fax Application Source: https://github.com/team-telnyx/telnyx-python/blob/master/api.md Use this method to create a new fax application. Requires parameters for configuration. ```python client.fax_applications.create(**params) ``` -------------------------------- ### Making Calls with Nested Parameters Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Construct API requests with complex, nested parameters using Python dictionaries. This example demonstrates setting up answering machine detection configuration for a call. ```python from telnyx import Telnyx client = Telnyx() response = client.calls.dial( connection_id="7267xxxxxxxxxxxxxx", from_="+18005550101", to="+18005550100 or sip:username@sip.telnyx.com;secure=srtp", answering_machine_detection_config={ "after_greeting_silence_millis": 1000, "between_words_silence_millis": 1000, "greeting_duration_millis": 1000, "greeting_silence_duration_millis": 2000, "greeting_total_analysis_time_millis": 50000, "initial_silence_millis": 1000, "maximum_number_of_words": 1000, "maximum_word_length_millis": 2000, "silence_threshold": 512, "total_analysis_time_millis": 5000, }, ) print(response.answering_machine_detection_config) ``` -------------------------------- ### Enable Telnyx Logging via Environment Variable Source: https://github.com/team-telnyx/telnyx-python/blob/master/README.md Explains how to enable logging for the Telnyx library by setting the `TELNYX_LOG` environment variable to 'info' or 'debug'. ```shell $ export TELNYX_LOG=info ```