API reference · Onboarding
Approve & start first scan
post
/onboarding/approve| Authentication | Customer token (Bearer) |
|---|---|
| Access | Free user · Pro user Customer token (Bearer) — free and paid users |
| Rate limit | 6/1min |
«تأیید و شروع»: finishes onboarding (step 9), records the approval of the current question set and starts a run only
when one is allowed (reason):
first— the brand never ran. A free account's first run still goes through the free queue: when others are waiting, the monthly first-run cap is full or the free spend cap (free_monthly_cap_usd) is reached, the user joins the queue (status: queued).setup— a paid account with no run since its latest successful payment (the post-payment setup, the app → the app/the app).changed— a paid (or test) account whose question set changed since the last run.
Otherwise the approval is saved and nothing starts (status: scheduled, next_run_at): free accounts keep the monthly
schedule, paid ones their weekly/monthly one. While a run of the brand is active (waiting/queued/running) the call
is refused with 409 run_active and nothing is saved. Throttle: 6 per minute (own counter).
Responses
200 — ApproveResponse
Queued variant: {"status":"queued","reason":"first","run":null,"queue":{"position":3,"eta_days":2,"boost_per_invite":10,"invite_max":5},"next_run_at":null}.
Scheduled variant (no manual run allowed now): {"status":"scheduled","reason":null,"run":null,"queue":null,"next_run_at":"2026-12-25T10:30:00Z"}.
The running variant also carries "reason":"first"|"setup"|"changed" and "next_run_at":null.
| Field | Type | Description |
|---|---|---|
status* | string ("running", "queued", "scheduled") | Current status. |
reason* | string | null ("changed", "setup", "first", null) | |
run* | object | null | |
run.id* | integer | Unique ID. |
run.kind* | string | |
run.status* | string | Current status. |
run.engines* | any[] | AI assistants included. |
run.started_at* | string | null | When it started (ISO 8601). |
run.finished_at* | string | null | When it finished (ISO 8601). |
run.done* | integer | |
run.total* | integer | |
queue* | array | null | |
next_run_at* | string | null |
json
{
"status": "running",
"run": {
"id": 57,
"kind": "first",
"status": "queued",
"engines": [
"chatgpt"
],
"started_at": "2026-11-25T09:45:02Z",
"finished_at": null,
"done": 0,
"total": 10
},
"queue": 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)
| Field | Type |
|---|---|
message* | string |
code | string |
json
{
"message": "Please sign in to continue; your session has ended or is not valid.",
"code": "unauthenticated"
}
409 — A run of the brand is in progress: {"message":"…","code":"run_active"}
| Field | Type |
|---|---|
message | string |
requires_confirmation* | boolean |
reason | string |
questions_count | integer |
changes | object[] |
changes[].field | string |
changes[].from | any |
changes[].to | any |
json
{
"message": "",
"requires_confirmation": true,
"reason": "",
"questions_count": 0,
"changes": [
{
"field": "",
"from": null,
"to": null
}
]
}
422 — Validation failed (questions — no active questions)
| Field | Type |
|---|---|
message* | string |
errors* | object |
json
{
"message": "",
"errors": {
"email": [
"ایمیل معتبر نیست."
]
}
}
429 — Throttle 6 req/min
| Field | Type | Description |
|---|---|---|
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 example
bash
curl -X POST 'http://127.0.0.1:8010/api/onboarding/approve' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $RAWI_USER_TOKEN"