Rawi

مرجع API · Talk to an expert

Submit expert request

post/consultations
احراز هویتتوکن مشتری (Bearer)
سطح دسترسیکاربر رایگان · کاربر حرفه‌ای

Customer token (Bearer) — free and paid users

محدودیت نرخ10/1min

Creates the request (status new, due_at = two Iranian working days later: Saturday–Wednesday, Tehran time), snapshots the account, sends email and fires consultation_submitted. The user gets the consultation SMS only when phone is the account's verified phone. Every active or invited super admin and consultant gets the admin email; admins with a mobile and «هشدار پیامکی» on also get the admin_new_consultation SMS.

بدنه درخواست

نمونهjson
{
  "name": "نسرین کاظمی",
  "phone": "09123456789",
  "method": "phone",
  "time_slot": "morning",
  "note": "می‌خواهم بدانم چرا نیک‌حساب در پرسش‌های مقایسه همیشه اول است و ما نیستیم.",
  "source_page": "r2"
}

پاسخ‌ها

201 — ConsultationRequest

فیلدنوعتوضیح
id*integerUnique ID.
name*string
phone*stringMobile number.
method*string
time_slot*string
preferred_days*any[]
note*string | null
source_page*string | null
status*stringCurrent status.
due_at*string | null
snapshot*object
snapshot.brand*string | null
snapshot.plan*string | string ("free")Plan: free (Free) or paid (Pro).
snapshot.share*string | null
snapshot.gaps*string | nullMissed questions: AI named a competitor and not you.
snapshot.last_run_at*string | null
snapshot.source_page*string | null
created_at*string | nullWhen it was created (ISO 8601).
json
{
  "id": 23,
  "name": "نسرین کاظمی",
  "phone": "09123456789",
  "method": "phone",
  "time_slot": "morning",
  "note": "می‌خواهم بدانم چرا نیک‌حساب در پرسش‌های مقایسه همیشه اول است و ما نیستیم.",
  "source_page": "r2",
  "status": "new",
  "due_at": "2026-11-29T16:20:00Z",
  "snapshot": {
    "brand": "آوند",
    "plan": "free",
    "share": null,
    "gaps": null,
    "last_run_at": null,
    "source_page": "r2"
  },
  "created_at": "2026-11-24T16:20:00Z"
}

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
codestring
json
{
  "message": "Please sign in to continue; your session has ended or is not valid.",
  "code": "unauthenticated"
}

409 — The change needs confirmation (409).

فیلدنوع
messagestring
requires_confirmation*boolean
reasonstring
questions_countinteger
changesobject[]
changes[].fieldstring
changes[].fromany
changes[].toany
json
{
  "message": "",
  "requires_confirmation": true,
  "reason": "",
  "questions_count": 0,
  "changes": [
    {
      "field": "",
      "from": null,
      "to": null
    }
  ]
}

422 — Validation failed (phone format, method, time_slot)

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

429 — Throttle 10 req/min

فیلدنوعتوضیح
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

bash
curl -X POST 'http://127.0.0.1:8010/api/consultations' \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $RAWI_USER_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "نسرین کاظمی",
  "phone": "09123456789",
  "method": "phone",
  "time_slot": "morning",
  "note": "می‌خواهم بدانم چرا نیک‌حساب در پرسش‌های مقایسه همیشه اول است و ما نیستیم.",
  "source_page": "r2"
}'

امتحان در کنسول