# Migrating from the old OTP/SMS service

Rassilo replaces the old OTP and SMS service. This guide maps the old calls to the new ones and lists the steps of a gradual switch, tried in Sandbox before going Live.

## What changes

| Old service | Rassilo |
| --- | --- |
| `POST /api/sms/send` | `POST /v1/messages  { "channel": "sms" }` |
| `POST /api/otp/send` | `POST /v1/messages  { "channel": "sms" }` |
| `?api_key=…` | `Authorization: Bearer $RASSILO_API_KEY` |
| `phone=00000000` | `"to": "+22200000000"` |
| `message=…` | `"body": "…"` |
| No equivalent | `X-Idempotency-Key: $(uuidgen)` |
| `GET /api/sms/status` | `GET /v1/messages/{id}` (coming soon) |

- The key moves to the `Authorization` header, never in the URL again.
- Numbers use the international E.164 format: `+222` then 8 digits.
- Every send carries an `X-Idempotency-Key` header; without it, the call is refused (`400`). `uuidgen` generates it (on Debian, package `uuid-runtime`).
- The sender name is no longer a parameter of the call: it is registered in Senders, country by country.
- Statuses will arrive by webhook instead of being polled: webhooks and reading a message are coming soon.
- An OTP code is a message like any other: you generate the code, Rassilo sends it by SMS.

## The same send, before and after

*Before*

```sh
curl "https://ancien-service.example/api/sms/send?api_key=$OLD_API_KEY" \
  -d phone=00000000 \
  -d sender=KARAMPAY \
  -d message="Votre code est 482913"
```

*After*

```sh
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 est 482913"}'
```

## Switch-over steps

1. **Create your Rassilo workspace**

   Rassilo’s prepaid wallet also serves the identity verification product: one balance for both.

2. **Get your senders approved**

   Re-enter your current sender names in Senders, country by country.

3. **Adapt the code in Sandbox**

   With an `sk_test_…` key, replace the calls per the table above, `X-Idempotency-Key` header included.

4. **Plug in webhooks**

   Not needed today to go Live. As soon as they are available, subscribe to `message.delivered` and `message.failed`.

5. **Go Live**

   Phone check, then replace the test key with an `sk_live_…` key.

6. **Retire the old integration**

   Once Rassilo’s logs show all your traffic, revoke the old key.
