OTP Doğrulama API'si
Mobil Uygulama Entegrasyon Kılavuzu
SMS veya e-posta ile tek kullanımlık şifreler gönderin ve bunları herhangi bir uygulamadan doğrulayın. Kimlik doğrulama için kullanıcı düzeyinde bir API anahtarı veya bir cihaz token'ı gereklidir.
Bu endpoint bir Bearer token (Authorization başlığı) veya X-API-Token başlığı gerektirir — diğer endpoint'lerin aksine yalnızca mobil cihazlara özel DEĞİLDİR. Ayarlar → API Anahtarı bölümünden bir kullanıcı API anahtarı oluşturun.
OTP Gönderme
Bir kod üretir, yapılandırılmış kanal üzerinden alıcıya gönderir ve denemeyi kaydeder. Alıcı başına 60 saniyede bir gönderimle sınırlıdır.
İstek Gövdesi
| Alan | Tür | Açıklama | |
|---|---|---|---|
| recipient | string | zorunlu | Telefon numarası (E.164 formatı) veya e-posta adresi. |
| channel | string | isteğe bağlı | "sms" veya "email". Varsayılan olarak OTP Ayarlarında yapılandırılan kanal kullanılır. |
| lang | string | isteğe bağlı | Şablon dil kodu: en, ro, bg, fr, de, uk. Varsayılan "en". |
| ref_id | string | isteğe bağlı | İsteğe bağlı referansınız (sipariş ID'si, oturum ID'si, kullanıcı ID'si…) — doğrulama yanıtında geri döndürülür. |
Örnek İstek
cURL
curl -X POST "https://api.rcszilla.com/api/?endpoint=send_otp" \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Content-Type: application/json" \
-d '{"recipient":"+40700000000","channel":"sms","lang":"en","ref_id":"order_42"}'
PHP
$ch = curl_init('https://api.rcszilla.com/api/?endpoint=send_otp');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'recipient' => '+40700000000',
'channel' => 'sms',
'lang' => 'en',
'ref_id' => 'order_42',
]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR-API-TOKEN', 'Content-Type: application/json'],
]);
$result = json_decode(curl_exec($ch), true);
// $result = ['success' => true, 'otp_id' => 42]
Python
import requests
r = requests.post(
"https://api.rcszilla.com/api/",
params={"endpoint": "send_otp"},
json={"recipient": "+40700000000", "channel": "sms", "lang": "en", "ref_id": "order_42"},
headers={"Authorization": "Bearer YOUR-API-TOKEN"},
timeout=10,
)
print(r.json()) # {'success': True, 'otp_id': 42}
Node.js
const res = await fetch("https://api.rcszilla.com/api/?endpoint=send_otp", {
method: "POST",
headers: { "Authorization": "Bearer YOUR-API-TOKEN", "Content-Type": "application/json" },
body: JSON.stringify({ recipient: "+40700000000", channel: "sms", lang: "en", ref_id: "order_42" }),
});
const data = await res.json();
// data = { success: true, otp_id: 42 }
Ruby
require 'net/http'; require 'json'
uri = URI("https://api.rcszilla.com/api/?endpoint=send_otp")
req = Net::HTTP::Post.new(uri, 'Authorization' => 'Bearer YOUR-API-TOKEN', 'Content-Type' => 'application/json')
req.body = {recipient: '+40700000000', channel: 'sms', lang: 'en'}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |h| h.request(req) }
puts JSON.parse(res.body)
Go
payload, _ := json.Marshal(map[string]string{"recipient": "+40700000000", "channel": "sms", "lang": "en"})
req, _ := http.NewRequest("POST", "https://api.rcszilla.com/api/?endpoint=send_otp", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR-API-TOKEN")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
// read resp.Body...
Java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.rcszilla.com/api/?endpoint=send_otp"))
.header("Authorization", "Bearer YOUR-API-TOKEN")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(
"{\"recipient\":\"+40700000000\",\"channel\":\"sms\",\"lang\":\"en\"}"
))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
// parse response.body() as JSON
Yanıt
JSON200 OK
{
"success": true,
"message": "OTP sent.",
"otp_id": 42
}
JSON429 Rate Limited
{
"success": false,
"message": "Please wait 45 seconds before requesting a new code.",
"retry_after": 45
}
OTP Doğrulama
Gönderilen kodu, bu alıcı için en son bekleyen OTP ile karşılaştırır. Eşleşme durumunda başarı döndürür ve OTP'yi doğrulanmış olarak işaretler.
İstek Gövdesi
| Alan | Tür | Açıklama | |
|---|---|---|---|
| recipient | string | zorunlu | Gönderme çağrısında kullanılan telefon/e-posta ile aynı olmalıdır. |
| code | string | zorunlu | Kullanıcının girdiği kod. |
Örnek İstek
cURL
curl -X POST "https://api.rcszilla.com/api/?endpoint=verify_otp" \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Content-Type: application/json" \
-d '{"recipient":"+40700000000","code":"123456"}'
PHP
$ch = curl_init('https://api.rcszilla.com/api/?endpoint=verify_otp');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['recipient' => '+40700000000', 'code' => '123456']),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR-API-TOKEN', 'Content-Type: application/json'],
]);
$result = json_decode(curl_exec($ch), true);
if ($result['success']) {
// phone verified — proceed with user action
}
Python
r = requests.post(
"https://api.rcszilla.com/api/",
params={"endpoint": "verify_otp"},
json={"recipient": "+40700000000", "code": "123456"},
headers={"Authorization": "Bearer YOUR-API-TOKEN"},
)
if r.json().get("success"):
pass # verified — continue
Node.js
const res = await fetch("https://api.rcszilla.com/api/?endpoint=verify_otp", {
method: "POST",
headers: { "Authorization": "Bearer YOUR-API-TOKEN", "Content-Type": "application/json" },
body: JSON.stringify({ recipient: "+40700000000", code: "123456" }),
});
const { success, message, otp_id, ref_id, verified_at } = await res.json();
Ruby
require 'net/http'; require 'json'
uri = URI("https://api.rcszilla.com/api/?endpoint=verify_otp")
req = Net::HTTP::Post.new(uri, 'Authorization' => 'Bearer YOUR-API-TOKEN', 'Content-Type' => 'application/json')
req.body = {recipient: '+40700000000', code: '123456'}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |h| h.request(req) }
puts JSON.parse(res.body)
Go
payload, _ := json.Marshal(map[string]string{"recipient": "+40700000000", "code": "123456"})
req, _ := http.NewRequest("POST", "https://api.rcszilla.com/api/?endpoint=verify_otp", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR-API-TOKEN")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
// read resp.Body...
Yanıt
JSON200 OK
{
"success": true,
"message": "OTP verified successfully.",
"otp_id": 42,
"ref_id": "order_42",
"verified_at": "2026-05-05T14:30:00+00:00"
}
JSON422 Wrong Code
{
"success": false,
"message": "Wrong code. 2 attempt(s) remaining.",
"attempts_remaining": 2
}
Hata Kodları
| HTTP | Açıklama |
|---|---|
| 400 | Hatalı istek veya bilinmeyen eylem. |
| 401 | Geçersiz veya eksik API token'ı. |
| 403 | Çok fazla yanlış deneme — OTP geçersiz kılındı. |
| 404 | Bu alıcı için etkin OTP bulunamadı. |
| 410 | OTP'nin süresi doldu. |
| 422 | Yanlış kod — yanıt attempts_remaining içerir. |
| 429 | Hız sınırı — yanıt retry_after (saniye) içerir. |
| 500 | Teslimat hatası — kanal ayarlarınızı kontrol edin. |