Textlocal Logo

API Documentation

API Introduction

With your Textlocal account you have instant access to our API, this enables you to easily integrate our SMS and MMS services with your website, software or CRM application in PHP, ASP, .NET, Java or any other language.

Caution: Textlocal cannot recover any information that is deleted through our API. Please make sure that all API calls contain values that are checked first.

Parameters

Every API request supports the following parameters.

apiKey You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address.
Optional Parameters
format Format of the response. May be either json or xml. If not provided, defaults to json.

Requests

All API requests should be sent to https://api.txtlocal.com/{command}, where command is the API call you wish to execute, with the parameters included either in the POST Header or the URL (GET).

Note: If using GET, all variables sent should be URL encoded. For PHP, this is achieved with wrapping the variable with urlencode() or Server.UrlEncode() with ASP.

Responses

Responses are, by default, sent in JSON format. However, this can be changed to XML with the format parameter.
Every response will contain a "status" field, which can be either "success" or "failure". This field can be used to determine whether your request was successful.

Errors

If there’s a problem with your request, our API may return "errors" in its response. These codes can be found in the errors field. For example, the following response indicates that the specified command is unrecognised:

{
	"errors":[{
		"code":2,
		"message":"Unrecognised command"
	}],
	"status":"failure"
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
	<errors>
		<error>
			<code>2</code>
			<message>Unrecognised command</message>
		</error>
	</errors>
	<status>failure</status>
</response>
Error Codes
1 No command specified.
2 Unrecognised command.
3 Invalid login details.

Note: Errors are fatal and will always result in a "failure" status.

Warnings

Warning codes indicate there was a potential problem with your request, but it didn't prevent the request from being processed. These codes can be found in the warnings field. For example, the following response indicates that the supplied format was unrecognised. If the format is unrecognised the response will fall back onto it's default, JSON:

{
	"warnings":[{
		"code":1,
		"message":"Unrecognised response format"
	}]
}
Warning Codes
1 Unrecognised response format.