#
Messages
#
Before You Start
There are two types of SMS messages, determined by their length:
- Simple SMS – A message containing up to 160 characters.
- Concatenated SMS – A message containing up to 39,015 characters, which is delivered as a single message on the recipient’s device.
These are sent as multiple SMS segments, with each 153-character segment being charged separately.
The GoSMS platform automatically detects when a message exceeds 153 characters. It will display an informational message showing the total number of SMS segments that will be billed.
note
GoSMS uses the Latin ISO-8859-1 character encoding, where each character occupies 1 byte.
"Special Characters & Encoding"
If your message contains special characters (e.g., diacritics, “, –, ˜, ™, €, ^, /, {, }, \, [, ], |) that are not part of the standard Latin alphabet, the system will switch to the extended character set.
In this case:
- Each character is encoded using 2 bytes.
- The maximum length is reduced to 70 characters for a single SMS.
- Concatenated messages are limited to 63 characters per segment.
#
Sending a Message
To send an SMS, make a POST request to the /message/send endpoint.
#
Parameters
#
Code Samples
curl -X POST "https://api.gosms.ro/v1/message/send" \
-H "X-Authorization: [YOUR_API_KEY]" \
-H "Content-Type: application/json" \
-d '{
"recipient": "0712345678",
"message": "This is a test message."
}'
try {
const res = await fetch("https://api.gosms.ro/v1/message/send", {
method: "POST",
headers: {
"X-Authorization": "[YOUR_API_KEY]",
"Content-Type": "application/json"
},
body: JSON.stringify({
recipient: "0712345678",
message: "This is a test message."
})
})
const json = await res.json()
console.log(json)
} catch(err) {
console.log(err)
}
<?php
$apiKey = "[YOUR_API_KEY]";
$url = "https://api.gosms.ro/v1/message/send";
$data = [
"recipient" => "0712345678",
"message" => "This is a test message."
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-Authorization: $apiKey",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
#
Response
On success, the endpoint returns a JSON response like the following:
{
"success": true,
"messageId": "dea3535d-2b1e-4c05-b3ea-6879c8d2516c",
"balanceDeduction": "0.03",
"currency": "EUR"
}