> ## Documentation Index
> Fetch the complete documentation index at: https://torpedo.co.mz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Send an SMS

> Send transactional SMS messages to Mozambican numbers with Torpedo

## Requirements

* An active paid plan
* SMS credits in your workspace (purchase them from **Billing** in the dashboard)

***

## Basic send

```bash cURL theme={null}
curl -X POST https://api.torpedo.co.mz/api/v1/sms \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+258841234567",
    "body": "Your verification code is 482910. Expires in 10 minutes."
  }'
```

```js Node.js theme={null}
const res = await fetch('https://api.torpedo.co.mz/api/v1/sms', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.TORPEDO_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    to: '+258841234567',
    body: 'Your verification code is 482910. Expires in 10 minutes.',
  }),
})
const { data } = await res.json()
console.log(data.id) // message ID
console.log(data.status) // 'queued'
```

```python Python theme={null}
import httpx

res = httpx.post(
    'https://api.torpedo.co.mz/api/v1/sms',
    headers={'X-API-Key': TORPEDO_API_KEY},
    json={
        'to': '+258841234567',
        'body': 'Your verification code is 482910. Expires in 10 minutes.',
    },
)
data = res.json()['data']
print(data['id'], data['status'])  # queued
```

```go Go theme={null}
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	payload, _ := json.Marshal(map[string]string{
		"to":   "+258841234567",
		"body": "Your verification code is 482910. Expires in 10 minutes.",
	})

	req, _ := http.NewRequest("POST", "https://api.torpedo.co.mz/api/v1/sms", bytes.NewBuffer(payload))
	req.Header.Set("X-API-Key", os.Getenv("TORPEDO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}
```

```java Java theme={null}
var torpedo = TorpedoClient.builder()
    .apiKey(System.getenv("TORPEDO_API_KEY"))
    .build();

var sms = torpedo.sms().send(
    SendSmsRequest.builder()
        .to("+258841234567")
        .body("Your verification code is 482910. Expires in 10 minutes.")
        .build()
);
```

```csharp C# theme={null}
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", Environment.GetEnvironmentVariable("TORPEDO_API_KEY"));

var payload = new { to = "+258841234567", body = "Your verification code is 482910. Expires in 10 minutes." };
var response = await client.PostAsJsonAsync("https://api.torpedo.co.mz/api/v1/sms", payload);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

The response is `202 Accepted` — delivery is asynchronous.

***

## Sender ID (`from`)

The sender ID is the name or number the recipient sees as the sender of the SMS.

**Without a custom sender ID**, omit `from`. Your messages go out with the Torpedo platform sender.

**With an approved custom sender ID** (for example `AcmePay`), pass it in `from`:

```bash theme={null}
curl -X POST https://api.torpedo.co.mz/api/v1/sms \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+258841234567",
    "from": "AcmePay",
    "body": "Your AcmePay code is 482910."
  }'
```

> [!WARNING]
>
> Sender IDs are **case-sensitive**. `from` must match your approved sender ID exactly, letter for
> letter: if `AcmePay` is approved, `acmepay` and `ACMEPAY` are rejected with `422`.

How `from` is resolved:

| Your workspace has… | `from` omitted | `from` set |
| - | - | - |
| No custom sender ID | Sent with the platform sender | Rejected with `422` unless it is the platform sender |
| One or more approved sender IDs | Sent with your default sender ID | Must exactly match one of your approved sender IDs, or `422` |

Once your workspace has its own sender ID, the platform sender is no longer accepted in `from`. Omit
`from` to use your default, or pass one of your approved sender IDs.

A `from` that doesn't belong to your workspace returns:

```json theme={null}
{
  "errors": [
    {
      "code": "VALIDATION_ERROR",
      "message": "Sender ID 'acmepay' is not assigned to this workspace",
      "field": "from"
    }
  ]
}
```

### Requesting a custom sender ID

Email [hello@torpedo.co.mz](mailto:hello@torpedo.co.mz?subject=Sender%20ID%20request) with:

* the sender ID you want: up to 11 characters (letters, digits, spaces, `.`, `_` or `-`, starting
  with a letter or digit), or a numeric short code;
* the kind of messages you'll send (for example verification codes or order updates).

Once it's approved, we assign it to your workspace. Use the exact capitalization you requested
when you send.

### Test API keys

SMS sent with a test API key always use the platform sender, even if your workspace has its own
sender ID. Omit `from` when sending with a test key.

***

## Phone number format

The `to` field must be a valid Mozambican mobile number in E.164 format:

```
+258 8X XXXXXXX
```

Accepted prefixes: `84`, `82`, `83`, `85`, `86`, `87` (Vodacom, Movitel, tmcel).

```json theme={null}
{ "to": "+258841234567" }  ✓
{ "to": "841234567" }      ✗  missing country code
{ "to": "+1234567890" }    ✗  not a Mozambican number
```

## SMS status lifecycle

```
queued → sent → delivered
   │       └──→ undelivered
   └──→ failed
