# Rent and configure your virtual number using PHP 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: - - A virtual number you have [confirmed to be available](/docs/numbers/getting-started/php/searchavailable). - [PHP](https://www.php.net/manual/en/install.php) 7.3.0 or later and a familiarity with how to create a new file. - cURL 7.61.0 or later installed ## Rent and configure your virtual number ## Fill in your parameters 1. Create a file (example: `rent-config-number.php`) and add the supplied sample code. rent-config-number.php array( "servicePlanId" => "YOUR_servicePlanId", "scheduledProvisioning" => array( "status" => "WAITING", "errorCodes" => array( "INTERNAL_ERROR" ) ), "campaignId" => "YOUR_campaignId" ), "voiceConfiguration" => array( "appId" => "YOUR_appId", "scheduledProvisioning" => array( "status" => "WAITING" ) ) ); curl_setopt_array($curl, [ CURLOPT_HTTPHEADER => [ "Content-Type: application/json" ], CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_URL => "https://numbers.api.sinch.com/v1/projects/" . projectId . "/availableNumbers/" . phoneNumber . ":rent", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", ]); $response = curl_exec($curl); $error = curl_error($curl); curl_close($curl); if ($error) { echo "cURL Error #:" . $error; } else { echo $response; } ?> | Parameter | Your value | | --- | --- | | `YOUR_username` | your `client_id` or `key_id` found in the [Sinch Build Dashboard](https://dashboard.sinch.com/settings/access-keys). | | `YOUR_password` | Your `client_secret` or `key_secret`. This is generated upon new key creation in the Sinch Build Dashboard. Generate a new key if you have lost your secret key. | | `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) This is only required for Voice configuration. | | `YOUR_ProjectID` | The project ID found in the [Sinch Build Dashboard](https://dashboard.sinch.com/settings/access-keys). | | `YOUR_PhoneNumber` | The virtual phone number that you previously searched for and would like to rent. | 1. Save the file. ### Run the code ```bash php rent-config-number.php ``` #### Response You should get a response similar to this one: ```json { "phoneNumber": "+12025550134", "projectId": "51bc3f40-f266-4ca8-8938-a1ed0ff32b9a", "displayName": "string", "regionCode": "US", "type": "MOBILE", "capability": [ "SMS" ], "money": { "currencyCode": "USD", "amount": "2.00" }, "paymentIntervalMonths": 0, "nextChargeDate": "2019-08-24T14:15:22Z", "expireAt": "2019-08-24T14:15:22Z", "smsConfiguration": { "servicePlanId": "82b42acf74924bd687ef9fb212f2060c", "scheduledProvisioning": { "servicePlanId": "82b42acf74924bd687ef9fb212f20611", "status": "WAITING", "lastUpdatedTime": "2019-08-24T14:15:22Z", "campaignId": "string", "errorCodes": [ "INTERNAL_ERROR" ] }, "campaignId": "string" }, "voiceConfiguration": { "appId": "string", "scheduledVoiceProvisioning": { "appId": "string", "status": "WAITING", "lastUpdatedTime": "2019-08-24T14:15:22Z" }, "lastUpdatedTime": "2019-08-24T14:15:22Z" } } ``` ## 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/php/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.