Rawi

API reference · Auth & profile

Verify code (get user token)

post/auth/verify
AuthenticationNone (public)
AccessGuest · Free user · Pro user · Consultant · Super admin

Public — no token

Rate limit30/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").

Request body

FieldTypeDescription
email*string<email>same email as request-code
code*string6 digits; Persian/Arabic digits accepted
localestring | null ("fa", "en", null)fa| en, overrides the value remembered from request-code
refstring | nullreferral code, overrides the remembered one
Examplejson
{
  "email": "{{userEmail}}",
  "code": "{{devCode}}"
}

Responses

200 — VerifyResponse

FieldTypeDescription
token*string
user*object
user.id*integerUnique ID.
user.email*string | nullEmail address.
user.phone*string | nullMobile 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*objectLimits of the account's plan.
user.limits.enginesstring[]AI assistants included.
user.limits.questionsinteger
user.limits.productsinteger
user.limits.customersinteger
user.limits.cellsinteger
user.limits.changes_per_monthinteger
user.limits.run_frequenciesstring[]
user.limits.discovered_limitinteger
user.limits.citations_fullboolean
user.limits.all_runsboolean
user.brand*object | null
user.brand.id*integerUnique ID.
user.brand.name*string | null
user.brand.domain*string | nullSite domain.
user.brand.initial*string
user.gaps_count*integer | null
user.last_run*object | null
user.last_run.id*integerUnique ID.
user.last_run.kind*string
user.last_run.status*stringCurrent status.
user.last_run.engines*any[]AI assistants included.
user.last_run.started_at*string | nullWhen it started (ISO 8601).
user.last_run.finished_at*string | nullWhen 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*booleanSidebar plan widget «On the Pro list»: «Notify me» pressed (C2 or /signup?notify=pro) and not answered yet.
user.run_issue*object | nullThe 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*stringHuman-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

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

429 — Route throttle 30 req/min/IP

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
}

curl example

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}}"
}'

Try it in the console