API reference · Analytics events
Track client event
post
/events| Authentication | Customer token (Bearer) |
|---|---|
| Access | Free user · Pro user Customer token (Bearer) — free and paid users |
| Rate limit | 60/1min |
Stores a client-side analytics event. The frontend sends report_viewed (props.page = overview|gaps|citations|questions|trend) and upgrade_page_opened (props.from). The first report_viewed also records first_report_viewed.
Request body
| Field | Type | Description |
|---|---|---|
name* | string ("report_viewed", "upgrade_page_opened") | |
props | array | null | free JSON object |
Examplejson
{
"name": "report_viewed",
"props": {
"page": "overview"
}
}
Responses
204 — No content
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"
}
422 — Validation failed (name)
| Field | Type |
|---|---|
message* | string |
errors* | object |
json
{
"message": "",
"errors": {
"email": [
"ایمیل معتبر نیست."
]
}
}
429 — Rate limit or login-code resend cooldown. Headers: Retry-After, X-RateLimit-*.
| 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/events' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $RAWI_USER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"name": "report_viewed",
"props": {
"page": "overview"
}
}'