Usage API

Reference for the management API's endpoints that return an organization's usage for the month and a database's activity over time.

These endpoints return metered usage. See usage for what is metered and how it is collected, and the management API overview for authentication and errors.

MethodPathDoes
GET/v1/usageReturns the organization's usage for the current month
GET/v1/databases/{databaseId}/activityReturns one database's usage over a window

Usage is collected from the databases' clusters, so it trails what happened. It is not a bill. The clusters do not report these meters yet, so their figures are zero for now: the figures in the examples below show the shape of an answer. See usage.

Get the organization's usage

GET /v1/usage

Returns the usage of the key's organization for the current calendar month, in UTC, against its plan.

It needs a key for the whole organization, of either role. A key scoped to one database is answered 403, because the figures cover the organization's other databases too.

curl "$MIMIC_MANAGEMENT_API/v1/usage" \
  -H "Authorization: Bearer $MIMIC_API_KEY"
{
  "plan": {
    "id": "<plan-id>",
    "label": "<plan name>",
    "maxDatabases": null,
    "maxBranches": null,
    "isHardCapped": false
  },
  "periodStart": "2026-01-01T00:00:00.000Z",
  "periodEnd": "2026-02-01T00:00:00.000Z",
  "meters": [
    {
      "id": "commits",
      "label": "Writes",
      "unit": "transactions",
      "aggregation": "sum",
      "quantity": 17,
      "included": null
    }
  ],
  "databases": [
    {
      "databaseId": "db_…",
      "name": "production",
      "quantities": { "commits": 17, "stored_bytes": 300, "session_seconds": 0 }
    }
  ]
}

The values are examples.

NameTypeDescription
plan *objectThe organization's plan. See below.
periodStart *stringThe start of the month, inclusive.
periodEnd *stringThe start of the next month: the end of the period, exclusive.
meters *object[]Each meter's total across the organization's databases.
databases *object[]Usage per database. Only databases with metered usage this month are listed.

plan

NameTypeDescription
id *stringThe plan's ID.
label *stringThe plan's name, for display.
maxDatabases *integer | nullHow many databases the organization may have. Null for no limit.
maxBranches *integer | nullHow many branches each database may have; branches do not count toward `maxDatabases`. Null for no limit.
isHardCapped *booleanWhether the plan is hard-capped.

The plan's price is not part of this API.

An entry of meters

NameTypeDescription
id *stringThe meter's ID. It is the key in every quantities object.
label *stringThe meter's name, for display.
unit *stringWhat quantity counts.
aggregation *"sum" | "max"sum for a counter, whose readings add up; max for a gauge, whose highest reading counts.
quantity *numberThe month's total across databases.
included *number | nullWhat the plan includes per month. Null when it includes none of this meter.

For a sum meter, quantity is the sum over the month and across databases. For a max meter, it is each database's highest reading of the month, added up across databases.

An entry of databases

NameTypeDescription
databaseId *stringThe database's management ID.
name *stringThe database's name.
quantities *Record<string, number>The database's quantity for each meter, by meter ID.

Get a database's activity

GET /v1/databases/{databaseId}/activity?window=24h

Returns one database's usage over a window, in buckets. A key scoped to that database can call it.

NameTypeDescription
window *"24h" | "7d" | "30d"How far back to go. 24h returns 24 hourly buckets; 7d and 30d return one bucket per day. Required.

A missing or unknown window is answered 400.

curl "$MIMIC_MANAGEMENT_API/v1/databases/$DATABASE_ID/activity?window=7d" \
  -H "Authorization: Bearer $MIMIC_API_KEY"
{
  "window": "7d",
  "bucket": "day",
  "start": "2026-01-09T00:00:00.000Z",
  "end": "2026-01-16T00:00:00.000Z",
  "meters": [
    {
      "id": "commits",
      "label": "Writes",
      "unit": "transactions",
      "aggregation": "sum",
      "billingFeatureId": "<feature-id>"
    }
  ],
  "buckets": [
    { "start": "2026-01-09T00:00:00.000Z", "quantities": { "commits": 0 } },
    { "start": "2026-01-15T00:00:00.000Z", "quantities": { "commits": 12 } }
  ],
  "totals": { "commits": 12 },
  "latest": { "stored_bytes": { "quantity": 300, "at": "2026-01-15T10:00:00.000Z" } }
}

The response is shortened: it holds every bucket of the window and every meter. The values are examples.

NameTypeDescription
window *"24h" | "7d" | "30d"The window asked for.
bucket *"hour" | "day"The size of each bucket.
start *stringThe start of the first bucket, in UTC.
end *stringThe end of the last bucket, which is the one in progress.
meters *object[]The meters reported: id, label, unit, aggregation and billingFeatureId.
buckets *object[]One entry per bucket, oldest first, each with its start and its quantities by meter ID. Every bucket of the window is present, with zero where nothing was reported.
totals *Record<string, number>Per meter over the whole window: the sum for a counter, the highest reading for a gauge.
latest *Record<string, { quantity: number, at: string } | null>Each gauge's latest reading and the hour it was taken in, however old. Null when the database never reported it.

Within a bucket, a counter holds the sum of its readings and a gauge holds its highest reading. For a gauge, a bucket of 0 means nothing was reported in it, not that the database was empty: use latest for the current value.