Retrieve weekly AI credit usage

View as Markdown
Weekly credits used by the two in-product AI assistants: the dashboard copilot (`ask_ai`) and the prompt generator (`prompt_gen`). One credit is 1,000 tokens (input plus output). Weeks run Monday 00:00 UTC to the next Monday. `weekStart` and `resetsAt` give the boundaries. Weekly budgets per plan: `ask_ai` 132 / 660 / 3,300 credits and `prompt_gen` 50 / 248 / 1,238 credits (Starter / Growth / Business). Enterprise is unlimited (`limit` and `remaining` are -1). With no subscription both are 0. When a budget runs out, the assistant itself answers 429 `AI_WEEKLY_CAP_REACHED` until `resetsAt`. These credits are separate from the AI replies your agents send to customers (see `GET /api/billing/usage`). **Consistency.** Never cached (`Cache-Control: no-store`); `used` is rounded up to whole credits. **Access** - **Required scope:** `read`. Available to every workspace role. - **Rate limit:** Billing — 15 requests/min per workspace, shared by every `/api/billing` route. See [Rate limits](/rate-limits). - **Plan:** Available on every plan.

Authentication

AuthorizationBearer
Workspace API key: `jl_` followed by 64 lowercase hex characters, created by the workspace owner in the dashboard (**Settings → API Keys**) and sent as `Authorization: Bearer jl_...`. The plaintext is shown once, at creation; Jelliu stores only a SHA-256 hash. A workspace can hold up to 25 active keys. | Scope | GET / HEAD | POST / PUT / PATCH / DELETE | Admin-only routes | | --- | --- | --- | --- | | `read` | Yes | No | No | | `write` | Yes | Yes | No | | `full` | Yes | Yes | Yes | Operations restricted to admins or owners reject keys without the `full` scope with `403`, and say so in their description. No key, whatever its scope, can mint or revoke API keys or rotate a webhook secret — that requires a signed-in owner session. A revoked key stops authenticating within about 10 seconds. See [Authentication](/authentication).

Response headers

Cache-ControlstringOptional

Always no-store.

Response

Weekly AI usage.
dataobject

Errors

401
Unauthorized Error
403
Forbidden Error
429
Too Many Requests Error