Skip to main content
The wallet is your organization’s prepaid balance. It covers managed usage that goes beyond your monthly plan credit allowance, once overage is turned on. Your plan allowance is always spent first; the wallet only comes into play after it runs out. This page is the technical reference for the wallet: how the balance is stored, how to read it, how manual top-ups and auto top-up work, and how the paid-only overage toggle behaves. For where the wallet fits in the larger billing model, start with Billing & credits overview.
The wallet and overage are paid-plan features. On the Free plan there is no wallet spend — work stops when the allowance is exhausted. See Usage gating & limits for what happens at the gate.

How the wallet works

The wallet holds a balance in US dollars and converts to credits at the same fixed rate as your plan allowance: 100 credits = 1.00,soonecreditis1.00**, so **one credit is 0.01. A $10 top-up therefore adds 1,000 credits of spending power.
1

Turn on overage (paid only)

An owner or admin enables overage for the organization. Until overage is on, managed work stops once your plan allowance is empty — the wallet is not touched.
2

Fund the wallet

Add a prepaid balance with a manual top-up (1010–1000) through Stripe Checkout, or let auto top-up keep it funded for you.
3

Spend the wallet on overage

Once your plan allowance is exhausted, admitted managed work is paid for from the wallet. Spending is reconciled against the wallet automatically as runs settle.

Where the balance lives

The wallet is one row per organization. Its balance can go negative because overage is reconciled after work settles, so a single burst of usage can briefly push the balance below zero.
number (USD)
The wallet balance in dollars, stored as a high-precision decimal. May be negative after overage reconciliation. A missing wallet reads as 0 — never as unlimited.
boolean
Whether overage spending is turned on for the organization. When false, the wallet is never spent, even if it holds a balance.
number (USD) | null
The balance at which auto top-up fires, in dollars. Default $5.00. null if not configured for the organization.
number (USD) | null
How much auto top-up adds per charge, in dollars. Default $20.00. null if not configured.
boolean
true when auto top-up has been turned off — including automatically, after too many failed charges (see Auto top-up).
Managing the wallet belongs to the organization, not to an individual. Reading and changing it is reserved for owners and admins; opening a top-up is owner-only. See Roles & permissions and Organizations, roles & membership.

Authentication and the wallet endpoints

