Rawi

مرجع 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
codestring
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_inintegerSeconds 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}}"
}'

امتحان در کنسول