# 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](https://docs.rassilo.ai/en/getting-started#curl), [Node.js](https://docs.rassilo.ai/en/getting-started#node), [Python](https://docs.rassilo.ai/en/getting-started#python), [PHP](https://docs.rassilo.ai/en/getting-started#php) or [Java](https://docs.rassilo.ai/en/getting-started#java). Each section is complete on its own.

> **Everything happens in Sandbox** — An `sk_test_…` key sends no billed message. Create one in the dashboard under [Developers](https://dashboard.rassilo.ai/developers).

## cURL

1. **Check cURL**

```sh
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.

```sh
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 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](https://docs.rassilo.ai/en/guides/sms#statuses) and your dashboard logs.

## Node.js

1. **Check Node.js**

```sh
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.

```sh
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
// 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](https://docs.rassilo.ai/en/guides/sms#statuses) and your dashboard logs.

## Python

1. **Install the library**

```sh
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.

```sh
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
# 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](https://docs.rassilo.ai/en/guides/sms#statuses) and your dashboard logs.

## PHP

1. **Check PHP**

```sh
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.

```sh
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
// 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](https://docs.rassilo.ai/en/guides/sms#statuses) and your dashboard logs.

## Java

1. **Check Java**

```sh
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.

```sh
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
// 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](https://docs.rassilo.ai/en/guides/sms#statuses) and your dashboard logs.

## What’s next

- Pick a channel: [SMS](https://docs.rassilo.ai/en/guides/sms), [WhatsApp](https://docs.rassilo.ai/en/guides/whatsapp), [Email](https://docs.rassilo.ai/en/guides/email), [Voice](https://docs.rassilo.ai/en/guides/voice), [Push](https://docs.rassilo.ai/en/guides/push), [USSD](https://docs.rassilo.ai/en/guides/ussd).
- Read the rules of the country you send to: [Mauritania](https://docs.rassilo.ai/en/compliance/mr), [Senegal](https://docs.rassilo.ai/en/compliance/sn), [Morocco](https://docs.rassilo.ai/en/compliance/ma).
- Go Live: a phone check, then your real customers.
