---
title: "Api Analytics Event"
method: POST
path: "/api/analytics/event"
tags: ["Analytics"]
---

# Api Analytics Event

`POST /api/analytics/event`

## Request

- Base URL: `https://www.oxfordledge.com` (the document declares no server; this is the origin it was published from)
- URL: `https://www.oxfordledge.com/api/analytics/event`
- Auth: none declared

Analytics event batch -- CSRF exempt (sendBeacon compatible).

`user` is server-resolved from the session by get_current_user (None for
anon). It is NOT a body field — #49 derives identity here, never from the
client beacon (CISO C1).

## Response `200`

Successful Response

- AnalyticsAckResponse: Wire shape for POST /api/analytics/event + /api/analytics/funnel. Both endpoints are sendBeacon-compatible (CSRF exempt, no auth) and return a fixed `{ok, recorded}` envelope after enqueuing events. The frontend treats `recorded` as informational only — no UI surface depends on the exact value.
  - `ok` boolean, required: True if the request body parsed; even when 0 events recorded.
  - `recorded` integer, required: Count of events successfully written to the analytics store.
  - `error` string, nullable: Set on the JSON-parse-failure branch (status 400). Absent on success.

---

[API](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api.md) · [All operations](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api/llms.txt) · [OpenAPI document](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api/revisions/e832a1260f0b?raw)
