← Back to Home

Massejli SMS API

REST API v1 Documentation

Base URL: https://sms.massej.li/api/v1/

Authentication

All API requests require authentication using your API key. Include it in the request headers:

X-API-Key: your_api_key_here

Or use the Authorization header:

Authorization: Bearer your_api_key_here

You can find your API key in your Profile Settings.

Rate Limiting

API requests are limited to 100 requests per minute per API key. If you exceed this limit, you'll receive a 429 Too Many Requests response.

Endpoints

POST /send Send single SMS

Send an SMS to a single recipient.

Request Body

Parameter Type Description
to required string Recipient phone number (international format)
message required string Message content
sender_id optional string Sender ID (max 11 chars). Default: "SMS"
message_type optional integer 1=English, 2=Unicode, 4=Arabic. Default: 1
schedule_time optional string Schedule time (Y-m-d H:i:s format)

Example Request

curl -X POST https://sms.massej.li/api/v1/send \ -H "X-API-Key: your_api_key" \ -H "Content-Type: application/json" \ -d '{ "to": "+961123456789", "message": "Hello from API!", "sender_id": "MyApp" }'

Response

{ "success": true, "message": "SMS sent successfully", "data": { "message_id": 12345, "cost": 1.5, "balance": 98.5 } }
POST /send-bulk Send bulk SMS

Send the same SMS to multiple recipients (max 1000).

Request Body

Parameter Type Description
recipients required array Array of phone numbers
message required string Message content
sender_id optional string Sender ID (max 11 chars)

Example Request

{ "recipients": ["+961123456789", "+961987654321"], "message": "Bulk message to all!", "sender_id": "MyApp" }
GET /balance Get account balance

Get your current account balance.

Response

{ "success": true, "data": { "balance": 100.00, "currency": "points" } }
GET /logs Get SMS logs

Get your SMS sending history.

Query Parameters

Parameter Type Description
page integer Page number (default: 1)
per_page integer Items per page (1-100, default: 20)
status string Filter by status: delivered, sent, pending, failed
date_from string Start date (Y-m-d format)
date_to string End date (Y-m-d format)
GET /pricing Get country pricing

Get SMS pricing for all supported countries.

Response

{ "success": true, "data": { "pricing": [ {"country_code": "961", "country_name": "Lebanon", "points_per_sms": 1.5}, {"country_code": "1", "country_name": "USA", "points_per_sms": 1.0} ] } }
POST /preview Preview cost

Calculate cost before sending without actually sending the message.

Request Body

Parameter Type Description
recipients array Array of phone numbers
to string Single phone number (alternative to recipients)
message required string Message content
GET /account Get account info

Get your account information and statistics.

Error Handling

All errors return a JSON response with the following structure:

{ "success": false, "error": "Error message here", "code": 400 }

HTTP Status Codes

Code Description
200 Success
201 Created successfully
400 Bad request - Invalid parameters
401 Unauthorized - Invalid or missing API key
403 Forbidden - Account not active
404 Not found
429 Rate limit exceeded
500 Internal server error