Lease a dedicated virtual number.


We created a new viewing experience for our SMS API documentation. It's now all in one central location. Click here to check it out!


Parameter

Description

Required

numberThe virtual number to lease. Omit this field to be given a random number. Use get-numbers to find out which numbers are currently available.NO


Example: Lease a number and have all responses sent to your server

curl https://api.transmitsms.com/lease-number.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d number=61414000013 \
  -d 'forward_url=https://example.com/sms-responses.php'


JSON Response

{
  number: "61491570156",
  next_charge: "2014-09-25",
  auto_renew: true,
  status: "active",
  price: "29",
  forward_url: "https://example.com/sms"
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <number>61491570156</number>
  <next_charge>2014-09-25</next_charge>
  <auto_renew>true</auto_renew>
  <status>active</status>
  <price>29</status>
  <forward_url>https://example.com/sms</forward_url>
</response>



PHP Examples

<?php
 include '../../APIClient2.php';

 $api = new transmitsmsAPI('API_KEY', 'API_SECRET');
 $result = $api->leaseNumber('6140000000');

 if ($result->error->code == 'SUCCESS') {
   echo 'This number is {$result->status} and valid up to {$result->next_charge}';

 } else {
   echo 'Error: {$result->error->description}';
 }