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

> ## Agent Instructions
> Maximem Synap is a managed memory layer for AI agents: it ingests conversations and documents, extracts structured memory, and returns scoped context to the agent at retrieval time.
> The Python and JavaScript/TypeScript SDKs are the supported way to use Synap. Write integration code with SDK calls, not raw HTTP requests.
> Start with the Quickstart: https://docs.maximem.ai/getting-started/quickstart.md. Every SDK method is documented in the SDK reference: https://docs.maximem.ai/sdk-reference/overview.md.
> For requests about adding Vity memory to OpenClaw, Hermes, an MCP client, or a browser, start with the Vity Quickstart: https://docs.maximem.ai/vity/quickstart.md.

# credits.get_ledger

> Paginate through the credit ledger for your wallet, with optional filtering by entry type and time range.

```python Python theme={null}
await sdk.credits.get_ledger(
    entry_type=None,
    from_time=None,
    to_time=None,
    limit=100,
    offset=0,
)
```

```typescript TypeScript theme={null}
await sdk.credits.get_ledger(options?: LedgerOptions)
```

Returns a paginated view of the credit ledger for the caller's wallet. Every credit movement (top-ups, redemptions, debits from usage, expirations) produces a ledger entry. The client-facing ledger does not expose USD amounts or internal rate detail.

Useful for building an in-product usage history view, reconciling charges, or auditing recent debits after a spike in usage.

### Parameters

**entry\_type** `string`

Filter to a single entry type. Common values include `"credit"` (additions to the wallet) and `"debit"` (deductions for usage). Omit to return all entry types.

**from\_time** `datetime`

Inclusive lower bound on `created_at`. Omit to start from the beginning of history.

**to\_time** `datetime`

Inclusive upper bound on `created_at`. Omit to read up to the present.

**limit** `int` (default: 100)

Maximum number of entries to return in this page.

**offset** `int` (default: 0)

Number of entries to skip. Combine with `limit` to walk the full ledger.

### Returns

`CreditLedgerPage` with one page of entries plus pagination metadata.

**entries** `List[CreditLedgerEntry]`

The ledger rows for this page. Each `CreditLedgerEntry` has:

* `ledger_id` (`string`): stable identifier for the row.
* `entry_type` (`string`): `"credit"`, `"debit"`, or similar.
* `delta` (`float`): signed credit change (positive for credits added, negative for usage).
* `metric_type` (`string | None`): the metered metric that produced the entry (e.g. `"llm_input_tokens"`), when applicable.
* `category` (`string | None`): coarse grouping for the entry (e.g. `"ingestion"`, `"retrieval"`), when applicable.
* `created_at` (`datetime`): when the entry was recorded.

**total** `int`

Total number of entries matching the filters (across all pages).

**limit** `int`

Echo of the `limit` used for this page.

**offset** `int`

Echo of the `offset` used for this page.

### Example

```python theme={null}
from datetime import datetime, timedelta, timezone

from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

# Show debits from the last 7 days
since = datetime.now(timezone.utc) - timedelta(days=7)

page = await sdk.credits.get_ledger(
    entry_type="debit",
    from_time=since,
    limit=50,
)

print(f"{page.total} debit entries in the last 7 days")
for entry in page.entries:
    print(
        f"  {entry.created_at.isoformat()}  "
        f"{entry.delta:+.2f}  "
        f"{entry.category or '-'}  ({entry.metric_type or '-'})"
    )
```

### Raises

* `AuthenticationError`: when the API key is missing or invalid.
* `InvalidInputError`: when Synap rejects `limit` or `offset` as out of range (HTTP 400 or 422).

### See also

* [credits.get\_balance](https://docs.maximem.ai/sdk-reference/credits/get-balance.md)
* [credits.estimate](https://docs.maximem.ai/sdk-reference/credits/estimate.md)
* [credits.redeem](https://docs.maximem.ai/sdk-reference/credits/redeem.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.