SmsAPI Python Client
raw JSON → 2.9.6 verified Fri May 01 auth: no python
Official Python client library for the SmsAPI platform, enabling sending SMS, MMS, VMS, and managing phone numbers, contacts, and SMS templates. The current version is 2.9.6, with regular updates following the release cadence of the underlying API.
pip install smsapi-client Common errors
error ImportError: No module named smsapi ↓
cause The library is installed as 'smsapi-client' on PyPI but the import path uses 'smsapi' (package name).
fix
Install the correct package: pip install smsapi-client, then import from smsapi.client import SmsApi.
error AttributeError: 'SmsApiResponse' object has no attribute 'id' ↓
cause Attempting to access response details on a failed send response. The response object does not have the 'id' attribute when the request fails.
fix
Check result.success or result.error before accessing result.id. Use: if result.success: print(result.id)
error TypeError: __init__() got an unexpected keyword argument 'token' ↓
cause The SmsApi constructor does not accept a 'token' parameter; it expects 'username' and 'password'.
fix
Use SmsApi(username='your_username', password='your_password') instead of passing an API token.
Warnings
gotcha The SmsApi constructor requires both username and password; these are not API tokens. Do not confuse with the API token authentication used in other SMS API libraries. ↓
fix Use your SmsAPI account username and password (or API password) – not an API token directly.
gotcha After sending a message, the response object's properties (e.g., .id, .points, .status) are only available if the send was successful. Accessing them on failure may raise AttributeError. ↓
fix Always check the response's error attribute or catch exceptions before accessing result properties.
deprecated Python 2 support is deprecated; the library may be removed in future versions. ↓
fix Upgrade to Python 3.6+ and use the latest version of the library.
Imports
- SmsApi wrong
import smsapicorrectfrom smsapi.client import SmsApi
Quickstart
from smsapi.client import SmsApi
client = SmsApi(username=os.environ.get('SMSAPI_USERNAME', ''),
password=os.environ.get('SMSAPI_PASSWORD', ''))
result = client.sms.send(to='48123456789', message='Hello from SmsAPI!')
print(result)