Base URL: https://www.smsforai.com/api/v1
All authenticated endpoints require a Bearer token in the Authorization header.
Authorization: Bearer smsai_<your-token>
/api/v1
Public
Returns API version, status, and available endpoints.
Response
{ "api": "SMS for AI", "version": "1.0", "status": "ok" }
/api/v1/me
🔑 Auth required
Get details about the current API token and authenticated user.
Response
{
"token": { "id": 1, "name": "My Agent", "permissions": ["sms:send"] },
"user": { "name": "Alice", "email": "alice@example.com", "credits": 12.345678 }
}
/api/v1/balance
🔑 Auth required
Get the current credit balance of the authenticated account.
Response
{ "credits_usd": 12.345678 }
/api/v1/countries
🔑 Auth required
Get a list of all active countries and their per-SMS prices in USD.
Response
[
{ "country_code": "US", "country_name": "United States", "dial_code": "+1", "price_usd": 0.01 },
...
]
/api/v1/sms/send
🔑 Auth required
Send an SMS message. Your token must have the 'sms:send' permission.
Request Body
{
"to": "+12025551234", // E.164 format, required
"body": "Hello!", // message text, max 1600 chars
"sender_id": "MyApp" // optional alphanumeric sender ID
}
Response
{
"id": 42,
"status": "sent",
"to": "+12025551234",
"price_usd": 0.01,
"nvia_message_id": "abc123"
}
/api/v1/sms
🔑 Auth required
List sent messages. Supports ?status=sent|delivered|failed and pagination.
Response
{ "data": [...], "links": { ... }, "meta": { ... } }
/api/v1/sms/{id}
🔑 Auth required
Get a specific SMS by ID.
Response
{ "id": 42, "status": "delivered", "to": "+12025551234", ... }
| HTTP | Meaning |
|---|---|
| 401 | Missing or invalid Bearer token |
| 403 | Token lacks the required permission, IP not whitelisted, or spending limit reached |
| 402 | Insufficient credits to send SMS |
| 422 | Validation error — check request body |
| 429 | Rate limit exceeded (per-minute or per-day) |
| 500 | Internal server error or SMS gateway failure |
import requests
TOKEN = "smsai_YourTokenHere"
BASE = "https://www.smsforai.com/api/v1"
resp = requests.post(
f"{BASE}/sms/send",
headers={"Authorization": f"Bearer {TOKEN}", "Accept": "application/json"},
json={
"to": "+12025551234",
"body": "Your OTP is 482910. Reply STOP to opt out.",
"sender_id": "MYAPP"
}
)
data = resp.json()
print(data["status"], data["id"], data["price_usd"])