مرجع API · Auth & profile
Verify code (get user token)
post
/auth/verify| احراز هویت | بدون احراز هویت (عمومی) |
|---|---|
| سطح دسترسی | مهمان · کاربر رایگان · کاربر حرفهای · مشاور · مدیر کل Public — no token |
| محدودیت نرخ | 30/1min |
Checks the code and returns a user token. Email: signs in or creates the user. Phone: signs in the user whose verified phone matches, or creates a phone-only user (email: null, signup_method: phone); a phone that is saved but not verified on an email account never signs in to that account (security rule). New users start on plan free, onboarding_step 2; ref records the referral. Fires signup_completed or login. new_account: true when this call created the account: after a new phone account, the app shows a one-time notice on the next screen ("sign in with email and verify this phone in Settings → Account & billing").
بدنه درخواست
| فیلد | نوع | توضیح |
|---|---|---|
email* | string<email> | same email as request-code |
code* | string | 6 digits; Persian/Arabic digits accepted |
locale | string | null ("fa", "en", null) | fa| en, overrides the value remembered from request-code |
ref | string | null | referral code, overrides the remembered one |
نمونهjson
{
"email": "{{userEmail}}",
"code": "{{devCode}}"
}
پاسخها
200 — VerifyResponse
| فیلد | نوع | توضیح |
|---|---|---|
token* | string | |
user* | object | |
user.id* | integer | Unique ID. |
user.email* | string | null | Email address. |
user.phone* | string | null | Mobile number. |
user.phone_verified* | boolean | |
user.sms_notifications* | boolean | |
user.name* | string | null | |
user.locale* | string ("en", "fa") | Language: fa or en. |
user.plan* | string ("paid", "free") | Plan: free (Free) or paid (Pro). |
user.billing_period* | string | null | |
user.plan_expires_at* | string | null | |
user.onboarding_step* | integer | |
user.onboarding_completed* | boolean | |
user.referral_code* | string | |
user.limits* | object | Limits of the account's plan. |
user.limits.engines | string[] | AI assistants included. |
user.limits.questions | integer | |
user.limits.products | integer | |
user.limits.customers | integer | |
user.limits.cells | integer | |
user.limits.changes_per_month | integer | |
user.limits.run_frequencies | string[] | |
user.limits.discovered_limit | integer | |
user.limits.citations_full | boolean | |
user.limits.all_runs | boolean | |
user.brand* | object | null | |
user.brand.id* | integer | Unique ID. |
user.brand.name* | string | null | |
user.brand.domain* | string | null | Site domain. |
user.brand.initial* | string | |
user.gaps_count* | integer | null | |
user.last_run* | object | null | |
user.last_run.id* | integer | Unique ID. |
user.last_run.kind* | string | |
user.last_run.status* | string | Current status. |
user.last_run.engines* | any[] | AI assistants included. |
user.last_run.started_at* | string | null | When it started (ISO 8601). |
user.last_run.finished_at* | string | null | When it finished (ISO 8601). |
user.last_run.done* | integer | |
user.last_run.total* | integer | |
user.next_run_at* | string | null | |
user.run_frequency* | string | null ("weekly", "monthly", null) | R1 plan widget: the schedule the user chose in S4 (the plan's allowed value, as RunService schedules it). |
user.queue* | array | null | |
user.notify_requested* | boolean | Sidebar plan widget «On the Pro list»: «Notify me» pressed (C2 or /signup?notify=pro) and not answered yet. |
user.run_issue* | object | null | The latest run failed: automatic retry state for the app shell banner (RunService::issue; null otherwise). |
user.run_issue.state* | string ("retrying", "stopped") | |
user.run_issue.attempts* | integer | |
user.run_issue.max_retries* | integer | |
user.run_issue.has_report* | boolean | |
user.run_issue.next_retry_at* | string | null | |
user.run_issue.next_run_at* | string | null | |
user.run_issue.message* | string | Human-readable message in the request language. |
new_account* | boolean |
json
{
"token": "15|0so4SUgNHqSvPb89wYfuxDEtvOlEOvFK5LSDrV8Kac3dfe31",
"user": {
"id": 1,
"email": "demo@rawi.local",
"phone": "+989120000077",
"phone_verified": true,
"sms_notifications": true,
"name": "عرفان",
"locale": "fa",
"plan": "free",
"billing_period": null,
"plan_expires_at": null,
"onboarding_step": 9,
"onboarding_completed": true,
"referral_code": "wth1ftkn",
"limits": {
"engines": [
"chatgpt"
],
"questions": 10,
"products": 1,
"customers": 1,
"cells": 1,
"changes_per_month": 2,
"run_frequencies": [
"monthly"
],
"discovered_limit": 10,
"citations_full": false,
"all_runs": false
},
"brand": {
"id": 40,
"name": "آوند",
"domain": "avand.example",
"initial": "آ"
},
"gaps_count": 2,
"last_run": {
"id": 38,
"kind": "scheduled",
"status": "complete",
"engines": [
"chatgpt"
],
"started_at": "2026-11-25T10:16:00Z",
"finished_at": "2026-11-25T10:30:00Z",
"done": 10,
"total": 10
},
"next_run_at": "2026-12-25T10:30:00Z",
"queue": null,
"run_frequency": "monthly"
},
"new_account": false
}
422 — Wrong, expired or used code, or more than 10 wrong tries per address+IP in 10 min: errors.code; errors.phone invalid number
| فیلد | نوع |
|---|---|
message* | string |
errors* | object |
json
{
"message": "",
"errors": {
"email": [
"ایمیل معتبر نیست."
]
}
}
429 — Route throttle 30 req/min/IP
| فیلد | نوع | توضیح |
|---|---|---|
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/auth/verify' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"email": "{{userEmail}}",
"code": "{{devCode}}"
}'