مرجع API · Settings
Verify phone
post
/settings/phone/verify| احراز هویت | توکن مشتری (Bearer) |
|---|---|
| سطح دسترسی | کاربر رایگان · کاربر حرفهای Customer token (Bearer) — free and paid users |
| محدودیت نرخ | 20/1min |
Checks the code and saves the phone as verified (fires phone_verified). A verified phone receives SMS notifications and can be used to sign in.
بدنه درخواست
| فیلد | نوع | توضیح |
|---|---|---|
code* | string | 6 digits |
reauth_token | string | from POST /settings/reauth/verify (SEC-12); other sessions are signed out after the change |
نمونهjson
{
"phone": "{{userPhone}}",
"code": "{{devCode}}",
"reauth_token": "{{reauthToken}}"
}
پاسخها
200 — AccountSettings
| فیلد | نوع | توضیح |
|---|---|---|
email* | string | null | Email address. |
phone* | string | null | Mobile number. |
sms_notifications* | boolean | |
email_notifications* | object | |
email_notifications.reminders* | boolean | |
email_notifications.report_ready* | boolean | |
email_notifications.renewal* | boolean | |
plan* | string ("paid", "free") | S5: reminders, report_ready, renewal |
billing_period* | string | null | |
plan_expires_at* | string | null | |
payments* | object[] | |
payments[].id* | integer | Unique ID. |
payments[].period* | string | |
payments[].status* | string | Current status. |
payments[].base_amount* | integer | |
payments[].period_discount* | integer | |
payments[].code_discount* | integer | |
payments[].vat* | integer | |
payments[].total* | integer | |
payments[].currency* | string | Currency code, e.g. USD, EUR or IRT. |
payments[].tracking_code* | string | null | |
payments[].gateway_message* | string | null | |
payments[].gateway_name* | string | null | |
payments[].period_start* | string | null | |
payments[].period_end* | string | null | |
payments[].paid_at* | string | null | |
payments[].created_at* | string | null | When it was created (ISO 8601). |
payments[].auto_renew* | boolean | |
payments[].renewal_amount* | integer | null | «Renew automatically» (Stripe subscription) |
payments[].amount_refunded* | integer | Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made. |
payments[].refunded_at* | string | null | |
renewal* | object | Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription). |
renewal.auto* | boolean | |
renewal.status* | string | null | Current status. |
renewal.can_cancel* | boolean | active | past_due | cancel_at_period_end | none |
renewal.can_resume* | boolean | |
renewal.renews_at* | string | null | |
renewal.ends_at* | string | null | |
brand_names* | any[] | «Delete account» accepts any of these (or the email) as the typed confirmation. |
json
{
"email": "",
"phone": "",
"sms_notifications": false,
"email_notifications": {
"reminders": false,
"report_ready": false,
"renewal": false
},
"plan": "paid",
"billing_period": "",
"plan_expires_at": "",
"payments": [
{
"id": 0,
"period": "",
"status": "",
"base_amount": 0,
"period_discount": 0,
"code_discount": 0,
"vat": 0,
"total": 0,
"currency": "",
"tracking_code": "",
"gateway_message": "",
"gateway_name": "",
"period_start": "",
"period_end": "",
"paid_at": "",
"created_at": "",
"auto_renew": false,
"renewal_amount": 0,
"amount_refunded": 0,
"refunded_at": ""
}
],
"renewal": {
"auto": false,
"status": "",
"can_cancel": false,
"can_resume": false,
"renews_at": "",
"ends_at": ""
},
"brand_names": [
null
]
}
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 (code wrong/expired, phone invalid/taken)
| فیلد | نوع |
|---|---|
message* | string |
errors* | object |
json
{
"message": "",
"errors": {
"email": [
"ایمیل معتبر نیست."
]
}
}
429 — Route throttle 20 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/phone/verify' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $RAWI_USER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"phone": "{{userPhone}}",
"code": "{{devCode}}",
"reauth_token": "{{reauthToken}}"
}'