Multi-channel verification (SMS, WhatsApp, Voice, Email)
Text message OTP
WhatsApp message
Voice call OTP
Email verification
X-Smsly-Key-Id: sk_live_xxx
X-SMSLY-SDK-KEY: sdk_live_xxx
from smsly import SMSly
# === DUAL KEY SECURITY ===
# Two keys required (both can be in .env or embedded):
# 1. API Key - for authentication
# 2. SDK Key - for SDK validation
client = SMSly(
api_key="setup_api_your_key", # From dashboard
sdk_key="setup_sdk_your_key" # From dashboard
)
# Start verification (auto-selects best channel)
verification = client.verify.start(
to="+1234567890",
channel="sms" # or "whatsapp", "voice", "email"
)
print(f"Verification ID: {verification.id}")
# Check the code user entered
result = client.verify.check(
to="+1234567890",
code="123456"
)
if result.valid:
print("✓ Phone number verified!")
else:
print("✗ Invalid code, attempts remaining:", result.attempts_remaining)
# === METHOD 2: Environment Variables ===
# SMSLY_API_KEY=setup_api_xxx
# SMSLY_SDK_KEY=setup_sdk_xxx
client = SMSly() # Auto-reads from env/v1/verify/startStart verification/v1/verify/checkCheck verification code/v1/verify/cancelCancel verification/v1/verify/:idGet verification status