TextPort SMS API

TextPort SMS API

A REST-based text messaging API. Easily integrate SMS messaging into your apps.

View documentation...

SMS API for Developers

Send bulk SMS, customer alerts, notifications or announcements directly from your application. Start sending messages within minutes using TextPort's REST API. Works with any Inbound messages are free. Affordable, pay-as-you-go pricing.

Easy Integration

A simple, industry-standard RESTful API. Support for all development languages and platforms.

Competitive Pricing

Pay-as-you-go pricing. Pay for only what you need. No monthly minimums or recurring charges.

Choose Your Number

Select an area code, then choose your own dedicated virtual number. Use multiple numbers if you require a localized presence.

Pricing

Pay as you go. Only pay for what you need. No minimums, and no recurring charges.

$0.015

Outbound Text Message

FREE

Inbound Text and MMS Message

$0.025

Outbound MMS (Picture) Message

$6.00

Virtual Number 1 Month Lease



Sample Code



Sample Request Objects
[
    {
        "From": "12135551212",
        "To": "13035555323",
        "MessageText": "Sample message from TextPort SMS API"
    }
]
<ArrayOfMessage>
    <Message>
        <From>12135551212</From>
        <To>13035555323</To>
        <MessageText>Sample message from TextPort SMS API</MessageText>
    </Message>
</ArrayOfMessage>
[
    {
        "From": "12135551212",
        "To": "13035555323",
        "MessageText": "FIRST message from TextPort SMS API"
    },
    {
        "From": "12135551212",
        "To": "13035555323",
        "MessageText": "SECOND message"
    },
    {
        "From": "12135551212",
        "To": "13035555323",
        "MessageText": "THIRD message"
    }
]
<ArrayOfMessage>
    <Message>
        <From>12135551212</From>
        <To>13035555323</To>
        <MessageText>FIRST message from TextPort SMS API</MessageText>
    </Message>
    <Message>
        <From>12135551212</From>
        <To>13035555323</To>
        <MessageText>SECOND message</MessageText>
    </Message>
    <Message>
        <From>12135551212</From>
        <To>13035555323</To>
        <MessageText>THIRD message</MessageText>
    </Message>
</ArrayOfMessage>
Code Examples (using JSON payload)
POST /v1/messages/send HTTP/1.1
Host: api.textport.com
Content-Type: application/json
Authorization: Basic MS1vcVk0OUNFRzhzOldqTk1ya2t6ZnFLbnQwV2c1bVdk
[
    {
        "From": "12135551212",
        "To": "13035555323",
        "MessageText": "Sample text message from TextPort SMS API"
    }
]
var client = new RestClient("https://api.textport.com/v1/messages/send");
var request = new RestRequest(Method.POST);

request.AddHeader("Authorization", "Basic MS1vcVk0OUNFRzhzOldqTk1ya2t6ZnFLbnQwV2c1bVdk");
request.AddHeader("Content-Type", "application/json");

request.AddParameter("undefined", "[\n    {\n        \"From\": \"12135551212\",\n        \"To\": \"13035555323\",\n        \"MessageText\": \"Sample text message from TextPort SMS API\"\n    }\n]", ParameterType.RequestBody);

IRestResponse response = client.Execute(request);
setUrl('https://api.textport.com/v1/messages/send');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
    'Authorization' => 'Basic MS1vcVk0OUNFRzhzOldqTk1ya2t6ZnFLbnQwV2c1bVdk',
    'Content-Type' => 'application/json'
));

$request->setBody('[
    {
        "From": "12135551212",
        "To": "13035555323",
        "MessageText": "Sample text message from TextPort SMS API"
    }
]');

try {
    $response = $request->send();

    echo $response->getBody();
} catch (HttpException $ex) {
    echo $ex;
}
curl -X POST \
https://api.textport.com/v1/messages/send \
-H 'Authorization: Basic MS1vcVk0OUNFRzhzOldqTk1ya2t6ZnFLbnQwV2c1bVdk' \
-H 'Content-Type: application/json' \
-d '[
        {
            "From": "12135551212",
            "To": "13035555323",
            "MessageText": "Sample text message from TextPort SMS API"
        }
]'
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.textport.com/v1/messages/send",
    "method": "POST",
    "headers": {
    "Content-Type": "application/json",
    "Authorization": "Basic MS1vcVk0OUNFRzhzOldqTk1ya2t6ZnFLbnQwV2c1bVdk"
    },
    "processData": false,
    "data": "[\n    {\n        \"From\": \"12135551212\",\n        \"To\": \"13035555323\",\n        \"MessageText\": \"Sample text message from TextPort SMS API\"\n    }\n]"
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
import http.client

conn = http.client.HTTPConnection("api,textport,com")

payload = "[\n    {\n        \"From\": \"12135551212\",\n        \"To\": \"13035555323\",\n        \"MessageText\": \"Sample text message from TextPort SMS API\"\n    }\n]"

headers = {
'Content-Type': "application/json",
'Authorization': "Basic MS1vcVk0OUNFRzhzOldqTk1ya2t6ZnFLbnQwV2c1bVdk"
}

conn.request("POST", "v1,messages,send", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.textport.com/v1/messages/send")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Basic MS1vcVk0OUNFRzhzOldqTk1ya2t6ZnFLbnQwV2c1bVdk'
request.body = "[\n    {\n        \"From\": \"12135551212\",\n        \"To\": \"13035555323\",\n        \"MessageText\": \"Sample text message from TextPort SMS API\"\n    }\n]"

response = http.request(request)
puts response.read_body
Confirmation/Response
[
    {
        "From": "12135551212",
        "To": "13035555323",
        "MessageText": "Sample text message from TextPort SMS API",
        "Status": "OK",
        "ErrorMessage": "",
        "MessageId": 1190269079,
        "Balance": 9.53
    }
]
<ArrayOfMessagesResult>
    <MessagesResult>
        <From>12135551212</From>
        <To>13035555323</To>
        <MessageText>Sample message from TextPort SMS API</MessageText>
        <Status>OK</Status>
        <ErrorMessage />
        <MessageId>10269080</MessageId>
        <Balance>9.5150</Balance>
    </MessagesResult>
</ArrayOfMessagesResult>

Note: The default format for response content is JSON. Adding an HTTP header Accept: application/xml will set the response format to XML.