Send a message
curl --request POST \
--url https://osis.co/api/v1/comms/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "<string>",
"conversation_id": "<string>",
"body": "<string>",
"channel": "<string>",
"idempotency_key": "<string>"
}
'import requests
url = "https://osis.co/api/v1/comms/messages"
payload = {
"to": "<string>",
"conversation_id": "<string>",
"body": "<string>",
"channel": "<string>",
"idempotency_key": "<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({
to: '<string>',
conversation_id: '<string>',
body: JSON.stringify('<string>'),
channel: '<string>',
idempotency_key: '<string>'
})
};
fetch('https://osis.co/api/v1/comms/messages', 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://osis.co/api/v1/comms/messages",
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([
'to' => '<string>',
'conversation_id' => '<string>',
'body' => '<string>',
'channel' => '<string>',
'idempotency_key' => '<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://osis.co/api/v1/comms/messages"
payload := strings.NewReader("{\n \"to\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"body\": \"<string>\",\n \"channel\": \"<string>\",\n \"idempotency_key\": \"<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://osis.co/api/v1/comms/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"body\": \"<string>\",\n \"channel\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://osis.co/api/v1/comms/messages")
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 \"to\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"body\": \"<string>\",\n \"channel\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyMessages
Send a message
POST /api/v1/comms/messages — place an outbound SMS or iMessage on your line.
POST
https://osis.co
/
api
/
v1
/
comms
/
messages
Send a message
curl --request POST \
--url https://osis.co/api/v1/comms/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "<string>",
"conversation_id": "<string>",
"body": "<string>",
"channel": "<string>",
"idempotency_key": "<string>"
}
'import requests
url = "https://osis.co/api/v1/comms/messages"
payload = {
"to": "<string>",
"conversation_id": "<string>",
"body": "<string>",
"channel": "<string>",
"idempotency_key": "<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({
to: '<string>',
conversation_id: '<string>',
body: JSON.stringify('<string>'),
channel: '<string>',
idempotency_key: '<string>'
})
};
fetch('https://osis.co/api/v1/comms/messages', 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://osis.co/api/v1/comms/messages",
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([
'to' => '<string>',
'conversation_id' => '<string>',
'body' => '<string>',
'channel' => '<string>',
'idempotency_key' => '<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://osis.co/api/v1/comms/messages"
payload := strings.NewReader("{\n \"to\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"body\": \"<string>\",\n \"channel\": \"<string>\",\n \"idempotency_key\": \"<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://osis.co/api/v1/comms/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"body\": \"<string>\",\n \"channel\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://osis.co/api/v1/comms/messages")
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 \"to\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"body\": \"<string>\",\n \"channel\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPlace an outbound message on your Comms line.
Scope:
comms_send
Request
curl -X POST "https://osis.co/api/v1/comms/messages" \
-H "Authorization: Bearer $COMMS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-4242-confirm" \
-d '{
"to": "+12125550147",
"body": "Your appointment is confirmed for Tuesday at 3pm."
}'
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <COMMS_API_KEY> |
Content-Type | Yes | application/json |
Idempotency-Key | Recommended | Stable key for safe retries |
Body parameters
E.164 destination phone number. Required unless
conversation_id is set.Existing conversation to continue. Required unless
to is set.Message text delivered to the recipient.
Optional preference:
sms or imessage. Omit to let Comms choose.Same as the
Idempotency-Key header. Either form is accepted.Response
202 Accepted
First time this idempotency key is seen.{
"message": {
"id": "msg_01HZX…",
"body": "Your appointment is confirmed for Tuesday at 3pm.",
"direction": "outbound"
}
}
200 OK (duplicate)
Same idempotency key already processed — no second send.{
"message": {
"id": "msg_01HZX…",
"body": "Your appointment is confirmed for Tuesday at 3pm.",
"direction": "outbound"
},
"duplicate": true
}
Errors
| Status | Example body | Cause |
|---|---|---|
| 401 | { "error": "unauthorized" } | Bad or missing key |
| 403 | { "error": "missing comms_send scope" } | Key lacks send |
| 429 | { "error": "rate_limited", "retry_after": 60 } | Send or global limit |
Code samples
await fetch("https://osis.co/api/v1/comms/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMMS_API_KEY!}`,
"Content-Type": "application/json",
"Idempotency-Key": `order-${orderId}-confirm`,
},
body: JSON.stringify({
to: customerPhone,
body: "Your appointment is confirmed for Tuesday at 3pm.",
}),
});
requests.post(
"https://osis.co/api/v1/comms/messages",
headers={
"Authorization": f"Bearer {os.environ['COMMS_API_KEY']}",
"Content-Type": "application/json",
"Idempotency-Key": f"order-{order_id}-confirm",
},
json={
"to": customer_phone,
"body": "Your appointment is confirmed for Tuesday at 3pm.",
},
)
See also
⌘I

