Integrate temporary numbers and OTP retrieval into Python scripts, Puppeteer scrapers, registration bots, and backend services.
Compatible out of the box with standard SMS verification libraries and bots. Use the base endpoint:
https://whichsms.org/stubs/handler_api.php
ACCESS_BALANCE:25.00
ACCESS_NUMBER:1492:15553920194 (Format: ACCESS_NUMBER:ORDER_ID:PHONE_NUMBER)
STATUS_WAIT_CODE (Still waiting for SMS)STATUS_OK:849201 (SMS received with extracted OTP)STATUS_CANCEL (Cancelled / 5-min timeout and refunded)
ACCESS_CANCEL (Released upstream, zero charges, balance refunded).
import time
import requests
API_KEY = "vsk_your_api_key_here"
BASE_URL = "https://whichsms.org/stubs/handler_api.php"
# 1. Order a WhatsApp USA number
resp = requests.get(f"{BASE_URL}?action=getNumber&service=wa&country=us&api_key={API_KEY}").text
if not resp.startswith("ACCESS_NUMBER"):
print("Error ordering number:", resp)
exit()
_, order_id, phone = resp.split(":")
print(f"Allocated Phone: +{phone} (Order ID: {order_id})")
# 2. Poll for SMS Code (Max 5 minutes)
start_time = time.time()
while time.time() - start_time < 300:
status_resp = requests.get(f"{BASE_URL}?action=getStatus&id={order_id}&api_key={API_KEY}").text
if status_resp.startswith("STATUS_OK"):
code = status_resp.split(":")[1]
print(f"✅ OTP Code Received: {code}")
break
elif status_resp == "STATUS_WAIT_CODE":
print("Waiting for SMS...")
time.sleep(3)
else:
print("Order ended or cancelled:", status_resp)
break
else:
# 3. Timeout: release upstream & auto-refund
requests.get(f"{BASE_URL}?action=setStatus&status=8&id={order_id}&api_key={API_KEY}")
print("Timeout reached: order cancelled and refunded.")