```

| Status | Meaning |
| - | - |
| `queued` | Accepted by Torpedo, waiting to be sent |
| `sent` | The operator accepted the message. Waiting for it to confirm delivery to the phone |
| `delivered` | The operator confirmed the phone received the message |
| `undelivered` | The operator accepted the message but could not deliver it (invalid number, phone unreachable, expired, rejected) |
| `failed` | The message never reached the operator (for example, a connection error or a suppressed number) |

`undelivered` usually points to a problem with the number or the phone, so check the number
before sending again. `failed` points to a problem on the sending side, and is usually safe to retry.
`failureCategory` gives the specific reason in both cases.

> [!NOTE]
>
> Before October 2026, operator-reported delivery failures used the `failed` status. They now use
> `undelivered`. If your integration checks `status === "failed"`, also check for `"undelivered"`.

### Waiting for delivery confirmation

`sent` means the operator accepted the message, not that the phone received it. Operators confirm
delivery with a delivery receipt, which can take from seconds to hours (for example, when the phone
is switched off).

Torpedo asks the operator to stop trying after **24 hours**. The operator then reports the message
as expired, and its status becomes `undelivered`. Some operators don't send delivery receipts at all.
If no receipt arrives within **25 hours**, the status stays `sent`, `deliveryState` becomes `unknown`,
and an `sms.delivery_unknown` webhook fires. A receipt that arrives later still updates the message.

The `deliveryState` field gives more detail while a message is `sent`:

| `deliveryState` | Meaning |
| - | - |
| `submitted` | The operator accepted the message. No delivery receipt yet |
| `accepted` | The operator reported the message as accepted for delivery |
| `in_transit` | The operator reported it is still trying to reach the phone |
| `unknown` | No delivery receipt arrived within 25 hours. The message may or may not have been delivered |

> [!NOTE]
>
> `accepted` and `in_transit` are informational. Not every operator reports them, so a message can go
> straight from `submitted` to its final status. Don't build logic that waits for them.

The response also includes `events`, the delivery receipts received from the operator in order:

```json theme={null}
"events": [
  { "providerStatus": "ENROUTE", "providerErrorCode": null, "receivedAt": "2026-04-15T10:00:02.000Z" },
  { "providerStatus": "DELIVRD", "providerErrorCode": "000", "receivedAt": "2026-04-15T10:00:09.000Z" }
]
```

To be notified instead of polling `GET /api/v1/sms/{id}`, subscribe a [webhook](https://torpedo.co.mz/docs/guides/webhooks.md)
to `sms.delivered`, `sms.undelivered`, `sms.failed` and `sms.delivery_unknown`.

***

## Idempotency

Pass an `Idempotency-Key` header to prevent duplicate sends on retries:

```bash theme={null}
curl -X POST https://api.torpedo.co.mz/api/v1/sms \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Idempotency-Key: order-789-sms-confirmation" \
  -H "Content-Type: application/json" \
  -d '{ "to": "+258841234567", "body": "Your order has shipped." }'
```

If a request with the same key was already accepted, Torpedo returns the original `202` without sending again. Keys are scoped to your workspace.

***

## Credits and quota

Each SMS deducts one credit from your workspace balance. If your balance reaches zero, sends return `402`:

```json theme={null}
{
  "errors": [
    {
      "code": "PAYMENT_REQUIRED",
      "message": "No SMS credits remaining. Add SMS credits in Billing to continue sending."
    }
  ]
}
```

Purchase additional credits from **Billing** in your dashboard. See [SMS credits](https://torpedo.co.mz/docs/guides/sms-credits.md).

***

## Suppression

Addresses that permanently fail delivery (`UNDELIV`, `REJECTD` SMPP error codes) are automatically added to the suppression list. Sending to a suppressed number returns `422`:

```json theme={null}
{
  "errors": [
    {
      "code": "VALIDATION_ERROR",
      "message": "Recipient '+258841234567' is suppressed (reason: hard_bounce)",
      "field": "to"
    }
  ]
}
```

Remove an address from the suppression list via `DELETE /api/v1/suppressions/{address}?channel=sms`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.