Menu
Introduction Getting started SMS Promotional - Large campaigns Transactional - Basic Transactional (Alerts) - Virtual Number Route Transactional (Alerts) - Priority Routing Transactional (OTPs & Alerts) - Special route International route to Nigeria International route to Other Countries SMS DLR SMS DLR Webhooks Voice Voice OTP Voice Broadcasts Voice DLR Units Transfer Units to Sub-Account Transfer Units to Other Account Check Units Balance Sender IDs Register Sender IDs Check Sender ID status Categories Add Customer Remove Customer Virtual Number Inbox webhook Carrier Billing Run USSD Query Run Shortcode Query Query Status Carrier Callback Tools Create Sub-Account Check DND Status Check Service Status 3rd-party integrations ZOHO
Create Sub-Account Programatically create sub-accounts using the API. Read more about sub-accounts.
POST
https://api.textng.xyz/create-sub-account/
💡 USAGE There is no limit to how many times you can call the API.
PHP code
<?php
  $key="YOUR-ACCOUNT-KEY";
  $c_name="SUB-BUSINESS-NAME";
  $adminphone="PHONE-NUMBER";
  $c_category="SUB-BUSINESS-CATEGORY";
  $adminname="ACCOUNT-MANAGER";

  $response = httpPost("https://api.textng.xyz/create-sub-account/",array("key"=>"$key","company_name"=>"$c_name","company_category"=>"$c_category","admin_name"=>"$adminname","admin_phone"=>"$adminphone"));

  function httpPost($url, $data){
      $curl = curl_init($url);
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      $response = curl_exec($curl);
      curl_close($curl);

      echo $response;
  }
?>
jQuery code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
  var key="YOUR-ACCOUNT-KEY";
  var c_name="SUB-BUSINESS-NAME";
  var adminphone="PHONE-NUMBER";
  var c_category="SUB-BUSINESS-CATEGORY";
  var adminname="ACCOUNT-MANAGER";
  var url = "https://api.textng.xyz/create-sub-account/";

  $.post(url, { key: key, company_name: c_name, admin_phone: adminphone, adminname: adminname, company_category: c_category }, function (res) { 
      var data = JSON.parse(res);
      if (data.status === "SUCCESS") {
          // Do Success Work!
      } else {
          // Do Error Work!
      }
  });
</script>
Parameters
Parameter Example Description
Key * XXXXX-XXXX-XXXXX This can be found in the Developers page of your dashboard. The key authorizes the transaction.
company_name* XXX-XXX The name of the sub-business for which you are creating the sub-account.
admin_phone * 070001000 The phone for number of the sub-account's contact person.
admin_name * John Doe The name of the sub-account's contact person.
company_category The business category the new sub-account falls under. Use the corresponding number to represent the category

Category List

1 - Personal
2 - Automotive
3 - Social Media
4 - Beauty, Spa & Salon
5 - Clothing & Apparel
6 - Religeous
7 - Education
8 - Entertainment
9 - Event Planning & Service
10 - Finance & Banking
11 - Foreign Exchange
12 - Food & Grocery
13 - Gambling & Betting
14 - Gaming
15 - Hotel & Lodging
16 - Housing & Real Estate
17 - Information Technology
18 - Logistics
19 - Laundry Services
20 - Medical & Health
21 - Non-profit
22 - Restaurant
23 - Shopping & Retail
24 - Sports
25 - Travel & Transportation
26 - Telecommunications
27 - Other
Responses
JSON - Success
{'status': 'SUCCESS', 'response': 'Sub-Account Created', 'api-key' => 'XXXX-XXXX-XXXXX'}
JSON Error (Invalid key)
{'status': 'ERROR', 'response': 'ERROR Invalid Key'}
JSON Error (Incomplete parameters)
{'status': 'ERROR', 'response': 'ERROR Incomplete Parameters'}
JSON Error (Parent account error)
{'status': 'ERROR', 'response': 'ERROR Cannot Create Sub-Account Under Sub-Account'}
JSON Error (Invalid category)
{'status': 'ERROR', 'response': 'ERROR Invalid Category, Refer To Documentation'}
Other Errors
{'status': 'ERROR', 'response': 'ERROR Could Not Create Sub-Account'}