مرجع API · Settings
Request email verification code
post
/settings/email/request-code| احراز هویت | توکن مشتری (Bearer) |
|---|---|
| سطح دسترسی | کاربر رایگان · کاربر حرفهای Customer token (Bearer) — free and paid users |
| محدودیت نرخ | 10/1min |
Phone-only accounts add an email: sends a code to the new address.
بدنه درخواست
نمونهjson
{
"email": "erfan@avand.example"
}
پاسخها
200 — VerifyCodeResponse
| فیلد | نوع |
|---|---|
sent* | boolean |
expires_in* | integer |
resend_in* | integer |
dev_code* | string |
json
{
"sent": false,
"expires_in": 600,
"resend_in": 0,
"dev_code": ""
}
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 (email invalid / taken)
| فیلد | نوع |
|---|---|
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
}
نمونهٔ curl
bash
curl -X POST 'http://127.0.0.1:8010/api/settings/email/request-code' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $RAWI_USER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"email": "erfan@avand.example"
}'