TZ SMS

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

HTTPerror_codeMeaning
400invalid_jsonBody is not valid JSON
401unauthorizedMissing or invalid API key
403account_banned / account_suspended / api_disabled / sms_disabledAccount restriction
402insufficient_balanceNot enough credit
405method_not_allowedWrong HTTP method
409idempotency_conflictKey reused with a different request
422invalid_number / empty_message / message_too_longValidation error
422provider_rejectedProvider rejected the message (not charged)
429rate_limited / daily_limit_reached / otp_*Limits reached
202uncertain_outcomeOutcome unknown, being reconciled
503provider_not_configured / dedicated_provider_unavailableProvider unavailable
500internal_errorServer error