API Keys are here

Our new API now supports api keys, meaning the login details for a Textlocal account can be separate from those used to access the API!

We’ve been asked about it quite a few times since our new API went live last year, and as always, when customers ask, we deliver!

An example of this would be:

  • You’ve created a Textlocal account, and now want to integrate the API with your software or website.
  • Your software developers will need to do this, and so that they don’t have full access to your account, you can provide them with an apiKey just for them.

Another example will be where you have multiple API calls to us from different servers/services, and again you want each to have it’s own access so that it can be tracked. And you can also limit each apiKey by IP address – another level of security.
It also means that if you reset your Textlocal account email address and/or password, it won’t change the apiKey!

Here’s a PHP code example using our Send API:

  1. <?php
  2. // Textlocal account details
  3. $apikey = ‘028337580-30wq7g5neuwnrgeyugh’;
  4. // Message details
  5. $numbers = array(447123456789, 447987654321);
  6. $sender = urlencode(‘YourName’);
  7. $message = urlencode(‘This is your message’);
  8. $numbers = implode(‘,’, $numbers);
  9. // Prepare data for POST request
  10. $data = array(‘apikey’ => $apikey, numbers’ => $numbers, “sender” => $sender, “message” => $message);
  11. // Send the POST request with cURL
  12. $ch = curl_init(‘http://api.txtlocal.com/send/’);
  13. curl_setopt($ch, CURLOPT_POST, true);
  14. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  16. $response = curl_exec($ch);
  17. curl_close($ch);
  18. // Process your response here
  19. echo $response;
  20. ?>