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

# Check wallet access

> Whether the customer's prepaid credit in a currency or credit unit still covers them, net of
usage not invoiced yet. Denies only when the wallet blocks usage once its credit is used up;
otherwise access stays allowed and `exhausted` signals the empty balance on its own. With
`subscription_id`, only the credit that subscription can use counts: pass it when the
customer has several subscriptions, since one subscription's credit cannot pay another's
usage. The balance follows usage within a few seconds near zero or a threshold, within a
minute otherwise, and the answer is cached for one second: use it to gate consumption, not
to bill.



## OpenAPI

````yaml https://api.meteroid.com/api-docs/openapi.json get /api/v1/customers/{id_or_alias}/wallets/check
openapi: 3.1.0
info:
  title: meteroid
  description: ''
  license:
    name: LicenseRef-Proprietary
    identifier: LicenseRef-Proprietary
  version: 0.1.0
servers: []
security: []
tags:
  - name: Meteroid
    description: Meteroid API
  - name: Add-ons
  - name: Batch Jobs
  - name: Budgets
    description: >-
      Beta: may change before general availability. Spending limits on a
      customer's usage, or one subscription's, per currency, with alerts at
      percentages of the amount.
    x-beta: true
  - name: Checkout Sessions
  - name: Checks
    description: >-
      Beta: may change before general availability. Whether a customer may
      consume more of a feature right now.
    x-beta: true
  - name: Connect
    description: Manage connected accounts (Express & Standard)
  - name: Coupons
  - name: Credit Notes
  - name: Credit units
    description: >-
      Custom denominations, such as "credits", that usage can be priced in and
      credit granted or sold in, instead of money.
  - name: Credits
    description: >-
      Prepaid credit: a customer's wallets, credit grants, ledger and top-ups.
      Promotional credit applies before tax like a discount; paid credit applies
      after tax like a payment.
  - name: Custom Properties
  - name: Customers
  - name: Entitlements
  - name: Events
  - name: Features
  - name: Invoices
  - name: Licenses
    description: >-
      Licenses for your customers' self-hosted installations: signed tokens
      carrying their plan's entitlements, activated and refreshed by the
      installation over the public licensing endpoints.
  - name: Metrics
  - name: OAuth
    description: OAuth 2.0 token endpoints (public, client-credentials auth)
  - name: OAuth Apps
    description: Manage OAuth applications for Connect integrations
  - name: Plans
  - name: Product Families
  - name: Products
  - name: Subscriptions
  - name: Usage
  - name: Usage costs
    description: >-
      Beta: may change before general availability. A customer's or a
      subscription's usage events and usage over time, with what they cost.
    x-beta: true
  - name: Webhook Endpoints
    description: Manage outbound webhook endpoints and inspect their deliveries
