Skip to main content

Official Python SDK for the VirtualSMS API: SMS verification, number rentals, and matching-country proxies on real carrier-issued mobile numbers (not VoIP), across 2500+ services in 145+ countries. Includes a typed client, and helpers for polling SMS codes and managing rentals and proxies from one prepaid balance.

Project description

VirtualSMS Python SDK

What is VirtualSMS?

Official Python SDK for the VirtualSMS API. VirtualSMS is an account verification platform for individuals, developers, and AI agents: one-time SMS verification, dedicated number rentals, matching-country proxies, and private cloud browser sessions (beta), all behind one API, one MCP server, and one prepaid balance. This SDK is a native Python client over the REST API, backed by real carrier-issued mobile numbers (real physical SIM cards, not VoIP) across 2500+ services in 145+ countries.

Built for developers and AI agents: REST API, hosted MCP server, SDKs.

This package talks to https://virtualsms.io/api/v1 directly. It is not a drop-in client library for any other verification service; version 2.0.0 is a from-scratch rewrite, replacing the v1.x package that wrapped a legacy dispatcher.

Installation

pip install virtualsms

Quick start

from virtualsms import VirtualSMS

# Get your API key at https://virtualsms.io/dashboard (Settings -> API Keys)
client = VirtualSMS("vsms_your_api_key")

# 1. Check balance
balance = client.get_balance()
print(f"Balance: ${balance['balance_usd']:.2f}")

# 2. Buy a number for WhatsApp verification in the UK
order = client.create_order("wa", "GB")
print(f"Use this number: {order['phone_number']}")

# 3. Wait for the verification code
result = client.wait_for_sms(order["order_id"])
if result["success"]:
    print(f"Code: {result['code']}")
else:
    print("Timed out, try get_sms(order_id) again later or cancel_order(order_id) for a refund.")

Full API reference: virtualsms.io/docs

Capabilities

  1. One-time SMS verification. Receive a code for a service like WhatsApp, Telegram, Discord, or a dating app, on demand, from $0.05 per code.
  2. Dedicated number rentals. Hold one number for 1-30 days and receive SMS from any service on that number, from $0.25/day.
  3. Matching-country proxies. Pair a number with an IP from the same country, across 223 proxy countries, from $1.10/GB.
  4. Private cloud browser sessions (beta). Start a country-matched browser in a live viewer for the signup step itself, invite-only.

Why real SIM cards

VirtualSMS runs on real carrier-issued mobile numbers, backed by real physical SIM cards, not VoIP. Services like WhatsApp, Telegram, Discord, and dating apps run a carrier lookup before they send a code, and VoIP or virtual numbers fail that check more often than a real SIM does. A physical SIM on a real carrier network reads like any other phone on that network, carriers like Vodafone, O2, and T-Mobile depending on the country, which is part of why VirtualSMS holds a 95%+ success rate across 2500+ services in 145+ countries.

What this SDK covers

All 46+ non-gated REST v1 methods across seven groups: activations/orders, rentals (full-access and platform tiers), proxies, account, one session-start method, one standalone public tool, and webhooks.

Group Examples
Activations / Orders list_services, get_price, create_order, wait_for_sms, cancel_order, swap_number, search_services, find_cheapest
Rentals rentals_available, create_rental, list_rentals, extend_rental, cancel_rental
Proxies list_proxy_catalog, buy_proxy, rotate_proxy, set_proxy_targeting, generate_proxy_endpoint
Account get_balance, get_profile, get_transactions, get_stats
Session start_manual_registration_session (invite-only beta)
Tools check_number
Webhooks list_webhooks, create_webhook, update_webhook, test_webhook, list_webhook_deliveries

Not covered (by design, gated on the API itself): release_rental (fee policy pending), interactive browser session control beyond starting one, and account registration/login (account creation is a web-only flow).

Rentals

Two tiers, identical refund terms (full refund within 20 minutes of purchase, before the first SMS):

# Full Access: local SIM inventory, works with any service
rental = client.create_rental(tier="full_access", country="GB", duration_hours=24, service="wa")

# Platform: sourced via our global supplier network, locked to one service per number
rental = client.create_rental(tier="platform", country="GB", duration_hours=24, service="wa")

client.extend_rental(rental["rental_id"], duration_hours=24)
client.cancel_rental(rental["rental_id"])

Proxies

catalog = client.list_proxy_catalog()
proxy = client.buy_proxy(pool_type="residential", gb=1, country_code="GB")
usage = client.get_proxy_usage(proxy["proxy_id"])
endpoint = client.generate_proxy_endpoint(proxy["proxy_id"], country_code="GB")
print(endpoint["endpoints"][0])

Errors

