Skip to main content

Send Postal code SMS

This API allows you to send messages using postal codes.

📍 Endpoint

POST {base_url}/api/send

🧾 Headers

KeyValue
AuthorizationYOUR_TOKEN_HERE
Content-Typeapplication/json

📤 Request Body

{
"sending_type": "postal_code",
"from_number": "+98BANK",
"message": "متن پیام",
"params": [
{
"bank": "all",
"postal_code": 131,
"gender": 0,
"age_from": 1330,
"age_to": 1402,
"mci": {
"start": 0,
"size": 1
},
"irancell": {
"start": 0,
"size": 0
},
"other": {
"start": 0,
"size": 0
}
},
{
"bank": "all",
"postal_code": 141,
"gender": 0,
"age_from": 1330,
"age_to": 1402,
"mci": {
"start": 0,
"size": 1
},
"irancell": {
"start": 0,
"size": 0
},
"other": {
"start": 0,
"size": 0
}
}
],
"other_recipients": [
"+989120000000",
"+989350000000"
],
"send_time": "2025-02-28 10:52:02"
}

📝 Parameters

ParameterTypeRequiredDescription
sending_typestringYesType of sending, must be "postal_code" for this endpoint
from_numberstringYesSender's phone number in E.164 format (e.g., +98BANK)
messagestringYesMessage content to be sent to the recipients
paramsarrayYesArray of objects containing postal code and recipient details
bankstringYesBank number status "all" for all numbers or "white" for none blacklist
postal_codeintegerYesPostal code to target recipients , most be between 2 to 5 digits
genderintegerYesGender of recipients (0 for all,1 for male, 2 for female)
age_fromintegerYesMinimum birth year of recipients (e.g., 1330), must be between 1300 to 1410
age_tointegerYesMaximum birth year of recipients (e.g., 1402), must be between 1300 to 1410
mciobjectYesMCI number details, contains start and size for selecting MCI numbers
irancellobjectYesIrancell number details, contains start and size for selecting Irancell numbers
otherobjectYesOther number details, contains start and size for selecting other numbers
other_recipientsarrayNoList of additional recipient phone numbers in E.164 format (e.g., +989120000000)
send_timestringNoScheduled time for sending the message in YYYY-MM-DD HH:MM:SS format (timezone is UTC)

📝 Notes

  • The from_number must be a valid sender number assigned to your account.
  • The send_time is optional; if not provided, the message will be sent immediately.
  • The other_recipients array is optional and an array of phone numbers that will receive the message in addition to the province or county or city recipients.

✅ Success Response

{
"data": {
"message_outbox_ids": [
1123594208
]
},
"meta": {
"status": true,
"message": "انجام شد",
"message_parameters": [],
"message_code": "200-1"
}
}

❌ Error Response — Invalid or Expired Token (401)

{
"data": null,
"meta": {
"status": false,
"message": "اطلاعات وارد شده صحیح نمی باشد",
"message_parameters": [],
"message_code": "400-1",
"errors": {}
}
}

❌ Error Response — Invalid Request (422)

{
"data": null,
"meta": {
"status": false,
"message": "تکمیل گزینه پیام الزامی است",
"message_parameters": [],
"message_code": "400-2",
"errors": {
"message": [
"تکمیل گزینه پیام الزامی است"
]
}
}
}

🧪 Example Request

curl --location '{base_url}/api/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: API TOKEN' \
--data '{
"sending_type": "postal_code",
"from_number": "+98BANK",
"message": "متن پیام",
"params": [
{
"bank": "all",
"postal_code": 131,
"gender": 0,
"age_from": 1330,
"age_to": 1402,
"mci": {
"start": 0,
"size": 1
},
"irancell": {
"start": 0,
"size": 0
},
"other": {
"start": 0,
"size": 0
}
},
{
"bank": "all",
"postal_code": 141,
"gender": 0,
"age_from": 1330,
"age_to": 1402,
"mci": {
"start": 0,
"size": 1
},
"irancell": {
"start": 0,
"size": 0
},
"other": {
"start": 0,
"size": 0
}
}
],
"other_recipients": [
"+989120000000",
"+989350000000"
],
"send_time": "2025-02-28 10:52:02"
}'