Skip to main content
POST
/
user
/
sms
Send SMS
curl --request POST \
  --url https://app.botrep.ai/api/user/sms \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from": 123,
  "to": "<string>",
  "body": "<string>"
}
'
import requests

url = "https://app.botrep.ai/api/user/sms"

payload = {
"from": 123,
"to": "<string>",
"body": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({from: 123, to: '<string>', body: JSON.stringify('<string>')})
};

fetch('https://app.botrep.ai/api/user/sms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.botrep.ai/api/user/sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => 123,
'to' => '<string>',
'body' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://app.botrep.ai/api/user/sms"

payload := strings.NewReader("{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://app.botrep.ai/api/user/sms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.botrep.ai/api/user/sms")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": 123,\n \"to\": \"<string>\",\n \"body\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "SMS sent successfully",
  "data": {
    "id": 456,
    "phone_number_id": 78,
    "to": "+1234567890",
    "body": "Hello! This is a test message from Your Company. How can we help you today?",
    "user_id": 1,
    "segments": 1,
    "segment_price": 0.0075,
    "total_cost": 0.0075,
    "status": "sent",
    "sms_sid": "SM1234567890abcdef1234567890abcdef",
    "created_at": "2025-08-04 15:30:00",
    "updated_at": "2025-08-04 15:30:02"
  }
}
{
  "message": "From number not found"
}
{
  "message": "Invalid to phone number"
}
{
  "message": "Insufficient balance"
}
{
  "message": "From number is not SMS capable"
}
{
  "message": "Failed to send SMS",
  "error": "Twilio API error details"
}
This endpoint allows you to send SMS messages using your purchased phone numbers. The SMS will be sent via Twilio and costs will be automatically deducted from your account balance.

Request Body

from
integer
required
The ID of your phone number to send the SMS from (must be SMS-capable)
to
string
required
The recipient’s phone number in international format (e.g., “+1234567890”)
body
string
required
The SMS message content (max 300 characters)

Response

message
string
Success message confirming SMS was sent
data
object

Error Responses

400 Bad Request
500 Internal Server Error
{
  "message": "SMS sent successfully",
  "data": {
    "id": 456,
    "phone_number_id": 78,
    "to": "+1234567890",
    "body": "Hello! This is a test message from Your Company. How can we help you today?",
    "user_id": 1,
    "segments": 1,
    "segment_price": 0.0075,
    "total_cost": 0.0075,
    "status": "sent",
    "sms_sid": "SM1234567890abcdef1234567890abcdef",
    "created_at": "2025-08-04 15:30:00",
    "updated_at": "2025-08-04 15:30:02"
  }
}
{
  "message": "From number not found"
}
{
  "message": "Invalid to phone number"
}
{
  "message": "Insufficient balance"
}
{
  "message": "From number is not SMS capable"
}
{
  "message": "Failed to send SMS",
  "error": "Twilio API error details"
}

Notes

  • The sender phone number must belong to the authenticated user
  • The sender phone number must be SMS-capable
  • The phone number subscription must be active (not expired)
  • Sufficient account balance is required to cover SMS costs
  • Phone numbers are automatically formatted to E.164 format
  • SMS costs vary by destination country and are charged per segment
  • Long messages may be split into multiple segments, increasing the cost
  • The recipient phone number must be valid according to international standards