Usage API
v1 (current)POST /api/v1/usage — report metered product usage.
Records a unit of metered usage against the organization the API key belongs to. This is the data source behind the Usage page in the portal — every row shown there came through this endpoint.
Request
Body
{
"productSlug": "lecturercraft",
"metric": "lecture_notes_generated",
"quantity": 5
}- productSlug — must match an existing product (uamsa, lecturercraft, scholarcraft, records, studyflow).
- metric — a short string identifying what was used, 1–60 characters. Not a fixed enum; each product defines its own metric names.
- quantity — a positive integer.
Responses
201 Created
{ "usageRecord": { "id": "cmrc5x6de0009ut5oanvs5o6u" } }- 401 — missing or invalid API key.
- 400 — the API key isn't associated with an organization, or the request body failed validation.
- 404 — productSlug doesn't match a known product.
This exact request/response shape was exercised end-to-end during development: a key was created, used to report usage, confirmed on the Usage page, then revoked and confirmed rejected on the next call.