Sending
Send an SMS with POST /v1/messages
/v1/messagesSend one text to one number. The cost is taken from the balance when the request is accepted.
Request body
- tostringrequired
The number in international format, for example +14155550123. Spaces, dashes, brackets and a 00 prefix are cleaned.
- textstringrequired
The message. Up to 10 segments; see Text and segments.
- referencestringoptional
Your own id, up to 100 characters. It comes back in the message object and in every webhook.
- send_atstringoptional
ISO 8601 time to send, 2 minutes to 45 days ahead. Without it the message is queued at once.
Add an Idempotency-Key header to make retries safe: see Idempotency.
curl https://bulksmsapi.cc/v1/messages \
-H "Authorization: Bearer $BULKSMSAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+14155550123",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"reference": "login-7781"
}'// Node.js 18 or newer (built-in fetch)
const res = await fetch("https://bulksmsapi.cc/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BULKSMSAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
to: "+14155550123",
text: "Your Northwind code is 482913. It expires in 10 minutes.",
reference: "login-7781",
}),
});
const message = await res.json();
console.log(res.status, message.id, message.status, message.price);# Python 3, standard library only
import json, os, urllib.request
req = urllib.request.Request(
"https://bulksmsapi.cc/v1/messages",
data=json.dumps({
"to": "+14155550123",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"reference": "login-7781",
}).encode(),
headers={
"Authorization": "Bearer " + os.environ["BULKSMSAPI_KEY"],
"Content-Type": "application/json",
"User-Agent": "northwind-app/1.0",
},
method="POST",
)
with urllib.request.urlopen(req) as res:
message = json.load(res)
print(res.status, message["id"], message["status"], message["price"])<?php
// PHP 7.4 or newer with the curl extension
$ch = curl_init("https://bulksmsapi.cc/v1/messages");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("BULKSMSAPI_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"to" => "+14155550123",
"text" => "Your Northwind code is 482913. It expires in 10 minutes.",
"reference" => "login-7781",
]),
]);
$message = json_decode(curl_exec($ch), true);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $message["id"], " ", $message["status"], "\n";// Go 1.20 or newer, standard library only
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]any{
"to": "+14155550123",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"reference": "login-7781",
})
req, _ := http.NewRequest("POST", "https://bulksmsapi.cc/v1/messages", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("BULKSMSAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var message map[string]any
json.NewDecoder(res.Body).Decode(&message)
fmt.Println(res.StatusCode, message["id"], message["status"], message["price"])
}{
"id": "msg_8F3K2Q9TZ1MX",
"object": "message",
"batch_id": "bat_4M7Q1X0PK2RS",
"to": "+14155550123",
"country": "US",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"segments": 1,
"price": "0.00507",
"currency": "USD",
"status": "queued",
"error": null,
"reference": "login-7781",
"created_at": "2026-11-07T09:30:12.418Z",
"sent_at": null,
"done_at": null
}The message object
Fields
- idstring
Message id, msg_ followed by 12 characters.
- objectstring
Always message.
- batch_idstring
The batch the message belongs to (a single message also gets a batch).
- tostring
The number in E.164 format, after cleaning.
- countrystring
ISO 3166 code of the country the number was priced as.
- textstring
The text as sent, merge fields filled.
- segmentsinteger
Number of SMS segments the text uses.
- pricestring
Price of this message in USD, 5 decimals (price per segment times segments).
- currencystring
Always USD.
- statusstring
scheduled, queued, sent, delivered, failed or canceled.
- errorobject or null
For failed or canceled messages: code and message.
- referencestring or null
Your own reference from the request.
- created_atstring
When the request was accepted (ISO 8601, UTC).
- sent_atstring or null
When the message was handed to the network.
- done_atstring or null
When the final status (delivered, failed or canceled) was set.
Retrieve a message
/v1/messages/{id}One message by its msg_ id. Messages of other accounts answer 404.
curl https://bulksmsapi.cc/v1/messages/msg_8F3K2Q9TZ1MX \
-H "Authorization: Bearer $BULKSMSAPI_KEY"const res = await fetch("https://bulksmsapi.cc/v1/messages/msg_8F3K2Q9TZ1MX", {
headers: { Authorization: `Bearer ${process.env.BULKSMSAPI_KEY}` },
});
const message = await res.json();
console.log(message.status, message.error);import json, os, urllib.request
req = urllib.request.Request(
"https://bulksmsapi.cc/v1/messages/msg_8F3K2Q9TZ1MX",
headers={"Authorization": "Bearer " + os.environ["BULKSMSAPI_KEY"], "User-Agent": "northwind-app/1.0"},
)
with urllib.request.urlopen(req) as res:
message = json.load(res)
print(message["status"], message["error"])<?php
$ch = curl_init("https://bulksmsapi.cc/v1/messages/msg_8F3K2Q9TZ1MX");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("BULKSMSAPI_KEY")],
]);
$message = json_decode(curl_exec($ch), true);
echo $message["status"], "\n";package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://bulksmsapi.cc/v1/messages/msg_8F3K2Q9TZ1MX", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("BULKSMSAPI_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var message map[string]any
json.NewDecoder(res.Body).Decode(&message)
fmt.Println(message["status"], message["error"])
}List messages
/v1/messagesMessages of the account, newest first.
Query parameters
- batch_idstringoptional
Only messages of this bat_ batch.
- statusstringoptional
scheduled, queued, sent, delivered, failed or canceled.
- limitintegeroptional
1 to 100, default 20.
- starting_afterstringoptional
A msg_ id: the page starts after it. Use the last id of the previous page.
curl "https://bulksmsapi.cc/v1/messages?status=failed&limit=50" \
-H "Authorization: Bearer $BULKSMSAPI_KEY"{
"object": "list",
"data": [ { "id": "msg_8F3K2Q9TZ1MX", "object": "message", "status": "failed", "...": "..." } ],
"has_more": false
}