Every method raises a typed subclass of VirtualSMSError:

from virtualsms import VirtualSMS, InsufficientBalanceError, NoNumbersError, BadApiKeyError, RateLimitedError

client = VirtualSMS("vsms_your_api_key")
try:
    order = client.create_order("wa", "GB")
except NoNumbersError:
    print("No stock for this service/country right now.")
except InsufficientBalanceError:
    print("Top up at https://virtualsms.io")
except BadApiKeyError:
    print("Bad API key.")
except RateLimitedError:
    print("Slow down and retry later.")

A server error (5xx) on a mutating call (purchase, cancel, rotate, extend, etc.) is never retried automatically by this SDK, because the operation may have completed server-side despite the error. Verify with a read call (list_orders, get_order, list_rentals) before retrying by hand. GET requests get a bounded automatic retry (up to 3 attempts) on network errors and 5xx responses only.

Examples

See examples/ for complete, runnable scripts: an activation flow, a rental flow, and a proxy flow.

AI agents and MCP

This SDK is the API-client half: a typed wrapper an application or agent framework calls directly. The hosted MCP server is the separate agent-facing half, exposing the same capabilities as MCP tools for MCP-compatible clients like Claude and Cursor. Use this SDK when you're writing code that calls VirtualSMS; use the MCP server when an AI agent needs to call VirtualSMS itself without a code layer in between.

FAQ

What is VirtualSMS?

VirtualSMS is an account verification platform for individuals, developers, and AI agents. It combines one-time SMS verification, dedicated number rentals, matching-country proxies, and private cloud browser sessions behind one API, one MCP server, and one prepaid balance.

Does VirtualSMS use real SIM cards or VoIP numbers?

VirtualSMS uses real carrier-issued mobile numbers, backed by real physical SIM cards, not VoIP. Many services, including WhatsApp, Telegram, Discord, and dating apps, reject VoIP and virtual numbers at signup; a real physical SIM on a real carrier network passes that check far more often, which is reflected in a 95%+ success rate.

Which services and countries does VirtualSMS support?

VirtualSMS covers 2500+ services across 145+ countries for SMS verification and number rentals, plus matching-country proxies across 223 proxy countries. Coverage spans messaging apps, social platforms, marketplaces, dating apps, and financial services.

Can I rent a number, or only buy one-time codes?

Both. Buy a single one-time code from $0.05, or rent a dedicated number for 1-30 days from $0.25/day to receive SMS from any service on that number for the rental window.

Does VirtualSMS work with AI agents and MCP?

Yes. VirtualSMS exposes a hosted MCP server plus a REST API and official SDKs in nine languages, so an AI agent can request a number, wait for a code, or manage a rental the same way a developer would call the API directly.

How much does VirtualSMS cost?

Pricing is pay-as-you-go from one prepaid balance: SMS verification from $0.05 per code, number rentals from $0.25/day, and proxies from $1.10/GB. There is no subscription requirement.

Is there a free API key?

Yes. Creating a VirtualSMS account issues an API key immediately, at no cost. You only spend from your prepaid balance when you place an order: an activation, a rental, or a proxy.

Links

Product

Ecosystem

VirtualSMS's MCP server is listed across the major MCP directories:

Development

Run sh scripts/check-positioning.sh before committing copy changes. It fails on stale service or country counts and other banned positioning wording.

pip install -e ".[dev]"
pytest

Migrating from v1.x

v1.x wrapped a legacy sms-activate-compatible dispatcher (getBalance, getNumber, getStatus, etc). v2.0.0 is a full rewrite talking to /api/v1/* REST endpoints directly and is not backward compatible with the v1.x method names. See CHANGELOG.md for the full method mapping.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

virtualsms-2.0.0.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

virtualsms-2.0.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file virtualsms-2.0.0.tar.gz.

File metadata

  • Download URL: virtualsms-2.0.0.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for virtualsms-2.0.0.tar.gz
Algorithm Hash digest
SHA256 62f6e94fc13311d6a5e858f3fe3b0f8f1f938b3ea773f72b9966ccc741c1e851
MD5 8a0c5da50e6f2c3b19a3a7847656cdd2
BLAKE2b-256 1834046fe8470465f91653e68e7ae0e40eeaa893ec24fa5f544b6e98bc09e6f2

See more details on using hashes here.

File details

Details for the file virtualsms-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: virtualsms-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for virtualsms-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 800453b8c38675893b1932aee906ea018dc50a7d7e7beed3ec3e31dd7ab166fb
MD5 2678811348972c1365b9b7f0e92a5754
BLAKE2b-256 13d0f858af02232bc03c2a0dd7f6975cdd9764b31e6c679f29b5970aa49c1341

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page