> ## Documentation Index
> Fetch the complete documentation index at: https://docs.60db.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Memory Usage

> Monthly (or custom-period) spend breakdown for the workspace's memory operations

Return the wallet owner's spend on memory operations over a given period, broken down by operation type. Unbilled — calling this endpoint is always free and works even when the wallet is empty.

Use this endpoint to:

* Power a "Memory spend" widget in your own dashboard
* Alert on daily/monthly spend thresholds
* Reconcile refunds against original charges

## Request

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token with your API key
</ParamField>

### Query parameters

<ParamField query="period" type="string" default="current_month">
  Time window to aggregate over. One of:

  * `current_month` — from midnight on the 1st of the current month
  * `last_30_days` — rolling 30-day window ending now
  * `all_time` — all history (since the transaction log was created)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  `true` on success.
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="period" type="string">
      Echoes back the requested `period`.
    </ResponseField>

    <ResponseField name="workspace_id" type="integer">
      The workspace this usage belongs to.
    </ResponseField>

    <ResponseField name="billing_owner" type="object">
      The user whose wallet funds memory operations in this workspace.

      <Expandable title="properties">
        <ResponseField name="id" type="integer" />

        <ResponseField name="name" type="string" />

        <ResponseField name="current_balance_usd" type="number">
          Live wallet balance in USD (8-decimal precision).
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="object">
      Summed across all memory service types.

      <Expandable title="properties">
        <ResponseField name="net_spend_usd" type="number">
          Total spend after refunds (USD). Refunds subtract from the total.
        </ResponseField>

        <ResponseField name="operations" type="integer">
          Count of positive-amount operations (ingests + extracts + searches + contexts).
        </ResponseField>

        <ResponseField name="refunds" type="integer">
          Count of refund rows issued in this period.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="by_service" type="object">
      Per-service-type breakdown. Keys are `MEMORY_INGEST`, `MEMORY_EXTRACT`,
      `MEMORY_RECALL`, `MEMORY_CONTEXT`, and the corresponding `*_REFUND`
      entries when refunds have occurred.

      Each value contains:

      * `net_spend_usd` — after refunds
      * `gross_units` — total units used (chars for ingest, bytes for extract, queries for recall/context)
      * `operation_count` — positive operations only
      * `refund_count` — refunded operations only
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.60db.ai/memory/usage?period=current_month \
    -H "Authorization: Bearer your-api-key"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://api.60db.ai/memory/usage?period=current_month', {
    headers: { 'Authorization': 'Bearer your-api-key' },
  });
  const { data } = await res.json();
  ```

  ```python Python theme={null}
  import requests

  res = requests.get(
      'https://api.60db.ai/memory/usage',
      params={'period': 'current_month'},
      headers={'Authorization': 'Bearer your-api-key'},
  )
  data = res.json()['data']
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "period": "current_month",
      "workspace_id": 24,
      "billing_owner": {
        "id": 33,
        "name": "Kapil Karda",
        "current_balance_usd": 9.46304021
      },
      "total": {
        "net_spend_usd": 0.002779,
        "operations": 10,
        "refunds": 1
      },
      "by_service": {
        "MEMORY_EXTRACT": {
          "net_spend_usd": 0.00000169,
          "gross_units": 592,
          "operation_count": 2,
          "refund_count": 0
        },
        "MEMORY_EXTRACT_REFUND": {
          "net_spend_usd": -0.00000010,
          "gross_units": 0,
          "operation_count": 0,
          "refund_count": 1
        },
        "MEMORY_INGEST": {
          "net_spend_usd": 0.00007110,
          "gross_units": 711,
          "operation_count": 2,
          "refund_count": 0
        },
        "MEMORY_RECALL": {
          "net_spend_usd": 0.00270000,
          "gross_units": 9,
          "operation_count": 9,
          "refund_count": 0
        }
      }
    }
  }
  ```
</ResponseExample>

## Notes

* Refunds appear as separate service types (`MEMORY_EXTRACT_REFUND`, `MEMORY_INGEST_REFUND`, etc.) with negative `net_spend_usd`. This preserves an auditable distinction between "a charge that happened and was reversed" vs "no charge at all".
* The `billing_owner.current_balance_usd` reflects the live wallet — it is **not** period-scoped, it's always the current balance regardless of which `period` you requested.
* For a full operation-level audit trail (every single row in `transaction_log`), use the dashboard — this endpoint is an aggregated summary.

## Related

* [Pricing & Billing](/api-reference/memory/pricing) — rates, refund policy, header reference
* [Memory feature overview](/features/memory)