paths:
  /api/v1/customers/{id_or_alias}/wallets/check:
    get:
      tags:
        - Credits
      summary: Check wallet access
      description: >-
        Whether the customer's prepaid credit in a currency or credit unit still
        covers them, net of

        usage not invoiced yet. Denies only when the wallet blocks usage once
        its credit is used up;

        otherwise access stays allowed and `exhausted` signals the empty balance
        on its own. With

        `subscription_id`, only the credit that subscription can use counts:
        pass it when the

        customer has several subscriptions, since one subscription's credit
        cannot pay another's

        usage. The balance follows usage within a few seconds near zero or a
        threshold, within a

        minute otherwise, and the answer is cached for one second: use it to
        gate consumption, not

        to bill.
      operationId: check_wallet
      parameters:
        - name: id_or_alias
          in: path
          description: Customer ID or alias
          required: true
          schema:
            type: string
        - name: currency
          in: query
          description: Defaults to the customer's currency.
          required: false
          schema:
            $ref: '#/components/schemas/Currency'
        - name: credit_unit
          in: query
          description: >-
            Checks the wallet of this credit unit (its code) instead of a
            currency.
          required: false
          schema:
            type: string
        - name: product_id
          in: query
          description: >-
            Checks only the credit that can pay for this product: credit not
            restricted to products,

            and credit restricted to it. Absent checks all credit.
          required: false
          schema:
            $ref: '#/components/schemas/ProductId'
        - name: subscription_id
          in: query
          description: >-
            Checks only the credit this subscription (`sub_…`) can spend, net of
            its own usage no

            credit pays: the credit that belongs to it and the customer's credit
            that belongs to no

            subscription, once every subscription's unbilled usage is paid.
            `has_access` is then the

            decision the access gate makes for that subscription's usage. Absent
            checks the

            customer's credit as a whole.
          required: false
          schema:
            $ref: '#/components/schemas/SubscriptionId'
      responses:
        '200':
          description: Whether the customer still has credit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletCheck'
        '400':
          description: Invalid request, or the subscription belongs to another customer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '404':
          description: Customer or subscription not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    Currency:
      type: string
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLP
        - CNH
        - CNY
        - COP
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - IRR
        - ISK
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KPW
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SDG
        - SEK
        - SGD
        - SHP
        - SLL
        - SOS
        - SRD
        - SSP
        - STD
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
        - ZWL
      examples:
        - EUR
    ProductId:
      type: string
      format: MeteroidId
      examples:
        - prd_7n42DGM5Tflk9n8mt7Fhc7
    SubscriptionId:
      type: string
      format: MeteroidId
      examples:
        - sub_7n42DGM5Tflk9n8mt7Fhc7
    WalletCheck:
      type: object
      description: >-
        Whether a customer may keep consuming what their prepaid credit pays
        for.
      required:
        - has_access
        - balance
        - exhausted
        - pauses_at_zero
        - as_of
        - lag_ms
        - exact
      properties:
        as_of:
          type: string
          format: date-time
          description: When `balance` was computed.
        balance:
          type: integer
          format: int64
          description: >-
            The balance: credit on account net of the usage not invoiced yet
            that it will pay, in

            minor units of `currency` or `credit_unit`; never negative for the
            customer as a whole,

            as `balance` of `GET /wallets`. With `product_id`, only the credit
            that can pay for that

            product, net of its usage no credit covers. With `subscription_id`,
            only the credit that

            subscription can spend (credit restricted to products it is not
            charged for left out),

            net of its usage no credit covers; credit that belongs to no
            subscription counts in every

            subscription's balance (see `shared_balance`).
        credit_unit:
          type:
            - string
            - 'null'
          description: The credit unit (its code) checked; absent for a currency.
        credit_unit_precision:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Decimal places of `credit_unit`: `balance` is in integers of
            10^-precision credit.
          minimum: 0
        currency:
          oneOf:
            - $ref: '#/components/schemas/Currency'
              description: Absent when a credit unit was checked.
            - type: 'null'
        exact:
          type: boolean
          description: >-
            Always false: `balance` may lag usage by a few seconds (see
            `as_of`), and the answer is

            cached for one second.
        exhausted:
          type: boolean
          description: >-
            True once `balance` is at or below zero, or, with `subscription_id`,
            once no credit is

            left for some of its usage. Independent of `has_access`: a wallet
            that allows overage

            still reports this, so the caller can warn without refusing.
        has_access:
          type: boolean
          description: >-
            False only once `balance` is at or below zero and
            `blocks_when_exhausted` is true.

            Customers without a wallet in `currency` do not prepay, and always
            have access. With

            `subscription_id`: false when `blocks_when_exhausted` is true and no
            credit that

            subscription can spend is left for some of its usage (of
            `product_id` when given), as the

            access gate refuses it; a subscription charged no usage in the
            wallet keeps access.
        lag_ms:
          type: integer
          format: int64
          description: Age of `balance`, in milliseconds.
        pauses_at_zero:
          type: boolean
          description: >-
            Whether usage is refused as soon as the credit is used up: the
            wallet's `usage_at_zero`,

            else the plan of the subscription checked (of any active
            subscription without one). A plan

            that invoices usage up to a cap refuses it past the cap only, as
            `has_access` reports.
        shared_balance:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            With `subscription_id` only: the part of `balance` that belongs to
            no subscription, which

            the customer's other subscriptions can spend too.
    RestErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - NOT_FOUND
        - CONFLICT
        - FORBIDDEN
        - UNAUTHORIZED
        - TOKEN_EXPIRED
        - TOO_MANY_REQUESTS
        - INTERNAL_SERVER_ERROR
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````

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