Send SMS
curl --request POST \
--url https://api.openmic.ai/v2/send-sms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from_number": "+16625658792",
"to_number": "+17189153182",
"message": "Hello from OpenMic! Here is your appointment link: https://example.com/book"
}
'import requests
url = "https://api.openmic.ai/v2/send-sms"
payload = {
"from_number": "+16625658792",
"to_number": "+17189153182",
"message": "Hello from OpenMic! Here is your appointment link: https://example.com/book"
}
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_number: '+16625658792',
to_number: '+17189153182',
message: 'Hello from OpenMic! Here is your appointment link: https://example.com/book'
})
};
fetch('https://api.openmic.ai/v2/send-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://api.openmic.ai/v2/send-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_number' => '+16625658792',
'to_number' => '+17189153182',
'message' => 'Hello from OpenMic! Here is your appointment link: https://example.com/book'
]),
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://api.openmic.ai/v2/send-sms"
payload := strings.NewReader("{\n \"from_number\": \"+16625658792\",\n \"to_number\": \"+17189153182\",\n \"message\": \"Hello from OpenMic! Here is your appointment link: https://example.com/book\"\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://api.openmic.ai/v2/send-sms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number\": \"+16625658792\",\n \"to_number\": \"+17189153182\",\n \"message\": \"Hello from OpenMic! Here is your appointment link: https://example.com/book\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmic.ai/v2/send-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_number\": \"+16625658792\",\n \"to_number\": \"+17189153182\",\n \"message\": \"Hello from OpenMic! Here is your appointment link: https://example.com/book\"\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_01kpbgtyntfktvzseh0ykcmqm4",
"from_number": "+16625658792",
"to_number": "+17189153182",
"message": "Hello from OpenMic! Here is your appointment link: https://example.com/book",
"status": "queued"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"success": true,
"message": "<string>",
"error": "<string>",
"retryAfter": 123
}{
"error": "<string>",
"details": "<string>"
}SMS
Send SMS
Send an SMS message to a phone number. Messages are sent via the Surge SMS API and queued for delivery.
POST
/
v2
/
send-sms
Send SMS
curl --request POST \
--url https://api.openmic.ai/v2/send-sms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from_number": "+16625658792",
"to_number": "+17189153182",
"message": "Hello from OpenMic! Here is your appointment link: https://example.com/book"
}
'import requests
url = "https://api.openmic.ai/v2/send-sms"
payload = {
"from_number": "+16625658792",
"to_number": "+17189153182",
"message": "Hello from OpenMic! Here is your appointment link: https://example.com/book"
}
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_number: '+16625658792',
to_number: '+17189153182',
message: 'Hello from OpenMic! Here is your appointment link: https://example.com/book'
})
};
fetch('https://api.openmic.ai/v2/send-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://api.openmic.ai/v2/send-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_number' => '+16625658792',
'to_number' => '+17189153182',
'message' => 'Hello from OpenMic! Here is your appointment link: https://example.com/book'
]),
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://api.openmic.ai/v2/send-sms"
payload := strings.NewReader("{\n \"from_number\": \"+16625658792\",\n \"to_number\": \"+17189153182\",\n \"message\": \"Hello from OpenMic! Here is your appointment link: https://example.com/book\"\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://api.openmic.ai/v2/send-sms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number\": \"+16625658792\",\n \"to_number\": \"+17189153182\",\n \"message\": \"Hello from OpenMic! Here is your appointment link: https://example.com/book\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmic.ai/v2/send-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_number\": \"+16625658792\",\n \"to_number\": \"+17189153182\",\n \"message\": \"Hello from OpenMic! Here is your appointment link: https://example.com/book\"\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_01kpbgtyntfktvzseh0ykcmqm4",
"from_number": "+16625658792",
"to_number": "+17189153182",
"message": "Hello from OpenMic! Here is your appointment link: https://example.com/book",
"status": "queued"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"success": true,
"message": "<string>",
"error": "<string>",
"retryAfter": 123
}{
"error": "<string>",
"details": "<string>"
}Authorizations
API key obtained from the OpenMic dashboard.
Body
application/json
Recipient phone number in E.164 format.
Example:
"+17189153182"
The text message to send. Must not be empty.
Example:
"Hello from OpenMic!"
Sender phone number in E.164 format. Optional — defaults to your account's Surge phone number if not provided.
Example:
"+16625658792"
Response
SMS queued for delivery
Unique message identifier.
Example:
"msg_01kpbgtyntfktvzseh0ykcmqm4"
The phone number the message was sent from.
Example:
"+16625658792"
The phone number the message was sent to.
Example:
"+17189153182"
The message body that was sent.
Example:
"Hello from OpenMic!"
The delivery status of the message.
Available options:
queued Example:
"queued"
Was this page helpful?
⌘I