Skip to content

Quick-start: your first message

Send an SMS from your server in five minutes with a Sandbox key, in cURL, Node.js, Python, PHP or Java.

Pick your language: cURL, Node.js, Python, PHP or Java. Each section is complete on its own.

cURL

  1. Check cURL

    Texte
    Texte
    curl --version
    command -v uuidgen   # Debian: apt install uuid-runtime
  2. Set your Sandbox key

    Replace sk_test_… with your key. Keep it on the server, in an environment variable — never in a mobile app or the browser.

    Texte
    Texte
    export RASSILO_API_KEY="sk_test_…"
  3. Send the message

    Paste the command into your terminal. In Sandbox, the message only reaches your team’s test numbers.

    cURL
    cURL
    curl https://api.rassilo.ai/v1/messages \
      -H "Authorization: Bearer $RASSILO_API_KEY" \
      -H "Content-Type: application/json" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "channel": "sms",
        "to": "+22200000000",
        "body": "Votre code Karam Pay est 482913."
      }'
  4. Track delivery

    The response holds the provisional id provisionalId and the status submitted: the message was handed to the operator. Only delivered means delivered. See delivery statuses and your dashboard logs.

Node.js

  1. Check Node.js

    Texte
    Texte
    node --version   # >= 18
  2. Set your Sandbox key

    Replace sk_test_… with your key. Keep it on the server, in an environment variable — never in a mobile app or the browser.

    Texte
    Texte
    export RASSILO_API_KEY="sk_test_…"
  3. Send the message

    Save the code, then run node send.mjs. In Sandbox, the message only reaches your team’s test numbers.

    Node.js
    Node.js
    // send.mjs
    import { randomUUID } from 'node:crypto';
    
    const response = await fetch('https://api.rassilo.ai/v1/messages', {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RASSILO_API_KEY}`,
        'Content-Type': 'application/json',
        'X-Idempotency-Key': randomUUID(),
      },
      body: JSON.stringify({
        channel: 'sms',
        to: '+22200000000',
        body: 'Votre code Karam Pay est 482913.',
      }),
    });
    
    const message = await response.json();
    console.log(message.provisionalId, message.status); // … submitted
  4. Track delivery

    The response holds the provisional id provisionalId and the status submitted: the message was handed to the operator. Only delivered means delivered. See delivery statuses and your dashboard logs.

Python

  1. Install the library

    Texte
    Texte
    pip install requests
  2. Set your Sandbox key

    Replace sk_test_… with your key. Keep it on the server, in an environment variable — never in a mobile app or the browser.

    Texte
    Texte
    export RASSILO_API_KEY="sk_test_…"
  3. Send the message

    Save the code, then run python send.py. In Sandbox, the message only reaches your team’s test numbers.

    Python
    Python
    # send.py
    import os
    import uuid
    
    import requests
    
    response = requests.post(
        "https://api.rassilo.ai/v1/messages",
        headers={
            "Authorization": f"Bearer {os.environ['RASSILO_API_KEY']}",
            "X-Idempotency-Key": str(uuid.uuid4()),
        },
        json={
            "channel": "sms",
            "to": "+22200000000",
            "body": "Votre code Karam Pay est 482913.",
        },
    )
    
    message = response.json()
    print(message["provisionalId"], message["status"])  # … submitted
  4. Track delivery

    The response holds the provisional id provisionalId and the status submitted: the message was handed to the operator. Only delivered means delivered. See delivery statuses and your dashboard logs.

PHP

  1. Check PHP

    Texte
    Texte
    php -m | grep curl
  2. Set your Sandbox key

    Replace sk_test_… with your key. Keep it on the server, in an environment variable — never in a mobile app or the browser.

    Texte
    Texte
    export RASSILO_API_KEY="sk_test_…"
  3. Send the message

    Save the code, then run php send.php. In Sandbox, the message only reaches your team’s test numbers.

    PHP
    PHP
    <?php
    // send.php
    $ch = curl_init('https://api.rassilo.ai/v1/messages');
    curl_setopt_array($ch, [
        CURLOPT_POST           => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER     => [
            'Authorization: Bearer ' . getenv('RASSILO_API_KEY'),
            'Content-Type: application/json',
            'X-Idempotency-Key: ' . bin2hex(random_bytes(16)),
        ],
        CURLOPT_POSTFIELDS     => json_encode([
            'channel' => 'sms',
            'to'      => '+22200000000',
            'body'    => 'Votre code Karam Pay est 482913.',
        ]),
    ]);
    
    $message = json_decode(curl_exec($ch), true);
    echo $message['provisionalId'] . ' ' . $message['status']; // … submitted
  4. Track delivery

    The response holds the provisional id provisionalId and the status submitted: the message was handed to the operator. Only delivered means delivered. See delivery statuses and your dashboard logs.

Java

  1. Check Java

    Texte
    Texte
    java --version   # >= 17
  2. Set your Sandbox key

    Replace sk_test_… with your key. Keep it on the server, in an environment variable — never in a mobile app or the browser.

    Texte
    Texte
    export RASSILO_API_KEY="sk_test_…"
  3. Send the message

    Save the code, then run java SendMessage.java. In Sandbox, the message only reaches your team’s test numbers.

    Java
    Java
    // SendMessage.java
    import java.net.URI;
    import java.net.http.HttpClient;
    import java.net.http.HttpRequest;
    import java.net.http.HttpResponse;
    import java.util.UUID;
    
    public class SendMessage {
        public static void main(String[] args) throws Exception {
            String json = """
                {
                  "channel": "sms",
                  "to": "+22200000000",
                  "body": "Votre code Karam Pay est 482913."
                }""";
    
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.rassilo.ai/v1/messages"))
                .header("Authorization", "Bearer " + System.getenv("RASSILO_API_KEY"))
                .header("Content-Type", "application/json")
                .header("X-Idempotency-Key", UUID.randomUUID().toString())
                .POST(HttpRequest.BodyPublishers.ofString(json))
                .build();
    
            HttpResponse<String> response = HttpClient.newHttpClient()
                .send(request, HttpResponse.BodyHandlers.ofString());
    
            System.out.println(response.body()); // … "status": "submitted" …
        }
    }
  4. Track delivery

    The response holds the provisional id provisionalId and the status submitted: the message was handed to the operator. Only delivered means delivered. See delivery statuses and your dashboard logs.

What’s next