1
Get your API credentials
You can authenticate using either JWT Bearer tokens or API keys.Option A: JWT AuthenticationResponse:Option B: API KeyAlternatively, you can use an API key from your dashboard settings.
curl -X POST https://api-message.nativehub.live/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "your_username",
"password": "your_password"
}'
const axios = require('axios');
const response = await axios.post('https://api-message.nativehub.live/api/v1/auth/login', {
username: 'your_username',
password: 'your_password'
});
const { access_token, refresh_token } = response.data;
import requests
response = requests.post(
'https://api-message.nativehub.live/api/v1/auth/login',
json={
'username': 'your_username',
'password': 'your_password'
}
)
data = response.json()
access_token = data['access_token']
refresh_token = data['refresh_token']
<?php
$ch = curl_init('https://api-message.nativehub.live/api/v1/auth/login');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'username' => 'your_username',
'password' => 'your_password'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
$data = json_decode($response, true);
$access_token = $data['access_token'];
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type LoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
type LoginResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
func main() {
body, _ := json.Marshal(LoginRequest{
Username: "your_username",
Password: "your_password",
})
resp, _ := http.Post(
"https://api-message.nativehub.live/api/v1/auth/login",
"application/json",
bytes.NewBuffer(body),
)
var loginResp LoginResponse
json.NewDecoder(resp.Body).Decode(&loginResp)
}
import java.net.http.*;
import java.net.URI;
import com.google.gson.Gson;
public class NativeMessage {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String requestBody = new Gson().toJson(Map.of(
"username", "your_username",
"password", "your_password"
));
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-message.nativehub.live/api/v1/auth/login"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
}
}
using System.Net.Http;
using System.Text;
using System.Text.Json;
var client = new HttpClient();
var content = new StringContent(
JsonSerializer.Serialize(new {
username = "your_username",
password = "your_password"
}),
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync(
"https://api-message.nativehub.live/api/v1/auth/login",
content
);
var data = await response.Content.ReadFromJsonAsync<dynamic>();
string accessToken = data.access_token;
require 'net/http'
require 'json'
uri = URI('https://api-message.nativehub.live/api/v1/auth/login')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Content-Type'] = 'application/json'
request.body = {
username: 'your_username',
password: 'your_password'
}.to_json
response = http.request(request)
data = JSON.parse(response.body)
access_token = data['access_token']
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
2
Send an SMS
Use the Response:
/messages endpoint to send your first SMS.curl -X POST https://api-message.nativehub.live/api/v1/messages \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+8801712345678",
"from": "BRAND",
"body": "Hello from NativeMessage!"
}'
const axios = require('axios');
const response = await axios.post(
'https://api-message.nativehub.live/api/v1/messages',
{
to: '+8801712345678',
from: 'BRAND',
body: 'Hello from NativeMessage!'
},
{
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json'
}
}
);
console.log(response.data);
import requests
response = requests.post(
'https://api-message.nativehub.live/api/v1/messages',
headers={
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
},
json={
'to': '+8801712345678',
'from': 'BRAND',
'body': 'Hello from NativeMessage!'
}
)
message = response.json()
print(f"Message ID: {message['id']}")
<?php
$ch = curl_init('https://api-message.nativehub.live/api/v1/messages');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'to' => '+8801712345678',
'from' => 'BRAND',
'body' => 'Hello from NativeMessage!'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer ' . $access_token
]);
$response = curl_exec($ch);
$message = json_decode($response, true);
echo "Message ID: " . $message['id'];
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type Message struct {
To string `json:"to"`
From string `json:"from"`
Body string `json:"body"`
}
type MessageResponse struct {
ID string `json:"id"`
Status string `json:"status"`
PartCount int `json:"part_count"`
CreatedAt string `json:"created_at"`
}
func sendSMS(accessToken string) {
msg, _ := json.Marshal(Message{
To: "+8801712345678",
From: "BRAND",
Body: "Hello from NativeMessage!",
})
req, _ := http.NewRequest(
"POST",
"https://api-message.nativehub.live/api/v1/messages",
bytes.NewBuffer(msg),
)
req.Header.Set("Authorization", "Bearer "+accessToken)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
var msgResp MessageResponse
json.NewDecoder(resp.Body).Decode(&msgResp)
}
import java.net.http.*;
import java.net.URI;
import com.google.gson.Gson;
public class SendSMS {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String requestBody = new Gson().toJson(Map.of(
"to", "+8801712345678",
"from", "BRAND",
"body", "Hello from NativeMessage!"
));
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-message.nativehub.live/api/v1/messages"))
.header("Authorization", "Bearer " + accessToken)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using System.Text.Json;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var content = new StringContent(
JsonSerializer.Serialize(new {
to = "+8801712345678",
from = "BRAND",
body = "Hello from NativeMessage!"
}),
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync(
"https://api-message.nativehub.live/api/v1/messages",
content
);
var message = await response.Content.ReadFromJsonAsync<dynamic>();
Console.WriteLine($"Message ID: {message.id}");
require 'net/http'
require 'json'
uri = URI('https://api-message.nativehub.live/api/v1/messages')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = "Bearer #{access_token}"
request['Content-Type'] = 'application/json'
request.body = {
to: '+8801712345678',
from: 'BRAND',
body: 'Hello from NativeMessage!'
}.to_json
response = http.request(request)
message = JSON.parse(response.body)
puts "Message ID: #{message['id']}"
{
"id": "msg_1a2b3c4d5e6f",
"from": "BRAND",
"to": "+8801712345678",
"body": "Hello from NativeMessage!",
"status": "queued",
"part_count": 1,
"created_at": "2026-02-14T10:30:00Z"
}
Using an API key instead? Replace
Authorization: Bearer YOUR_ACCESS_TOKEN with X-API-Key: YOUR_API_KEY.3
Check delivery status
Track your message delivery using the message ID.Response:
curl -X GET https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const axios = require('axios');
const response = await axios.get(
'https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f',
{
headers: {
'Authorization': `Bearer ${access_token}`
}
}
);
console.log(`Status: ${response.data.status}`);
import requests
response = requests.get(
'https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f',
headers={
'Authorization': f'Bearer {access_token}'
}
)
message = response.json()
print(f"Status: {message['status']}")
<?php
$ch = curl_init('https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $access_token
]);
$response = curl_exec($ch);
$message = json_decode($response, true);
echo "Status: " . $message['status'];
package main
import (
"encoding/json"
"net/http"
)
func getMessageStatus(accessToken, messageID string) {
req, _ := http.NewRequest(
"GET",
"https://api-message.nativehub.live/api/v1/messages/"+messageID,
nil,
)
req.Header.Set("Authorization", "Bearer "+accessToken)
client := &http.Client{}
resp, _ := client.Do(req)
var message MessageResponse
json.NewDecoder(resp.Body).Decode(&message)
}
import java.net.http.*;
import java.net.URI;
public class CheckStatus {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f"))
.header("Authorization", "Bearer " + accessToken)
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
using System.Net.Http;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var response = await client.GetAsync(
"https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f"
);
var message = await response.Content.ReadFromJsonAsync<dynamic>();
Console.WriteLine($"Status: {message.status}");
require 'net/http'
require 'json'
uri = URI('https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.path)
request['Authorization'] = "Bearer #{access_token}"
response = http.request(request)
message = JSON.parse(response.body)
puts "Status: #{message['status']}"
{
"id": "msg_1a2b3c4d5e6f",
"from": "BRAND",
"to": "+8801712345678",
"body": "Hello from NativeMessage!",
"status": "delivered",
"part_count": 1,
"created_at": "2026-02-14T10:30:00Z",
"delivered_at": "2026-02-14T10:30:15Z"
}
Message statuses follow this lifecycle:
pending → queued → submitted → delivered / failed / expiredNext Steps
Send Bulk SMS
Learn how to send messages to multiple recipients
Receive Delivery Reports
Set up webhooks to track message delivery in real-time