Mēs piegādājam, jūs nopelnāt

Getting started

This is where the magic begins! Follow these steps to start creating amazing apps using the API: Log into the dashboard using your SMSgic account.

Create an access token and use it in your API requests.

For more convenient work, download our Postman collection and you are ready to start.

GEThttps://api.smsgic.com/balance

Get account balance.

This endpoint allows you to retrieve your account balance.

Request
Copy
GET/balance
curl -X GET \ 
 -G "https://api.smsgic.com/balance" \ 
 -H "Authorization: Bearer {token}" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
success: Response with 200 code
Copy
{
 "balance": "450.000",
 "sign": "£",
 "code": "GBP",
}
Auth token invalid: Response with 401 code
Copy
{
 "message":"Unauthenticated."
}
GEThttps://api.smsgic.com/senders

Get account senders.

This endpoint allows you to retrieve your account senders.

Request
Copy
GET/senders
curl -X GET \ 
 -G "https://api.smsgic.com/senders" \ 
 -H "Authorization: Bearer {token}" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
success: Response with 200 code
Copy
{
 "senders": [
  {
   "id": 45,
   "sender": "MegaShop",
  },
  {
   "id": 46,
   "sender": "DSTLCKDM",
  },
  {
   "id": 136,
   "sender": "MEGA",
  },
 ]
}
Auth token invalid: Response with 401 code
Copy
{
 "message":"Unauthenticated."
}
GEThttps://api.smsgic.com/rates

Get account rates with currency.

This endpoint allows you to retrieve your account rates. Rates are filtered if use params.

Common attributes

mccstring

This field is required when mnc is present. Must match the regex /^\d{3}$/

mncstring

Must match the regex /^\d{0,3}|'null'$/.

countrystring

Part of country title for search.

country_idinteger

Valid Id of country in smsgic.com for search.

Request
Copy
GET/rates
curl -X GET \ 
 -G "https://api.smsgic.com/rates" \ 
 -H "Authorization: Bearer {token}" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
 -d '{"mcc":"742","mnc":"551","country":"Latvia","country_id":1}'
success: Response with 200 code
Copy
{
 "rates": [
  {
   "mcc": "218",
   "mnc": "90",
   "country": "Latvia",
   "rate": 0.4397,
  },
  {
   "mcc": "218",
   "mnc": null,
   "country": "Latvia",
   "rate": 0.4397,
  },
  {
   "mcc": "218",
   "mnc": "05",
   "country": "Latvia",
   "rate": 0.4397
  },
  {
   "mcc": "218",
   "mnc": "03",
   "country": "Latvia",
   "rate": 0.4397,
  },
 ]
}
Auth token invalid: Response with 401 code
Copy
{
 "message":"Unauthenticated."
}
GEThttps://api.smsgic.com/status

Get SMS API status.

API exposes an endpoint for checking the service status.

Request
Copy
GET/status
curl -X GET \ 
 -G "https://api.smsgic.com/status" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
success: Response with 200 code
Copy
["OK"]
POSThttps://api.smsgic.com/sendings/calculate

Calculate SMS messaging.

This endpoint allows you to receive the calculate of SMS messaging. The method supports 3000 requests per minute. There are no software restrictions on the quantity of phone numbers

Common attributes

messagestring | required

Text of sending SMS.

recipientsstring[] | required

Must match the regex /^\d{8,20}$/.

Request
Copy
POST/sendings/calculate
curl -X POST \ 
  "https://api.smsgic.com/sendings/calculate" \ 
 -H "Authorization: Bearer {token}" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
 -d '{"message":"message","recipients":["50670503888225"]}'
success: Response with 200 code
Copy
{
 "calculate": {
  "info": {
   "sms_count": 3,
   "subtotal": 1.35,
   "total": 1.35,
   "tax": 0,
  },
  "destinations": [
   {
    "numbers": [
     {
      "phone_number": 45879921,
      "destination": "Denmark Telenor",
      "sms": 1,
      "rate": 0.45,
      "total": 0.45,
     },
    ],
    "destination": "Denmark Telenor",
    "sms_count": 1,
    "price": 0.45,
    "total": 0.45,
   },
   {
    "numbers": [
     {
      "phone_number": 6523478945,
      "destination": "Singapore ",
      "sms": 1,
      "rate": 0.45,
      "total": 0.45,
     },
    ],
    "destination": "Singapore ",
    "sms_count": 1,
    "price": 0.45,
    "total": 0.45,
   },
   {
    "numbers": [
     {
      "phone_number": 7554684221,
      "destination": "Russia ",
      "sms": 1,
      "rate": 0.45,
      "total": 0.45,
     },
    ],
    "destination": "Russia ",
    "sms_count": 1,
    "price": 0.45,
    "total": 0.45,
    }
   ]
  }
}
Auth token invalid: Response with 401 code
Copy
{
 "message":"Unauthenticated."
}
message not sent: Response with 422 code
Copy
{
 "message": "Please send `message` post parameter with text for SMS",
 "errors": {
   "message": [
     "Please send `message` post parameter with text for SMS"
   ]
 }
}
recipients not sent: Response with 422 code
Copy
{
 "message": "Please send `recipients` post parameter with recipient`s number",
 "errors": {
   "recipients": [
     "Please send `recipients` post parameter with recipient`s number"
   ]
 }
}
data not sent: Response with 422 code
Copy
{
 "message": "The given data was invalid.",
 "errors": {
   "message": [
     "Please send `message` post parameter with text for SMS"
   ],
   "recipients": [
     "Please send `recipients` post parameter with recipient`s number"
   ]
 }
}
GEThttps://api.smsgic.com/sendings

