مرجع API · Settings
Request phone verification code
post
/settings/phone/request-code| احراز هویت | توکن مشتری (Bearer) |
|---|---|
| سطح دسترسی | کاربر رایگان · کاربر حرفهای Customer token (Bearer) — free and paid users |
| محدودیت نرخ | 10/1min |
Sends an SMS code (code guard verify) to add or change the account mobile.
بدنه درخواست
نمونهjson
{
"phone": "{{userPhone}}"
}
پاسخها
200 — VerifyCodeResponse
| فیلد | نوع |
|---|---|
sent* | boolean |
expires_in* | integer |
resend_in* | integer |
dev_code* | string |
json
{
"sent": true,
"expires_in": 600,
"resend_in": 45,
"dev_code": "318204"
}
401 — Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): {"message":"…","code":"unauthenticated"} (message in the request language)
| فیلد | نوع |
|---|---|
message* | string |
code | string |
json
{
"message": "Please sign in to continue; your session has ended or is not valid.",
"code": "unauthenticated"
}
422 — Validation failed (phone invalid / «این شماره به حساب دیگری وصل است»)
| فیلد | نوع |
|---|---|
message* | string |
errors* | object |
json
{
"message": "",
"errors": {
"email": [
"ایمیل معتبر نیست."
]
}
}
429 — Resend cooldown (45 s), or route throttle 10 req/min
| فیلد | نوع | توضیح |
|---|---|---|
message* | string | |
resend_in | integer | Seconds until a new login code may be requested (login-code cooldown only). |
json
{
"message": "Too Many Attempts.",
"resend_in": 0
}
503 — IPPanel rejected the send
| فیلد | نوع |
|---|---|
message* | string |
json
{
"message": ""
}
نمونهٔ curl
bash
curl -X POST 'http://127.0.0.1:8010/api/settings/phone/request-code' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $RAWI_USER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"phone": "{{userPhone}}"
}'