Send SMS
Send a text message to one number or many with the legacy HTTP API (submitsm.aspx). Plain-text response with a job ID.
https://msgapi.wire2air.com/smsapi/submitsm.aspxParameters
| Parameter | In | Description |
|---|---|---|
| version stringrequired in body | body | API version. Always 2.0. |
| userid stringrequired in body | body | Your Wire2Air user ID. See authentication. |
| password stringrequired in body | body | Your Wire2Air password. |
| vasid stringrequired in body | body | Your VASID, from Manage Account → API Information. |
| from stringrequired in body | body | The short code Wire2Air assigned to your account. |
| to stringrequired in body | body | Destination mobile number: country code, then the number. Separate several numbers with commas to send the same message to all of them (bulk messaging). |
| text stringrequired in body | body | The message. See message length. |
| DeliveryDateTime stringoptional in body | body | When to deliver, in UTC. The example is Sunday, July 13, 1997, 8:00 PM in New York. See scheduling. |
| ReplyPath stringoptional in body | body | Your URL that receives replies from the recipient. Available case by case, with the advanced developer API only. |
| BatchName stringoptional in body | body | For bulk sends only: a name for the batch. |
The documentation lists these names in capitals (VERSION, USERID …) and uses lower case in its examples; the examples here use lower case for the same reason.
Message length and characters
The previous docs listed these characters as allowed in messages and subjects: a-z, A-Z, 0-9 and . , : ; ! ? ( ) ~ = + - _ \ / @ $ # & % ' ". For a line break, use \r\n, for example Your class is scheduled on\r\nJuly 24th @ 7:00PM.
Examples
curl "https://msgapi.wire2air.com/smsapi/submitsm.aspx" \
--data-urlencode "version=2.0" \
--data-urlencode "userid=YOUR_USERID" \
--data-urlencode "password=YOUR_PASSWORD" \
--data-urlencode "vasid=YOUR_VASID" \
--data-urlencode "from=27126" \
--data-urlencode "to=12121234567" \
--data-urlencode "text=Your order has shipped."
import urllib.error
import urllib.parse
import urllib.request
params = urllib.parse.urlencode({
"version": "2.0",
"userid": "YOUR_USERID",
"password": "YOUR_PASSWORD",
"vasid": "YOUR_VASID",
"from": "27126",
"to": "12121234567",
"text": "Your order has shipped.",
})
request = urllib.request.Request(
"https://msgapi.wire2air.com/smsapi/submitsm.aspx",
data=params.encode("utf-8"),
method="POST",
)
try:
with urllib.request.urlopen(request, timeout=30) as response:
print(response.status, response.read().decode("utf-8"))
except urllib.error.HTTPError as error:
print(error.code, error.read().decode("utf-8"))
const params = new URLSearchParams({
version: "2.0",
userid: "YOUR_USERID",
password: "YOUR_PASSWORD",
vasid: "YOUR_VASID",
from: "27126",
to: "12121234567",
text: "Your order has shipped.",
});
const response = await fetch("https://msgapi.wire2air.com/smsapi/submitsm.aspx", {
method: "POST",
body: params, // sent as application/x-www-form-urlencoded
});
console.log(response.status, await response.text());
<?php
$params = http_build_query([
'version' => '2.0',
'userid' => 'YOUR_USERID',
'password' => 'YOUR_PASSWORD',
'vasid' => 'YOUR_VASID',
'from' => '27126',
'to' => '12121234567',
'text' => 'Your order has shipped.',
]);
$ch = curl_init('https://msgapi.wire2air.com/smsapi/submitsm.aspx');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$body = curl_exec($ch);
if ($body === false) {
echo 'Request failed: ' . curl_error($ch) . PHP_EOL;
} else {
echo curl_getinfo($ch, CURLINFO_HTTP_CODE) . ' ' . $body . PHP_EOL;
}
curl_close($ch);
using System;
using System.Collections.Generic;
using System.Net.Http;
var parameters = new Dictionary<string, string>
{
["version"] = "2.0",
["userid"] = "YOUR_USERID",
["password"] = "YOUR_PASSWORD",
["vasid"] = "YOUR_VASID",
["from"] = "27126",
["to"] = "12121234567",
["text"] = "Your order has shipped.",
};
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://msgapi.wire2air.com/smsapi/submitsm.aspx")
{
Content = new FormUrlEncodedContent(parameters),
};
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
Response
The response is one line of plain text.
JOBID: [MOBILENUMBER]:[SMSID]
ERR: 301: Failed authentication
ERR: 305: Not enough credits
| Response | Meaning |
|---|---|
JOBID: [MOBILENUMBER]:[SMSID] | Accepted. SMSID is the message's reference. |
ERR: 301: Failed authentication | Wrong user ID, password or VASID. |
ERR: 305: Not enough credits | Top up your account. |
Only these two errors are documented for this endpoint. See Errors for the codes other HTTP API endpoints return.

