HomeAPI & DevSend SMS with Java

Send SMS with ☕ Java

Send SMS from your Java application using the built-in HttpURLConnection — no external dependencies required.

Java · HttpURLConnection HTTPS POST v2.0
ℹ️
Before using the API, register a free iSMS account and purchase SMS credits. See the full SMS API docs for all parameters and error codes.
API Endpoints
HTTPS Endpoints — use all 3 for high availability
// Primary
https://smtpapi.vocotext.com/isms_send_all_id.php

// Mirror 2
https://smtpapi2.vocotext.com/isms_send_all_id.php

// Mirror 3
https://www.isms.com.my/isms_send_all_id.php
Send SMS — Java
Java · HttpURLConnection POST
import java.io.*;
import java.net.*;
import java.nio.charset.StandardCharsets;

public class IsmsSender {

    public static void main(String[] args) throws Exception {
        String apiUrl = "https://smtpapi.vocotext.com/isms_send_all_id.php";

        String params = "un="         + URLEncoder.encode("your_username",  "UTF-8") +
                        "&pwd="       + URLEncoder.encode("your_password",  "UTF-8") +
                        "&dstno="     + URLEncoder.encode("601X-XXXXXXX",   "UTF-8") +
                        "&msg="       + URLEncoder.encode("Hello from iSMS!", "UTF-8") +
                        "&type=1"    +    // 1 = ASCII, 2 = Unicode
                        "&agreedterm=YES" +
                        "&sendid="   + URLEncoder.encode("MyBrand", "UTF-8");

        byte[] postData = params.getBytes(StandardCharsets.UTF_8);

        URL url = new URL(apiUrl);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);
        conn.setConnectTimeout(15000);
        conn.setReadTimeout(30000);
        conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        conn.setRequestProperty("Content-Length", String.valueOf(postData.length));

        try (OutputStream os = conn.getOutputStream()) {
            os.write(postData);
        }

        int status = conn.getResponseCode();
        InputStream is = (status == 200) ? conn.getInputStream() : conn.getErrorStream();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
            String response = br.readLine();
            if (response != null && response.startsWith("2000")) {
                String trxId = response.split(":")[1];
                System.out.println("SMS sent! Transaction ID: " + trxId);
            } else {
                System.err.println("Failed: " + response);
            }
        }
        conn.disconnect();
    }
}
✅ Success
2000 = SUCCESS:1143007207
// Save the transaction ID for delivery tracking
❌ Error
-1001 = AUTHENTICATION FAILED
-1003 = IP NOT ALLOWED
-1004 = INSUFFICIENT CREDITS
-1008 = MISSING PARAMETER
-1013 = INVALID TERM AGREEMENT
⚠️
Delivery Status Note (Malaysia): A 2000 response confirms submission to Telco SMSC only — not delivery to handset. For confirmed Sent → Received → Read tracking, consider WhatsApp Business API.

Ready to Integrate?

Register free, get your API credentials, and start sending in minutes.

📱 SMS Coverage — All Countries Worldwide

A B C D E F G H I J K L M N O P Q R S T U V Y Z