Skip to main content
POST
/
api
/
v1
/
sms
/
send
Send an SMS message
curl --request POST \
  --url https://{subdomain}.mihu.ai/api/v1/sms/send \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agentId": "32d8fc98-be1e-4d32-a12e-146f397fb1cb",
  "phoneNumber": "+12345678900",
  "message": "Hello! Your appointment is confirmed for tomorrow at 10:00 AM."
}
'
import requests

url = "https://{subdomain}.mihu.ai/api/v1/sms/send"

payload = {
"agentId": "32d8fc98-be1e-4d32-a12e-146f397fb1cb",
"phoneNumber": "+12345678900",
"message": "Hello! Your appointment is confirmed for tomorrow at 10:00 AM."
}
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({
agentId: '32d8fc98-be1e-4d32-a12e-146f397fb1cb',
phoneNumber: '+12345678900',
message: 'Hello! Your appointment is confirmed for tomorrow at 10:00 AM.'
})
};

fetch('https://{subdomain}.mihu.ai/api/v1/sms/send', 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://{subdomain}.mihu.ai/api/v1/sms/send",
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([
'agentId' => '32d8fc98-be1e-4d32-a12e-146f397fb1cb',
'phoneNumber' => '+12345678900',
'message' => 'Hello! Your appointment is confirmed for tomorrow at 10:00 AM.'
]),
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://{subdomain}.mihu.ai/api/v1/sms/send"

payload := strings.NewReader("{\n \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"phoneNumber\": \"+12345678900\",\n \"message\": \"Hello! Your appointment is confirmed for tomorrow at 10:00 AM.\"\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://{subdomain}.mihu.ai/api/v1/sms/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"phoneNumber\": \"+12345678900\",\n \"message\": \"Hello! Your appointment is confirmed for tomorrow at 10:00 AM.\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{subdomain}.mihu.ai/api/v1/sms/send")

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 \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"phoneNumber\": \"+12345678900\",\n \"message\": \"Hello! Your appointment is confirmed for tomorrow at 10:00 AM.\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "SMS message sent successfully",
  "data": {
    "messageId": "4010122d-3cf7-4670-b74c-2f5e2f3e79c0",
    "recipientPhone": "+12345678900",
    "conversationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}
{
"success": false,
"message": "Failed to send SMS: Invalid destination number",
"data": [
"<unknown>"
]
}
{
"success": false,
"message": "Agent not found | SMS not configured for this agent | SMS phone number not configured properly",
"data": [
"<unknown>"
]
}
{
"success": false,
"message": "The agentId field is required. | The phoneNumber format is invalid.",
"data": [
"<unknown>"
]
}
{
"success": false,
"message": "Failed to send SMS message",
"data": [
"<unknown>"
]
}

Authorizations

Authorization
string
header
required

Use a Bearer token to access these API endpoints. Example: "Bearer {your-token}"

Body

application/json
agentId
string<uuid>
required

UUID of the Agent. Must exist and have SMS channel configured.

Example:

"32d8fc98-be1e-4d32-a12e-146f397fb1cb"

phoneNumber
string
required

Phone number of the recipient in E.164 format (e.g., +1234567890).

Example:

"+12345678900"

message
string
required

SMS message body. Must be between 1 and 1600 characters.

Required string length: 1 - 1600
Example:

"Hello! Your appointment is confirmed for tomorrow at 10:00 AM."

Response

Success

success
boolean

Indicates whether the request completed successfully. True for successful responses; false for documented error responses.

Example:

true

message
string

Human-readable response message. Safe to display in logs or simple client notifications; use structured fields for program logic.

Example:

"SMS message sent successfully"

data
object