API Documentation
Authentication
Send your key in the Authorization header. Never put keys in URLs or public code.
Authorization: Bearer YOUR_TZ_SMS_API_KEY Content-Type: application/json
Responses are JSON and include request_id (for your own logs). Rate limit: 60 requests/minute per key.
GET /api/v1/balance.php
curl -H "Authorization: Bearer KEY" https://bulksms.tzalmamun.com/api/v1/balance.php
{"success":true,"balance":"100.0000","currency":"BDT","request_id":"..."}POST /api/v1/send.php
Body: number (required), message (required), optional idempotency_key (or Idempotency-Key header) to make retries safe.
curl -X POST -H "Authorization: Bearer KEY" -H "Content-Type: application/json" \
-d '{"number":"017XXXXXXXX","message":"Hello"}' https://bulksms.tzalmamun.com/api/v1/send.php
{"success":true,"request_id":"...","provider_message_id":null,"status":"submitted","segments":1,
"charged":"0.4000","remaining_balance":"99.6000"}
status = submitted means the provider accepted the request, not that it was delivered. If error_code is uncertain_outcome (HTTP 202) the result is being reconciled: do not resend; check status.php.
POST /api/v1/otp.php
Same body as send. Separate hourly limits per number and per account apply. OTP text is not retained after submission.
GET /api/v1/status.php?id=REQUEST_ID
Returns the status of one of your own requests: status, delivery_status, segments, charged. Delivery is only reported when the provider status has been verified; otherwise unknown.
GET /api/v1/usage.php
Returns totals and the 20 most recent API requests for your account.
Error codes
| HTTP | error_code | Meaning |
|---|---|---|
| 400 | invalid_json | Body is not valid JSON |
| 401 | unauthorized | Missing or invalid API key |
| 403 | account_banned / account_suspended / api_disabled / sms_disabled | Account restriction |
| 402 | insufficient_balance | Not enough credit |
| 405 | method_not_allowed | Wrong HTTP method |
| 409 | idempotency_conflict | Key reused with a different request |
| 422 | invalid_number / empty_message / message_too_long | Validation error |
| 422 | provider_rejected | Provider rejected the message (not charged) |
| 429 | rate_limited / daily_limit_reached / otp_* | Limits reached |
| 202 | uncertain_outcome | Outcome unknown, being reconciled |
| 503 | provider_not_configured / dedicated_provider_unavailable | Provider unavailable |
| 500 | internal_error | Server error |