Documentation

API reference

Everything you need to integrate: authentication, endpoints, payloads, webhooks and error codes.

Quickstart

cURL
curl -X POST https://api.blacksms.in/api/v1/sms/send \
  -H "Authorization: Bearer $BLACKSMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"919876543210","sender_id":"BLKSMS","message":"Hello"}'

Endpoints

MethodPathPurpose
POST/api/v1/sms/sendQueue a single SMS
POST/api/v1/otp/sendGenerate and send a one-time passcode
POST/api/v1/otp/verifyVerify a submitted code
POST/api/v1/otp/resendResend the pending code for a number
POST/api/public/dlrProvider delivery-report receiver

Request fields

SMS body
{
  "to": "919876543210",         // required, E.164 without +
  "sender_id": "BLKSMS",        // required, approved sender
  "message": "Hello",           // required unless template_id is used
  "message_type": "transactional", // transactional | otp | promotional
  "project_id": "uuid",         // optional
  "template_id": "uuid",        // optional, renders with variables
  "variables": { "name": "Asha" }
}
OTP body
{
  "phone": "919876543210",   // required
  "sender_id": "BLKSMS",     // required
  "purpose": "login",        // optional label
  "code_length": 6,          // 4-8, default 6
  "expiry_seconds": 300,     // 60-3600, default 300
  "max_attempts": 5,         // 1-10, default 5
  "template": "{{code}} is your code"
}

Error codes

Every failure returns the same shape with a stable code.

HTTPCodeMeaning
401UNAUTHORIZEDMissing or invalid API key.
401KEY_REVOKEDThis API key has been revoked.
401KEY_EXPIREDThis API key has expired.
403FORBIDDENYou do not have access to this resource.
403ACCOUNT_SUSPENDEDThis account is suspended.
422VALIDATION_ERROROne or more fields are invalid.
422INVALID_PHONEThe destination phone number is invalid.
422INVALID_SENDERThe sender ID is not approved for this account.
422MESSAGE_TOO_LONGThe message exceeds the maximum allowed length.
402INSUFFICIENT_BALANCEInsufficient wallet balance.
402WALLET_FROZENThis wallet is frozen. Contact support.
429RATE_LIMITEDRate limit exceeded. Slow down and retry.
409DUPLICATE_REQUESTAn identical message was sent moments ago.
403DESTINATION_BLOCKEDThis destination is blocked.
503NO_ROUTENo active route is available for this destination.
404OTP_NOT_FOUNDNo pending OTP found for this number.
410OTP_EXPIREDThis OTP has expired.
422OTP_INVALIDThe OTP code is incorrect.
429OTP_MAX_ATTEMPTSToo many incorrect attempts. Request a new code.
429OTP_COOLDOWNPlease wait before requesting another code.
404NOT_FOUNDResource not found.
405METHOD_NOT_ALLOWEDHTTP method not allowed on this endpoint.
502PROVIDER_ERRORThe upstream SMS provider rejected the request.
500INTERNAL_ERRORSomething went wrong. Try again.