Back to Docs

Numbers API

Buy, manage, and configure phone numbers

70+ Countries

Global coverage

All Types

Local, toll-free, mobile

Search

Find specific numbers

Dual-Key Authentication

API KeyPermanent

X-Smsly-Key-Id: sk_live_xxx

SDK KeyRotatable

X-SMSLY-SDK-KEY: sdk_live_xxx

Quick Start

Python
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)

API Endpoints

GET/v1/numbersList your numbers
GET/v1/numbers/availableSearch available numbers
POST/v1/numbers/buyPurchase a number
POST/v1/numbers/:id/configureConfigure number
DELETE/v1/numbers/:idRelease a number

Ready to get phone numbers?

Get API Keys