Get your account SMS messages.

This endpoint allows you to retrieve your account SMS messages.

Request
Copy
GET/sendings
curl -X GET \ 
 -G "https://api.smsgic.com/sendings" \ 
 -H "Authorization: Bearer {token}" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
success: Response with 200 code
Copy
{
 "sendings": [
  {
   "id": 301,
   "text": "Test Message",
   "created_at": "2023-04-11T15:46:26.000000Z",
   "scheduled_at": "2023-04-11 15:46:26",
   "status": "Pending",
   "total_sms": 1,
  },
  {
   "id": 452,
   "text": "SEND SMS FOR ME",
   "created_at": "2023-06-06T12:39:35.000000Z",
   "scheduled_at": "2023-06-06 12:39:35",
   "status": "Pending",
   "total_sms": 2,
  },
  {
   "id": 457,
   "text": "ANOTHER text of SMS",
   "created_at": "2023-06-06T13:41:57.000000Z",
   "scheduled_at": "2023-06-06 13:41:57",
   "status": "Pending",
   "total_sms": 2,
  },
 ]
}
Auth token invalid: Response with 401 code
Copy
{
 "message":"Unauthenticated."
}
POSThttps://api.smsgic.com/sendings

Start SMS messaging.

This endpoint allows you create SMS messaging. Your account must have balance enough.

Common attributes

typestring

Possible options: default, infobip, twilio, messente, trumpia.

Attributes

messagestring | required

Text of sending SMS.

recipientsstring[] | required

Array of phone numbers for send SMS. Must match the regex /^\d{8,20}$/.

senderstring | required

Title of default or your account sender approved.

scheduled_atdate

Schedule SMS sending at time. Must be a valid date in the format Y-m-d H:i:s.

Request
Copy
POST/sendings
curl -X POST \ 
  "https://api.smsgic.com/sendings" \ 
 -H "Authorization: Bearer {token}" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
 -d '{"message":"message","recipients":"[\"951490713339111991\"]","sender":"INFO","scheduled_at":"2023-08-22 09:03:42"}'
success: Response with 200 code
Copy
{
 "message": "SMS champing created",
 "sending_id": 458,
}
Auth token invalid: Response with 401 code
Copy
{
 "message":"Unauthenticated."
}
Message not sent: Response with 422 code
Copy
{
  "message": "Please send `message` post parameter with text for SMS",
  "errors": {
    "message": ["Please send `message` post parameter with text for SMS"]
  }
}
Recipients not sent: Response with 422 code
Copy
{
  "message": "Please send `recipients` post parameter with recipient`s number",
  "errors": {
    "message": ["Please send `recipients` post parameter with recipient`s number"]
  }
}
Sender not sent: Response with 422 code
Copy
{
  "message": "Please send `sender` post parameter with name of SMS sender",
  "errors": {
    "message": ["Please send `sender` post parameter with name of SMS sender"]
  }
}
GEThttps://api.smsgic.com/sendings/{id}

Get your account SMS messaging status.

This endpoint allows you to retrieve your account SMS messages status.

idinteger | required

The ID of the sending.

Request
Copy
GET/sendings/{id}
curl -X GET \ 
 -G "https://api.smsgic.com/sendings/301" \ 
 -H "Authorization: Bearer {token}" \ 
 -H "Content-Type: application/json" \ 
 -H "Accept: application/json" \ 
success: Response with 200 code
Copy
{
 "sending": {
  "id": 301,
  "status": "Draft",
  "updated_at": "2023-04-11T15:46:26.000000Z",
  "scheduled_at": "2023-04-11 15:46:26",
 }
}
Auth token invalid: Response with 401 code
Copy
{
 "message":"Unauthenticated."
}
SMS Sending not found: Response with 404 code
Copy
{
 "message": "No query results for model 301"
}