get_usage
Check what your own API key has spent, so you can decide mid-task whether to keep going. Reading it is free: it costs no quota. Optional from and to (YYYY-MM-DD UTC, inclusive, at most 92 days apart) bound the report; omitted, it covers the current month to date. Returns days (per-day, per-endpoint), totals per endpoint over the range, total_units, plus month_used_units against monthly_quota_units and the prepaid balance_millipence (thousandths of a penny). Everything is counted in UNITS — weighted quota units, where a heavier endpoint costs more than one unit per request — so never report these figures as a number of calls. When identity_pooled is true the quota is shared with the other keys belonging to the same owner, so these figures are not yours alone. The key that authenticates the call is the key reported on: there is no way to read another caller's usage. Needs the MapMap gateway (GATEWAY_URL + GATEWAY_API_KEY).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Last day to report, `YYYY-MM-DD` (UTC) inclusive. Defaults to today. | |
| from | No | First day to report, `YYYY-MM-DD` (UTC) inclusive. Defaults to the first day of the current month. At most 92 days may separate `from` and `to`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Last day covered, `YYYY-MM-DD` inclusive. | |
| days | Yes | Per-day breakdown over the range, oldest first. A day with no usage is absent rather than reported as zero. | |
| from | Yes | First day covered, `YYYY-MM-DD` inclusive. | |
| key_id | Yes | Identifier of the key this usage belongs to. | |
| totals | Yes | Units per endpoint over the whole range. | |
| total_units | Yes | Total units over the whole range. | |
| identity_pooled | Yes | Whether quota is pooled across every key belonging to the same identity. When true, these figures are the identity's shared consumption, so another key of the same owner also spends them. | |
| month_used_units | Yes | Units counted against the monthly quota right now: the very number the quota check enforces on, independent of `from`/`to`. Quota is monthly, so this — not `total_units` — is what to compare with `monthly_quota_units`. It includes units recorded but not yet written to the daily counters, so over a whole-month range it can exceed `total_units`; that is not a discrepancy. | |
| balance_millipence | Yes | Prepaid balance in millipence (thousandths of a penny), for usage beyond the monthly allowance. | |
| monthly_quota_units | Yes | The key's monthly allowance in units. |