Rawi

API reference · Auth & profile

Request login code

post/auth/request-code
AuthenticationNone (public)
AccessGuest · Free user · Pro user · Consultant · Super admin

Public — no token

Rate limit30/1min

Sends the 6-digit login code. With email: by email. With phone (and no email): by SMS (otp type) or, with channel: "voice", by a voice call. Remembers locale and ref for the verify step (30 min). Fires signup_started for new accounts.

Request body

FieldTypeDescription
email*string<email>valid email, max 190; normalized to lower case
localestring | null ("fa", "en", null)fa | en (panel language for a new account; default = Accept-Language)
refstring | nullreferral code of the inviter (S6 link ?ref=), max 32
Examplejson
{
  "email": "{{userEmail}}",
  "locale": "{{lang}}",
  "ref": null
}

Responses

200 — RequestCodeResponse Phone response: {"sent":true,"expires_in":600,"resend_in":45,"existing_account":true,"channel":"sms","phone":"+989120000077","voice_available":false,"dev_code":"495814"}. dev_code is present only when RAWI_DEV_EXPOSE_OTP=true and the app is not in production.

json
{
  "sent": true,
  "expires_in": 600,
  "resend_in": 45,
  "existing_account": true,
  "channel": "email",
  "dev_code": "901976"
}

422 — email invalid; phone invalid number or phone login switched off; channel voice not available («دریافت کد با تماس صوتی فعلاً ممکن نیست.»)

FieldType
message*string
errors*object
json
{
  "message": "",
  "errors": {
    "email": [
      "ایمیل معتبر نیست."
    ]
  }
}

429 — Resend cooldown (45 s) or more than 5 codes/min for this address: {"message":"…","resend_in":32}; or route throttle 30 req/min/IP (Too Many Attempts.)

FieldTypeDescription
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 SMS/voice send: errors.phone «فرستادن پیامک ممکن نشد…»; the code is retired so the user can ask again at once

FieldType
message*string
json
{
  "message": ""
}

curl example

bash
curl -X POST 'http://127.0.0.1:8010/api/auth/request-code' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "{{userEmail}}",
  "locale": "{{lang}}",
  "ref": null
}'

Try it in the console