Java
The SMS Bridge API is plain HTTPS and JSON, so you do not need a special package. This example uses the standard HTTP client — it needs Java 17 or newer. Official client packages are planned; until then, copy this into your project.
Send an SMS
Put your API key in the SMS_BRIDGE_KEY environment variable, and use one of your paired phone numbers as from_number.
// Java 17+ (built-in java.net.http)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class SendSms {
public static void main(String[] args) throws Exception {
String json = """
{"from_number": "+15550100001",
"to_number": "+15550100002",
"content": "Your order #A12 has shipped"}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.99billingsolutions.com/v1/messages/send"))
.header("x-api-key", System.getenv("SMS_BRIDGE_KEY"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// 202 = queued; the body holds data.id and data.status
System.out.println(response.statusCode() + " " + response.body());
}
}Good practice
- Keep the key on your server, never in browser or app code.
- Pass a unique
request_idper message, so retrying after a timeout can never send twice. - On
429, wait for theRetry-Afterseconds before retrying. - Receive replies and delivery updates with webhooks and verify their signature.