Send OTP
Generates a one-time code and sends it via SMS to the specified Turkmenistan phone number. The code length (4–10 digits, default 6) and validity (60–600 seconds, default 300) come from the API key's settings in the client portal.
POST/api/v1/otp/send
X-API-KeyBody parameters
| Field | Type | Required | Description |
|---|---|---|---|
| phone_number | string | required | E.164 format, +993 followed by 8 digits |
Example request
curl -X POST https://api.ugrat.com/api/v1/otp/send \
-H "X-API-Key: uk_live_a3f9c2e1..." \
-H "Content-Type: application/json" \
-d '{"phone_number": "+99361394459"}'
Example response
{
"success": true,
"data": {
"reference_id": "550e8400-e29b-41d4-a716-446655440000",
"expires_in": 300
}
}
Keep the reference_id; it is required by Verify OTP. expires_in is the code's validity in seconds.
Errors
| Code | Description |
|---|---|
| 400 VALIDATION_FAILED | Invalid phone format (fields[].code = invalid_phone) |
| 400 BAD_REQUEST | Malformed JSON |
| 401 UNAUTHORIZED | API key missing or invalid |
| 403 ACCOUNT_PENDING / ACCOUNT_BLOCKED | Account not approved yet, or blocked |
| 429 RATE_LIMITED | Too many requests — retry after Retry-After |
| 503 SERVICE_UNAVAILABLE | No delivery route is available right now — retry later |