---
title: "Current-period usage against the plan allowance"
method: GET
path: "/v1/usage/summary"
tags: ["Usage"]
---

# Current-period usage against the plan allowance

`GET /v1/usage/summary`

## Request

- Base URL: `https://api.spicrawl.com`
- URL: `https://api.spicrawl.com/v1/usage/summary`
- Auth: HTTP bearer

Usage for the current period, with credit allowance arithmetic in micro-credits (1 credit =
1000000), plus the monthly allowance the API enforces. Takes no parameters.

Every organization has a monthly credit allowance (1,000 credits unless an operator set a
different limit for the organization), counted per allowance month: from 00:00 UTC on the day of
the month the organization was created to the same day of the next month. When it is used up,
requests are refused with 402 `ERR::LIMIT::QUOTA_EXCEEDED` until `allowance.resets_at`.

- `allowance` is the number the API enforces, and the one to show as "credits left":
  `allowance.remaining_micro`. Its `used_micro` is the enforcement counter, which includes
  credits currently HELD for in-flight work (an open browser session holds its whole
  `session_ttl` price, a batch job holds the price of its unfinished items) as well as credits
  spent. It is omitted when the deployment has no allowance counter, or when the counter could
  not be read (a warning then says so).
- `credits` is METERED usage from the usage rollup for the period: spent credits only, batch
  items included, but not credits held for work still running. It can therefore be lower than
  `allowance.used_micro`.
- With no subscription (the usual case), the organization is on the free plan: `plan` names the
  current `free` plan, `plan.subscription_status` is `none`, `plan.period_source` is
  `allowance_month`, and `credits.included_micro` is the enforced monthly limit. The period is
  the allowance month, not a billing period.
- With a subscription, `period_source` is `subscription`, the period is the billing period and
  `credits.included_micro` is the plan's included credits. The enforced limit is still
  `allowance.limit_micro`.

Pitfalls:
- There is no money figure. Overage pricing is computed only at invoicing.
- `unattributed` usually equals `metrics` today because per-engine attribution is not populated.

## Response `200`

The summary.

- UsageSummary
  - `period` UsagePeriod, required: Half-open range of UTC days.
    - `start` string, date, required: First day, inclusive.
    - `end` string, date, required: End day, EXCLUSIVE. The last included day is the day before this.
    - `days` integer, required: Number of days in the period.
    - `bounds` '[start, end)', required: Always `[start, end)`, a reminder that `end` is exclusive.
  - `period_elapsed_days` integer, required: Whole days of the period elapsed, clamped to [0, period.days]. Use it to pace consumption.
  - `plan` UsagePlan, required
    - `code` string, required: Plan code. With no subscription, the organization is on the free plan and this is `free`.
    - `name` string, required: Plan display name. `Free` (the current free plan's name) when no subscription.
    - `version` integer, required: Plan version. With no subscription, the current free plan's version (0 if the deployment has no free plan row).
    - `subscription_status` string, required: Subscription status, e.g. `active`, `trialing`. `none` when no subscription covers now.
    - `period_source` 'subscription' | 'allowance_month', required: `subscription`: the period is the billing period. `allowance_month`: no subscription covers now, so the organization is on the free plan's monthly allowance, and the period is its allowance month: from 00:00 UTC on the day of the month the organization was created to the same day of the next month. That is the window the allowance is enforced over, not a billing period.
  - `credits` UsageCredits, required: Allowance arithmetic over METERED usage, in micro-credits (1 credit = 1000000). No money amounts. Metered usage is credits spent, batch items included, and excludes credits held for in-flight work; the number the API enforces is `allowance` on the summary.
    - `included_micro` integer, required: Credits included in the plan for the period. With no subscription, the enforced monthly limit (the same as `allowance.limit_micro`).
    - `used_micro` integer, required: Credits spent so far in the period, from the usage rollup (`metrics.credits`). Includes batch spend.
    - `remaining_micro` integer, required: Included minus used, floored at 0.
    - `overage_micro` integer, required: Used beyond the allowance, floored at 0. Billed at invoicing. Always 0 with no subscription, where requests past the limit are refused instead.
    - `overage_micro_cents_per_credit` integer, required: Overage price per credit in micro-cents, from the plan.
    - `used_basis_points` integer, nullable, required: Used divided by included, in basis points (10000 = 100%). Can exceed 10000. Null when the plan includes no credits.
  - `allowance` UsageAllowance: The monthly credit allowance as the API ENFORCES it, for the current allowance month. This is the number that decides whether the next request is refused with 402 `ERR::LIMIT::QUOTA_EXCEEDED`, and the one to show as "credits left". Present for every organization, subscribed or not; omitted only when the deployment has no allowance counter or it could not be read (a warning then says so).
    - `limit_micro` integer, required: The enforced monthly limit in micro-credits. 0 means no limit (`unlimited`).
    - `limit_credits` integer, required: `limit_micro` in whole credits, rounded down.
    - `limit_source` 'default' | 'override', required: `default`: the deployment's monthly allowance, which every organization gets. `override`: a limit an operator set for this organization.
    - `unlimited` boolean, required: True when no limit is enforced (`limit_micro` is 0).
    - `used_micro` integer, required: Micro-credits counted against the limit this allowance month. It includes credits currently HELD for in-flight work (an open browser session holds its whole `session_ttl` price until it closes; a batch job holds the price of its unfinished items) as well as credits spent, and cannot be split into the two. So it can exceed `credits.used_micro`.
    - `remaining_micro` integer, required: `limit_micro` minus `used_micro`, never negative. 0 when `unlimited`.
    - `window_start` string, date-time, required: Start of the allowance month, 00:00 UTC on the day of the month the organization was created.
    - `resets_at` string, date-time, required: When the allowance is next restored in full; the end of the allowance month.
  - `metrics` UsageMetricMap, required: Metric name to quantity. Keys are UsageMetric values.
  - `unattributed` UsageMetricMap, required: Metric name to quantity. Keys are UsageMetric values.
  - `usage_as_of` string, date-time, nullable, required: Newest rollup row in the period, or null when none.
  - `stale_seconds` integer, nullable, required: Age of `usage_as_of` in seconds; null when no rows.
  - `warnings` string[]: Caveats, e.g. that the allowance counter could not be read. Omitted when empty.

## Other responses

- `401`: Missing, invalid, revoked or expired key. Not retryable with the same key.
- `403`: The key lacks the scope this route requires (`ERR::AUTH::INSUFFICIENT_SCOPE`), or the action is not permitted.
- `500`: Internal error. Retryable when `retryable` is true.

---

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