> ## Documentation Index
> Fetch the complete documentation index at: https://developers.nativehub.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Your First SMS

> Get started with NativeMessage by sending your first SMS in minutes

<Steps>
  <Step title="Get your API credentials">
    You can authenticate using either JWT Bearer tokens or API keys.

    **Option A: JWT Authentication**

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api-message.nativehub.live/api/v1/auth/login \
        -H "Content-Type: application/json" \
        -d '{
          "username": "your_username",
          "password": "your_password"
        }'
      ```

      ```javascript Node.js theme={null}
      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;
      ```

      ```python Python theme={null}
      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 PHP theme={null}
      <?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'];
      ```

      ```go Go theme={null}
      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)
      }
      ```

      ```java Java theme={null}
      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());
          }
      }
      ```

      ```csharp C# theme={null}
      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;
      ```

      ```ruby Ruby theme={null}
      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']
      ```
    </CodeGroup>

    **Response:**

    ```json theme={null}
    {
      "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
    ```

    **Option B: API Key**

    Alternatively, you can use an API key from your dashboard settings.
  </Step>

  <Step title="Send an SMS">
    Use the `/messages` endpoint to send your first SMS.

    <CodeGroup>
      ```bash cURL theme={null}
      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!"
        }'
      ```

      ```javascript Node.js theme={null}
      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);
      ```

      ```python Python theme={null}
      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 PHP theme={null}
      <?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'];
      ```

      ```go Go theme={null}
      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)
      }
      ```

      ```java Java theme={null}
      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());
          }
      }
      ```

      ```csharp C# theme={null}
      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}");
      ```

      ```ruby Ruby theme={null}
      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']}"
      ```
    </CodeGroup>

    **Response:**

    ```json theme={null}
    {
      "id": "msg_1a2b3c4d5e6f",
      "from": "BRAND",
      "to": "+8801712345678",
      "body": "Hello from NativeMessage!",
      "status": "queued",
      "part_count": 1,
      "created_at": "2026-02-14T10:30:00Z"
    }
    ```

    <Note>
      Using an API key instead? Replace `Authorization: Bearer YOUR_ACCESS_TOKEN` with `X-API-Key: YOUR_API_KEY`.
    </Note>
  </Step>

  <Step title="Check delivery status">
    Track your message delivery using the message ID.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X GET https://api-message.nativehub.live/api/v1/messages/msg_1a2b3c4d5e6f \
        -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
      ```

      ```javascript Node.js theme={null}
      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}`);
      ```

      ```python Python theme={null}
      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 PHP theme={null}
      <?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'];
      ```

      ```go Go theme={null}
      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)
      }
      ```

      ```java Java theme={null}
      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());
          }
      }
      ```

      ```csharp C# theme={null}
      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}");
      ```

      ```ruby Ruby theme={null}
      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']}"
      ```
    </CodeGroup>

    **Response:**

    ```json theme={null}
    {
      "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"
    }
    ```

    <Info>
      Message statuses follow this lifecycle: `pending` → `queued` → `submitted` → `delivered` / `failed` / `expired`
    </Info>
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Send Bulk SMS" icon="message-lines" href="/quickstart/send-bulk-sms">
    Learn how to send messages to multiple recipients
  </Card>

  <Card title="Receive Delivery Reports" icon="webhook" href="/quickstart/receive-delivery-reports">
    Set up webhooks to track message delivery in real-time
  </Card>
</CardGroup>
