Getting started
Get your Wire2Air API credentials, find the base URLs and send your first text message.
What you need
- A Wire2Air account with a texting number: a short code (for example
27126) or another number Wire2Air has assigned to you. Wherever these docs sayfromorSHORTCODE, they mean this number. - Message credits on the account. Every sent message part uses credits; see message length.
- A server that can make HTTPS requests. Keep all calls server-side, so your credentials never reach a browser or a phone.
Get your credentials
Log in to the Wire2Air dashboard at app.wire2air.com with your username and password. (The old address, mzone.wire2air.com, now redirects there.)
REST API key
- Go to Manage Account → Manage API Keys.
- Select Generate New API Key.
- Enter a name for the key. It is only a label, so pick anything that tells you where the key is used.
- Copy the key with the Copy to Clipboard icon.
- Select Save Changes. The message "API Key saved successfully" appears above the table.
HTTP API credentials
The legacy HTTP API uses your account user ID and password together with a VASID. Find the VASID under Manage Account → API Information. Some HTTP API endpoints use an app key (APPKEY) instead; the carrier lookup page says it is under Manage Account → API Information too.
Authentication explains which credential each endpoint takes.
Base URLs
| API | Base URL |
|---|---|
| REST API v1 | https://msgapi.wire2air.com/rest/v1 |
| HTTP API, send SMS | https://msgapi.wire2air.com/smsapi/submitsm.aspx |
| HTTP API, send MMS | http://mms.wire2air.com/mms/submitmms.aspx (plain HTTP; see Send MMS) |
| HTTP API, other endpoints | Listed on each endpoint's page |
Send your first message
Send a POST to /message with your API key in the apikey header. Replace YOUR_API_KEY, the destination number and the from number with your own.
curl "https://msgapi.wire2air.com/rest/v1/message" \
-H "apikey: YOUR_API_KEY" \
--data-urlencode "to=12121234567" \
--data-urlencode "from=27126" \
--data-urlencode "text=Your order has shipped."
import urllib.error
import urllib.parse
import urllib.request
params = urllib.parse.urlencode({
"to": "12121234567",
"from": "27126",
"text": "Your order has shipped.",
})
request = urllib.request.Request(
"https://msgapi.wire2air.com/rest/v1/message",
data=params.encode("utf-8"),
headers={"apikey": "YOUR_API_KEY"},
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({
to: "12121234567",
from: "27126",
text: "Your order has shipped.",
});
const response = await fetch("https://msgapi.wire2air.com/rest/v1/message", {
method: "POST",
headers: { apikey: "YOUR_API_KEY" },
body: params, // sent as application/x-www-form-urlencoded
});
console.log(response.status, await response.text());
<?php
$params = http_build_query([
'to' => '12121234567',
'from' => '27126',
'text' => 'Your order has shipped.',
]);
$ch = curl_init('https://msgapi.wire2air.com/rest/v1/message');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
CURLOPT_HTTPHEADER => ['apikey: YOUR_API_KEY'],
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>
{
["to"] = "12121234567",
["from"] = "27126",
["text"] = "Your order has shipped.",
};
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://msgapi.wire2air.com/rest/v1/message")
{
Content = new FormUrlEncodedContent(parameters),
};
request.Headers.Add("apikey", "YOUR_API_KEY");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
A queued message returns HTTP 201 and a JSON body with the message ID:
{
"Response": "Message Queued successfully",
"URI": "v1/message/outbox/85582790",
"ID": "85582790",
"Type": "Out"
}
If something is wrong, the response is HTTP 400 with an application error, for example a missing text:
{
"StatusCode": 703,
"StatusMessage": "Text Message missing."
}
Testing
Next steps
- Send a message: every parameter, scheduling and bulk sends.
- Receive replies on your server.
- Errors: the status codes and application error codes to handle.

