SMS API Code Examples — PHP, Java, Python, Node.js & .NET

Real, working code samples for MetaReach's SMS API in every major language — send SMS, track delivery, and check balance directly from your own application.

Quick Start

Every sample on this page calls the same real endpoint — a plain HTTP GET request over HTTPS. No SDK install required in any language.

cURL

curl "https://sms.metareach.in/vb/apikey.php?apikey=YOUR_API_KEY&senderid=YOURID&number=91XXXXXXXXXX&message=Hello%20there"

Replace YOUR_API_KEY and YOURID (your 6-character DLT-approved sender ID) with your own credentials. Full parameter list, optional parameters, and error codes are on the SMS API documentation page.

PHP

Send an SMS from a PHP application using a single file_get_contents() call — no library required.

Code

<?php $apikey = "YOUR_API_KEY"; $senderid = "YOURID"; $number = "91XXXXXXXXXX"; // or "91XXXXXXXXXX,91XXXXXXXXXX" for multiple recipients $message = urlencode("Hello there"); $url = "https://sms.metareach.in/vb/apikey.php?apikey=$apikey&senderid=$senderid&number=$number&message=$message"; $response = file_get_contents($url); $result = json_decode($response, true); echo $result['status']; // "Success" or "false"

Node.js

Using axios (install with npm install axios):

Code

const axios = require("axios"); const params = { apikey: "YOUR_API_KEY", senderid: "YOURID", number: "91XXXXXXXXXX", message: "Hello there", }; axios.get("https://sms.metareach.in/vb/apikey.php", { params }) .then(res => console.log(res.data)) .catch(err => console.error(err));

Python

Using the requests library (install with pip install requests):

Code

import requests params = { "apikey": "YOUR_API_KEY", "senderid": "YOURID", "number": "91XXXXXXXXXX", "message": "Hello there", } response = requests.get("https://sms.metareach.in/vb/apikey.php", params=params) print(response.json())

Java

Using the built-in java.net.HttpURLConnection — no external dependency required.

Code

String apikey = "YOUR_API_KEY"; String senderid = "YOURID"; String number = "91XXXXXXXXXX"; String message = URLEncoder.encode("Hello there", "UTF-8"); String urlStr = "https://sms.metareach.in/vb/apikey.php?apikey=" + apikey + "&senderid=" + senderid + "&number=" + number + "&message=" + message; HttpURLConnection conn = (HttpURLConnection) new URL(urlStr).openConnection(); conn.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder response = new StringBuilder(); String line; while ((line = in.readLine()) != null) { response.append(line); } in.close(); System.out.println(response.toString());

.NET (C#)

Using HttpClient from an ASP.NET or console application:

Code

string apikey = "YOUR_API_KEY"; string senderid = "YOURID"; string number = "91XXXXXXXXXX"; string message = Uri.EscapeDataString("Hello there"); string url = $"https://sms.metareach.in/vb/apikey.php?apikey={apikey}&senderid={senderid}&number={number}&message={message}"; using (var client = new HttpClient()) { string response = await client.GetStringAsync(url); Console.WriteLine(response); }

VB.NET

Using System.Net.WebClient for legacy VB.NET applications:

Code

Dim apikey As String = "YOUR_API_KEY" Dim senderid As String = "YOURID" Dim number As String = "91XXXXXXXXXX" Dim message As String = HttpUtility.UrlEncode("Hello there") Dim url As String = "https://sms.metareach.in/vb/apikey.php?apikey=" & apikey & "&senderid=" & senderid & "&number=" & number & "&message=" & message Dim client As New WebClient() Dim response As String = client.DownloadString(url) Console.WriteLine(response)

Need the Full API Reference?

Mandatory & optional parameters, all error codes, delivery report (DLR) and balance-check endpoints, and personalized bulk sending are covered in the complete reference.

Read the Full SMS API Documentation → Get API Credentials

Why Choose Us?

Why Choose Us
Top Quality Services
Time Efficient
Trusted by Thousands
Affordable Pricing
Our Happy Clients

Trusted by Businesses Across India

From startups to enterprises — brands that grow with MetaReach

WhatsApp Facebook Instagram YouTube LinkedIn X / Twitter
☎ Instant Call Back FREE
or request a call back

We'll call you back within 5 minutes