# Rent and configure a virtual number using Python After searching for a number, rent and configure that number for SMS, Voice or both. Note: Before you can get started, you need the following already set up: - - [Python](https://www.python.org/) and a familiarity with how to create a new file. - A virtual number you have [confirmed to be available](/docs/numbers/getting-started/python-sdk/searchavailable). ## Installing the SDK The easiest way to install the SDK is using [`pip`](https://pypi.org/project/pip/): 1. Open a command prompt or terminal to the local repository folder. 2. Execute the following command: ```shell pip install sinch ``` ## Set up your Python application Now you can start setting up your application. ### Create your file Create a new file named `rent-config-number.py` and paste the provided code found on this page into the file. rent-config-number.py from sinch import SinchClient sinch_client = SinchClient( key_id="YOUR_key_id", key_secret="YOUR_key_secret", project_id="YOUR_project_id" ) activate_number_response = sinch_client.numbers.available.activate( phone_number="YOUR_phone_number", sms_configuration={ "servicePlanId": "YOUR_service_plan_id", "campaignId": "YOUR_10DLC_campaign_id" }, voice_configuration={ "appId": "YOUR_app_id" } ) print(activate_number_response) This code initializes the Sinch Client and then purchases and configures the number you specify. ### Modify your application The code provided includes placeholder parameters. You'll need to update the parameters detailed in the following subsections with your values. #### Initialize the client Before initializing a client using this SDK, you'll need three pieces of information: - Your Project ID - An access key ID - An access key Secret These values can be found on the [Access Keys](https://dashboard.sinch.com/settings/access-keys) page of the Sinch Build Dashboard. You can also [create new access key IDs and Secrets](https://community.sinch.com/t5/Conversation-API/How-to-get-your-access-key-for-Conversation-API/ta-p/8120), if required. Note If you have trouble accessing the above link, ensure that you have gained access to the [Conversation API](https://dashboard.sinch.com/convapi/overview) by accepting the corresponding terms and conditions. #### Fill in remaining parameters 1. Assign your values to the following parameters: | Parameter | Your value | | --- | --- | | `YOUR_servicePlanId` | Your [SMS service plan ID](https://dashboard.sinch.com/sms/api/rest)This is only required for SMS configuration. | | `YOUR_10DLC_campaignId` | Your 10DLC campaign ID for this campaign. Found on the [TCR](https://community.sinch.com/t5/10DLC/What-is-The-Campaign-Registry-TCR/ta-p/7024) platform. Remove this parameter entirely for non-10DLC numbers. | | `YOUR_appId` | The Voice app ID or voice API `key`. Found in the [Sinch Build Dashboard.](https://dashboard.sinch.com/voice/apps) | | `YOUR_phone_number` | The virtual phone number that you previously searched for and would like to rent. | 1. Save the file. ### Execute the code 1. Execute the code to rent and simultaneously configure your virtual number. Open a command prompt or terminal to the location where your Python file is saved and run the following command: ```shell python rent-config-number.py ``` #### Response You should get a response similar to this one: ```python ActivateNumberResponse( phone_number='+12067034732', region_code='US', type='LOCAL', capability=['SMS', 'VOICE'] ) ``` ## Next steps Send a message to yourself using the SMS API or the Voice API (after setting each up accordingly) to verify that the configuration was successful. - [Send an SMS message](/docs/sms/getting-started). - [Make a call](/docs/voice/getting-started/python-sdk/make-call). ## Additional resources - Explore the [API specification](/docs/numbers/api-reference/numbers) to test more endpoints. - Follow the number rental process [in the Sinch Build Dashboard](https://dashboard.sinch.com/numbers/buy-numbers) UI rather than through this API.