Buy, manage, and configure phone numbers
Global coverage
Local, toll-free, mobile
Find specific numbers
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
)
# Search available numbers
available = client.numbers.search(
country="US",
type="local", # local, toll_free, mobile
area_code="415" # Optional
)
print(f"Found {len(available)} numbers")
# Buy a number
number = client.numbers.buy("+14155551234")
print(f"Purchased: {number.phone}")
# Configure for SMS/Voice
client.numbers.configure(number.id, {
"sms_webhook": "https://yourapp.com/webhooks/sms",
"voice_webhook": "https://yourapp.com/webhooks/voice"
})
# List your numbers
my_numbers = client.numbers.list()
for num in my_numbers:
print(f"{num.phone} - {num.country}")
# Release a number
client.numbers.release(number.id)/v1/numbersList your numbers/v1/numbers/availableSearch available numbers/v1/numbers/buyPurchase a number/v1/numbers/:id/configureConfigure number/v1/numbers/:idRelease a number