SMSGram

API documentation

Send SMS from approved templates and check your balance through the SMSGram REST API.

Overview

The SMSGram API runs over HTTPS, and all requests and responses use JSON. SMS can only be sent using templates approved by our team — this prevents spam and fraud.

Base URL https://smsgram.uz/api/v1

Authentication

Every request must include a Bearer API key in the header. You can create an API key on the "Profile / API" page.

Authorization: Bearer sg_your_api_key
Get an API key

Templates with variables

If the template text contains variables like {name}, you must provide them via the "variables" object in the request body. If any variable is missing, the request returns a 422 error.

POST /api/v1/sms/send

Send SMS

Sends an SMS built from an approved template to one or more phone numbers at once.

Request parameters

Parameter Type Required Description
template_id integer Yes ID of the approved template used for sending
recipients string[] Yes List of recipient phone numbers (array)
variables object No Values for the template's {variables} (key-value object, optional if the template has none)

cURL

curl -X POST https://smsgram.uz/api/v1/sms/send \
  -H "Authorization: Bearer sg_api_kalit" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": 1,
    "recipients": ["998901234567", "998907654321"],
    "variables": {
      "ism": "Malika",
      "code": "482913"
    }
  }'

Successful response

{
  "success": true,
  "sms_id": 145,
  "provider_sms_id": "b7e1...",
  "recipients": 2,
  "error": null
}

Error response

{
  "success": false,
  "error": "variables.code maydoni shart"
}
GET /api/v1/balance

Check balance

Returns your current account balance.

cURL

curl https://smsgram.uz/api/v1/balance \
  -H "Authorization: Bearer sg_api_kalit"

Successful response

{
  "success": true,
  "balance": 80000
}

Error codes

401 API key is invalid or missing
402 Insufficient balance
403 User is banned
422 Invalid parameters, template not approved, or variables not filled in

Don't have an API key yet?

Create a free account