In Bonga, an SMS sender is an approved identity on a managed route or a SIM
subscription on a paired Android gateway. Set up managed sender IDs or pair
the gateway in your workspace before choosing a sender.

## Endpoints at a glance

| What do you want to do? | Endpoint | Key scope |
| --- | --- | --- |
| Find a managed sender or a specific SIM | [`GET /api/v2/senders?channel=sms`](/docs/api-reference) | `messages:read` |
| Identify the sender's device or connection | [`GET /api/v2/connections?channel=sms`](/docs/api-reference) | `messages:read` |
| Submit text to one recipient in the preview | [`POST /api/v2/messages`](/docs/api-reference) | `messages:send` |
| Check the status of an accepted message | [`GET /api/v2/messages/{id}`](/docs/api-reference) | `messages:read` |
| Schedule a managed SMS | `POST /api/v2/messages/scheduled` | `messages:send` |
| List schedules | `GET /api/v2/messages/scheduled` | `messages:read` |
| Read or cancel one schedule | `GET/DELETE /api/v2/messages/scheduled/{id}` | `messages:read` / `messages:send` |

## List senders

Create a scoped API key with `messages:read`. Store it on your server.

```bash
curl "$BONGA_API_BASE_URL/api/v2/senders?channel=sms" \
  -H "Authorization: Bearer $BONGA_API_KEY"
```

The response contains `data.senders` and `data.connections`. The sender’s
`connection_id` identifies its connection, and the optional `address` is for
display. A managed sender may display a registered brand name or approved
number. A SIM sender can show its slot even when the phone number is unknown.

To see the senders for one gateway, add `connection_id` using the ID returned
by discovery. Choose the sender for the intended SIM slot and use its
`snd_…` ID as `from`. A device ID, phone number, brand name, or SIM slot
does not replace that ID in a message request.

## Submit and track

See the [v2 reference](/docs) for the SMS text example and status response.
Use a key with `messages:send` for submission, send to one E.164 recipient,
and retain your `Idempotency-Key` for replays. A `202` records acceptance;
delivery depends on the qualified route and provider evidence.

Store the message ID returned in `data.id` alongside your order or job ID.
Use the `Location` response header to look up the message. The idempotency
key is for replaying the request; it is not the message ID. The current
preview does not return SMS segment counts, quotes, or charges.

Only senders with `ready: true` can accept preview messages. A configured
sender with `readiness_reason: "not_qualified"` is not available for submission.
An empty list means no sender matched your filters.

## Common responses

| Response | What to check |
| --- | --- |
| `401` | Use an active workspace API key in the Bearer header. |
| `403 PERMISSION_DENIED` | Check the scope required by the endpoint. |
| `409 SENDER_NOT_READY` | Re-run discovery and choose an eligible sender. |
| `409 IDEMPOTENCY_CONFLICT` | A retry must reuse both the key and payload. The preview also rejects identical normalized payloads under a different key. |
| `422 CHANNEL_UNQUALIFIED` | The selected channel or route is unavailable in this environment. |

## Schedule a managed SMS

Scheduling is enabled only when the operator has qualified the managed route
and sets `MESSAGING_V2_MANAGED_SCHEDULE_ENABLED=true`. Use the same discovered
managed sender and add a future `send_at` value:

```json
{
  "channel": "sms",
  "from": "snd_example01",
  "to": "+254712345678",
  "content": {"type": "text", "text": "Your appointment is tomorrow."},
  "send_at": "2027-01-15T09:00:00Z"
}
```

The allowed horizon is one minute through 365 days. Bonga pins the sender and
API-key scope, then rechecks the key, workspace, consent and opt-out state at
dispatch. Cancel with `DELETE /api/v2/messages/scheduled/{id}` before the
worker begins provider handoff. Android SIM and WhatsApp scheduling are
separate routes and are never selected as an automatic fallback.

Public v2 does not expose bulk sends, SMS balances, sender registration or
delivery webhooks yet.
