curl --request POST \
--url https://virtualsms.io/api/v1/customer/purchase \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"service": "tg",
"country": "ID"
}
'import requests
url = "https://virtualsms.io/api/v1/customer/purchase"
payload = {
"service": "tg",
"country": "ID"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({service: 'tg', country: 'ID'})
};
fetch('https://virtualsms.io/api/v1/customer/purchase', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://virtualsms.io/api/v1/customer/purchase",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service' => 'tg',
'country' => 'ID'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://virtualsms.io/api/v1/customer/purchase"
payload := strings.NewReader("{\n \"service\": \"tg\",\n \"country\": \"ID\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://virtualsms.io/api/v1/customer/purchase")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"service\": \"tg\",\n \"country\": \"ID\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://virtualsms.io/api/v1/customer/purchase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service\": \"tg\",\n \"country\": \"ID\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"phone_number": "628123456789",
"service": "tg",
"country": "ID",
"price": 0.4,
"status": "waiting",
"provider": "herosms",
"expires_at": "2026-03-14T16:00:00+08:00"
}{
"error": "Insufficient balance",
"required": 0.4,
"current": 0.1
}Buy Number
Purchase an SMS verification number. Balance is deducted immediately.
After purchase, poll GET /api/v1/customer/order/{orderId} every 3-5 seconds for SMS,
or connect to wss://virtualsms.io/ws/orders for real-time delivery.
Cancel/swap policy: Orders can be cancelled or swapped after a 120-second cooldown from the time of purchase. Cancel refunds in full; swap is free and keeps the same service and country. Both are only available before the first SMS arrives. An untouched order auto-expires and is refunded 20 minutes after purchase.
curl --request POST \
--url https://virtualsms.io/api/v1/customer/purchase \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"service": "tg",
"country": "ID"
}
'import requests
url = "https://virtualsms.io/api/v1/customer/purchase"
payload = {
"service": "tg",
"country": "ID"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({service: 'tg', country: 'ID'})
};
fetch('https://virtualsms.io/api/v1/customer/purchase', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://virtualsms.io/api/v1/customer/purchase",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service' => 'tg',
'country' => 'ID'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://virtualsms.io/api/v1/customer/purchase"
payload := strings.NewReader("{\n \"service\": \"tg\",\n \"country\": \"ID\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://virtualsms.io/api/v1/customer/purchase")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"service\": \"tg\",\n \"country\": \"ID\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://virtualsms.io/api/v1/customer/purchase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service\": \"tg\",\n \"country\": \"ID\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"phone_number": "628123456789",
"service": "tg",
"country": "ID",
"price": 0.4,
"status": "waiting",
"provider": "herosms",
"expires_at": "2026-03-14T16:00:00+08:00"
}{
"error": "Insufficient balance",
"required": 0.4,
"current": 0.1
}Authorizations
API key from virtualsms.io dashboard (Settings -> API tab). Prefix: vsms_
Body
Response
Number purchased successfully
true
"550e8400-e29b-41d4-a716-446655440000"
"628123456789"
"tg"
"ID"
0.4
"waiting"
"herosms"
"2026-03-14T16:00:00+08:00"