Skip to main content

Welcome to the Lamah SMS API

The Lamah SMS API is a RESTful API that allows you to send SMS messages, manage OTP verification, and handle communication workflows programmatically. Our API is designed to be simple, reliable, and scalable. Base URL: https://sms.lamah.com

API Overview

The Lamah SMS API provides the following core functionalities:

Example Scenario

See real estate flows with Libyan numbers in snippets/real-estate-libya.mdx.

Authentication

All API endpoints require authentication using Bearer tokens. Include your API token in the Authorization header:
Authorization: Bearer YOUR_API_TOKEN
You can obtain your API token from your Lamah dashboard by:
  1. Navigating to the Projects section
  2. Creating or selecting a project
  3. Copying the API token from the project details

Request Format

All requests should be made using HTTPS and include the appropriate headers:
Content-Type: application/json
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Spec source: Postman collection at https://sms.lamah.com/docs/collection.json

Response Format

All API responses are returned in JSON format. Successful responses will include the requested data, while error responses will include error details and status codes.

Success Response Example

{
  "message_id": "msg_123456789",
  "status": "sent",
  "cost": 0.05
}

Error Response Example

{
  "error": "Invalid phone number format",
  "code": "INVALID_PHONE",
  "status": 400
}

Rate Limits

The API has rate limits to ensure fair usage:
  • SMS Endpoints: 100 requests per minute
  • OTP Endpoints: 10 requests per minute per phone number
  • Other Endpoints: 1000 requests per minute
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

Error Codes

Common HTTP status codes used by the API:
Status CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API token
403Forbidden - Insufficient permissions
404Not Found - Resource not found
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Postman Collection

Download the latest Postman Collection that mirrors these endpoints:
  • api-reference/openapi.json (Postman collection format)
Import it into Postman to explore, test, and generate client code. All examples in this documentation use realistic Libyan phone numbers in international format (e.g., +218912345678).