The wallet is managed through the /subscriptions/wallet/* endpoints. These are organization-management endpoints used by the app’s billing settings, so they authenticate with your bearer token and require an organization context header:
  • Authorization: Bearer <token> — your bearer token.
  • X-Organization-ID: <org_uuid> — the organization whose wallet you are managing. Required; a missing or empty value is rejected.
The wallet endpoints are not part of the public SDK surface. Neither the JavaScript SDK nor the Python SDK exposes a wallet method — see the SDK ⇄ API parity matrix. The examples below show cURL only because there is no SDK equivalent to call. Day to day, the wallet is managed in the app’s billing settings rather than from code.
All examples use the base URL https://api.modulex.dev. See Base URLs & versioning for environments.

Read the wallet

Returns the balance, the overage toggle, and the auto top-up configuration. Lazily creates the wallet row the first time it is read, so a brand-new organization gets a zero-balance wallet with overage off. GET /subscriptions/wallet — owner or admin.
object
The wallet state.
Example 200 response

The overage toggle

Overage is the switch that decides whether the wallet is ever spent. When it is off, your organization can only spend its plan allowance; once that runs out, managed work is declined at the gate. When it is on, work that exceeds the allowance is paid for from the wallet. PATCH /subscriptions/wallet/extra-usage — owner or admin. Paid-only.
boolean
required
Whether to turn overage on (true) or off (false). The value is coerced to a boolean.
boolean
deprecated
Legacy alias for extra_usage_enabled, accepted for backward compatibility. Prefer extra_usage_enabled, which matches the field name in the GET response.
object
Example 200 response
Turning overage on requires an active paid subscription. If your organization is on the Free plan or has no active subscription, the request is declined:
402 Payment Required
This 402 is a plain HTTPException shape — {"detail": {"reason": "paid_subscription_required"}}not the flat DenialEnvelope shape that the usage gate returns. The two billing 402 contracts are different, and a client that handles billing errors must branch on both. The gate’s wallet denials (wallet_overage_disabled, wallet_insufficient) use the DenialEnvelope shape covered in Usage gating & limits and Errors & status codes. Turning overage off is always allowed, on any plan.

Turning overage on sets a baseline

When you switch overage from off to on, ModuleX takes a snapshot of how many credits the current billing period has already used and records it as the overage baseline. From that point forward, the wallet only pays for overage incurred after you turned it on — it never retroactively bills for plan-allowance overflow that built up while overage was off. The reconciler bills wallet overage against a floor of max(plan allowance, overage baseline), so flipping the toggle on does not produce a surprise charge for past usage. The baseline is re-snapshotted on every off-to-on transition, scoped to the current subscription and billing period.

Manual top-ups

A manual top-up opens a one-time Stripe Checkout to add a prepaid balance to the wallet. The amount is yours to choose within a fixed range, and the credit is applied to the wallet only after the payment succeeds. POST /subscriptions/wallet/topupowner-only. Paid-only.
number
required
The dollar amount to add to the wallet. Must be at least 10andatmost10 and at most 1,000, finite, and have no sub-cent precision (no fraction smaller than a whole cent). The credited amount equals the amount paid; at 0.01percredit,amountusd×100creditsareaddedforexample,0.01 per credit, `amount_usd` × 100 credits are added — for example, 10 adds 1,000 credits.
object
The Checkout link to open. Opening it does not yet credit the wallet — see the note below.
Example 200 response
The top-up call returns a Checkout link — it does not credit the wallet. The balance is increased exactly once, after Stripe confirms the payment, through the payment_intent.succeeded webhook. That step is idempotent on the payment, so a duplicate or replayed event never double-credits. For the webhook contract, see Subscriptions & Stripe.

Top-up amounts at a glance

Top-up errors

The amount is validated on the server before any Stripe or database work, so an invalid request never opens a Checkout.
object
Returned for an invalid amount or a misconfigured organization.
object
The organization is on Free or has no active paid subscription: {"detail": {"reason": "paid_subscription_required"}}.
object
The organization could not be found: {"detail": "Organization not found"}.
object
Stripe is not configured on the server (no API key): {"detail": "Stripe API key is not configured"}.
object
Stripe rejected the Checkout creation: {"detail": "Stripe error: …"}.
These 400 / 402 / 404 / 500 / 502 responses use the plain {"detail": …} shape (or {"detail": {"reason": …}} for the paid gate), because /subscriptions/wallet/topup is an organization-management route rather than a metered-run surface. It does not return the gate’s DenialEnvelope. See Errors & status codes for the full envelope taxonomy.

Auto top-up

Auto top-up keeps the wallet funded without manual action. When enabled, ModuleX charges the configured amount whenever the balance falls to the threshold, so overage usage is not interrupted. When an auto top-up charge succeeds, the credit lands through the same payment_intent.succeeded path as a manual top-up, and the consecutive-failure counter and the auto_topup_disabled flag are reset.
Auto top-up settings appear in the wallet response (auto_topup_threshold, auto_topup_amount, auto_topup_disabled), and the defaults above are fixed in ModuleX’s billing configuration. The exact API for changing the threshold and amount, and for re-enabling auto top-up after it has been disabled, is managed in the app’s billing settings; a dedicated public endpoint for editing these values is not part of the documented wallet API at this time.

Refunds

A refund issued through Stripe is mirrored back to the wallet as a negative ledger entry, decreasing the balance by the refunded amount. The mirror is idempotent on the Stripe charge, so a replayed refund event is applied only once. A refund never changes your subscription status or plan entitlements — it only adjusts the wallet balance.

Edge cases and behavior to know

Overage is reconciled after managed work settles, so a burst of usage can push the wallet below zero before the next top-up. A negative balance is expected and self-corrects on your next top-up or auto top-up. Reading a wallet that has never existed returns 0, never an unlimited balance.
If extra_usage_enabled is false, the wallet is never spent — even if it holds a positive balance. Once your plan allowance is gone, managed work is declined at the gate until you turn overage back on. The balance is preserved.
The wallet only covers usage beyond your monthly plan allowance. Within the allowance, no wallet spend occurs. See Credits & metering for what consumes the allowance.
When overage is off or the wallet cannot cover a piece of work, the usage gate declines it with a flat DenialEnvelope 402 (wallet_overage_disabled or wallet_insufficient) — not the {"detail": {"reason": "paid_subscription_required"}} shape returned by the wallet management endpoints. See Usage gating & limits.

Credits & metering

What a credit is and exactly what consumes credits and the wallet.

Usage gating & limits

The gate that decides whether the wallet is spent, and its 402/403/429 responses.

Plans & pricing

Which plans include overage and the wallet, and what each allowance is.

Subscriptions & Stripe

The Stripe webhook contract that applies top-ups and refunds to the wallet.

Errors & status codes

Every billing error shape, including both 402 contracts.

Billing & credits overview

How plans, credits, the wallet, and the gate fit together.