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

# Get a balance

> Retrieves a single balance by ID



## OpenAPI

````yaml get /balances/{id}
openapi: 3.0.0
info:
  title: Customer API
  version: v1
servers:
  - url: https://sandbox-api.fedapay.com/v1
  - url: https://api.fedapay.com/v1
security: []
paths:
  /balances/{id}:
    get:
      summary: Get a balance
      description: Retrieves a single balance by ID
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: Balance ID
      responses:
        '200':
          description: List of balance
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Balance ID.
                    amount:
                      type: integer
                      description: Balance amount.
                    mode:
                      type: string
                      description: Balance mode
                    account_id:
                      type: integer
                      description: Account ID associated with the balance
                    created_at:
                      type: string
                      format: date-time
                      description: Date and time of balance creation.
                    updated_at:
                      type: string
                      format: date-time
                      description: Date and time of last balance update.
        '401':
          description: Unauthorized. Provide a valid secret key.
        '404':
          description: balance not found.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          label: NodeJs
          source: >-
            const { FedaPay, Balance } = require('fedapay');

            /* Replace YOUR_SECRETE_API_KEY with your real API key */

            FedaPay.setApiKey("YOUR_SECRETE_API_KEY");

            /* Specify whether you want to run your query in test or live mode
            */

            FedaPay.setEnvironment('sandbox'); //or setEnvironment('live');

            /* Show balance */

            const balance = await Balance.retrieve( ID, params = {}, headers =
            {} );
        - lang: PHP
          source: |-
            \FedaPay\Fedapay::setApiKey(MY_API_KEY);
            /**
            * @var \FedaPay\FedaPayObject
            */
            $response = \FedaPay\Balance::retrieve(ID);
            $balances = $response->balances;
            $meta = $response->meta;
        - lang: Ruby
          source: |-
            require 'fedapay';
            # configure FedaPay library
            FedaPay.api_key = '' # Your secret api key
            FedaPay.environment = '' # sandbox or live
            balances = FedaPay::Balance.retrieve(ID);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````