BroadNet
Reliability·/idempotency

Idempotency & safe retries.

A network timeout doesn't tell you whether your message was sent. The BroadNet REST API does not take an idempotency key, so duplicate protection lives in your integration: record each send before you make it, keep the ID the API returns, and check the status before you send again.

4 min read·Updated September 2026Developer Hub

Overview

A network timeout doesn't tell you whether your message was sent. The BroadNet REST API does not take an idempotency key, so duplicate protection lives in your integration: record each send before you make it, keep the ID the API returns, and check the status before you send again.

What the API gives you

Every accepted send returns an identifier. POST /sms/sendSms returns the message ID as the response body, POST /sms/sendbulk returns a bulkSessionId, and POST /whatsapp/message/sendbulk returns a batchId. Once you hold that identifier, the message was accepted: never send it again.

Store the identifier against your own operation ID (an order number, a login attempt, a campaign) so that a retry from anywhere in your stack can see that the work is already done.

Node.js
// 1. Record the attempt first, keyed by your own operation ID.
await db.sends.insert({ opId: "order-8842-confirm", status: "pending" });

// 2. Send.
const res = await fetch("https://api.broadnet.me/sms/sendSms", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BROADNET_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    senderId: "BroadNet",
    destinationNumber: "447700900123",
    message: "Your order 8842 is confirmed",
    messageType: "TEXT",
  }),
});

// 3. Keep the message ID. With it, the send is done.
if (res.ok) {
  const messageId = await res.text();
  await db.sends.update({ opId: "order-8842-confirm" }, { status: "accepted", messageId });
}

When a request times out

The risky case is a request that reached BroadNet but whose response never reached you. Before you send again, look for evidence that the first attempt was accepted: a delivery status for that number and text on your webhook, or, for bulk jobs, a new entry in GET /sms/list.

What each outcome means

Decide what to do from the outcome of the call, not from a fixed retry count.

OutcomeWhat to do
200 with a message IDAccepted. Store the ID and never resend.
400 or 401Rejected, nothing was sent. Fix the request or the token, then send.
500 or 503Not accepted. Retry with capped exponential backoff.
502 or 504Unknown. A gateway can return these after the API accepted the message, so check delivery status before you resend.
Timeout or connection resetUnknown. Check delivery status before you resend.

Best practices

  • Write the attempt to your database before you call the API, and the returned ID after.
  • Treat a stored message ID or batch ID as proof of acceptance.
  • Retry 500 and 503 responses with capped exponential backoff; see Retries & backoff.
  • After a timeout, a 502 or a 504, check delivery status before sending the same message again.

Related documentation

Build on the wire

Test access within one business day.