Cancel an order
curl --request POST \
--url https://virtualsms.io/api/v1/customer/cancel/{orderId} \
--header 'X-API-Key: <api-key>'import requests
url = "https://virtualsms.io/api/v1/customer/cancel/{orderId}"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://virtualsms.io/api/v1/customer/cancel/{orderId}', 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/cancel/{orderId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://virtualsms.io/api/v1/customer/cancel/{orderId}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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/cancel/{orderId}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://virtualsms.io/api/v1/customer/cancel/{orderId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "cancelled",
"refund_amount": 0.4
}{
"error": "Cannot cancel within 120 seconds of purchase. Please wait 82 seconds."
}Numbers & SMS
Cancel Order
Cancel an unused order for a full refund.
POST
/
api
/
v1
/
customer
/
cancel
/
{orderId}
Cancel an order
curl --request POST \
--url https://virtualsms.io/api/v1/customer/cancel/{orderId} \
--header 'X-API-Key: <api-key>'import requests
url = "https://virtualsms.io/api/v1/customer/cancel/{orderId}"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://virtualsms.io/api/v1/customer/cancel/{orderId}', 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/cancel/{orderId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://virtualsms.io/api/v1/customer/cancel/{orderId}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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/cancel/{orderId}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://virtualsms.io/api/v1/customer/cancel/{orderId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "cancelled",
"refund_amount": 0.4
}{
"error": "Cannot cancel within 120 seconds of purchase. Please wait 82 seconds."
}Rules
- Full refund. Cancelling returns the entire amount you were charged. There is no proration and no cancellation fee.
- 120-second cooldown. Cancellation is refused for the first 120 seconds after purchase, with
HTTP
425 Too Early. - Only before the first SMS. Once an SMS arrives the order leaves
waitingstatus and can no longer be cancelled.
error string only — there is no seconds_remaining field.
Cancel or swap?
If the number simply is not receiving the SMS, swap instead. A swap is free and keeps your money on the order; cancelling and buying again charges you twice for one verification. Cancel when you no longer want the verification at all, or when no replacement number is available to swap to.If you do nothing
An unused order auto-expires 20 minutes after purchase and is refunded automatically — no call needed. A background sweep runs every few seconds, so the refund lands promptly after the deadline. That makes doing nothing safe. It is not the fastest path to your money back, but you will never be charged for a verification that never arrived.Authorizations
API key from virtualsms.io dashboard (Settings -> API tab). Prefix: vsms_
Path Parameters
Order ID to cancel