API Documentation

API Documentation

Introduction

This documentation provides details about the OTP Sending System API. The API allows you to send OTP messages programmatically using your API key.

Authentication

All API requests require an API key. Include your API key in the request body as shown in the examples below.

{
  "apiKey": "your-api-key",
  "phoneNumber": "+993 65 12 34 56",
  "message": "Your OTP code is: 123456",
  "projectName": "Your Project Name"
}

Endpoints

Send OTP
Method:POST
URL:/api/send-otp

Parameters

ParameterTypeRequiredDescription
apiKeystringYesYour API key from the dashboard
phoneNumberstringYesRecipient phone number in Turkmenistan format
messagestringYesThe OTP message to send
projectNamestringYesName of your project for identification

Example Request

POST /api/send-otp
Content-Type: application/json

{
  "apiKey": "sk-1234567890abcdef",
  "phoneNumber": "+993 65 12 34 56",
  "message": "Your verification code is: 54321",
  "projectName": "My Mobile App"
}

Example Response

{
  "success": true,
  "message": "OTP sent successfully",
  "data": {
    "phoneNumber": "+993 65 12 34 56",
    "projectName": "My Mobile App",
    "sentAt": "2023-05-15T14:30:00.000Z"
  }
}

Phone Number Format

Phone numbers must be in the following format for Turkmenistan:

Example: +993 65 12 34 56

Rules:

  • Must start with +993 (Turkmenistan country code)
  • Second part must be one of: 65, 64, 63, 62, 61, or 71
  • Followed by six digits in pairs: XX XX XX

Rate Limiting

The API is rate limited to 100 requests per hour per API key.

Error Codes

CodeMessage
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
429Too Many Requests - Rate limit exceeded
500Internal Server Error