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
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your API key from the dashboard |
| phoneNumber | string | Yes | Recipient phone number in Turkmenistan format |
| message | string | Yes | The OTP message to send |
| projectName | string | Yes | Name 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
| Code | Message |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |