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

# Get Account Balances

> This endpoint retrieves the account balances.



## OpenAPI

````yaml GET /api/v1/balances
openapi: 3.1.0
info:
  title: User Account API
  version: 1.0.0
servers:
  - url: https://user-account.sandbox.rails.xyz
security: []
paths:
  /api/v1/balances:
    get:
      summary: Retrieve account balances
      operationId: getAccountBalances
      parameters:
        - $ref: '#/components/parameters/market'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/balancesResponse'
              example:
                balances:
                  totalBalance: '99996952.15429778'
                  crossMarginBalance: '99234631.40719179'
                  availableBalance: '99521353.92161779'
                  withdrawableBalance: '92673870.38'
                  deposit: '100000000'
                  withdraw: '879.12'
                  withdrawFees: '8.88'
                  fees: '608.02030021'
                  pnl: '-1292.78457349'
                  funding: '-259.04082851'
                  volume: '608020.300274'
                  margin: '7261788.9945241110003337'
                  maintenanceMargin: '475598.23267999'
                  leverage: '5'
                  accountLeverage: '0.081046795550007'
                  promoCredit: '0'
                  transferIn: '0'
                  transferOut: '0'
                  marketBalancesMap:
                    BTC-USDT:
                      position: '467782.520726'
                      positionQuantity: '7'
                      liquidationPrice: '126380.268279734335477455'
                      openBuy: '60000'
                      openBuyQty: '1'
                      openSell: '0'
                      openSellQty: '0'
                      pnl: '-1292.78457349'
                      positionPnl: '-1292.7845734999864'
                      funding: '113.21723468000002'
                      positionFunding: '113.21723468000002'
                      volume: '600695.07832'
                      fees: '600.69507826'
                      liquidationFees: '0'
                      margin: '6498468.2474181248786156'
                      maintenanceMargin: '527842.520726'
                      indexPrice: '66826.074'
                      unrealizedPnl: '-456.32'
                      leverage: '2'
                      marginMode: C
                    ETH-USDT:
                      position: '28894.648055999998'
                      positionQuantity: '8'
                      liquidationPrice: '28902.648056'
                      openBuy: '0'
                      openBuyQty: '0'
                      openSell: '8000'
                      openSellQty: '3'
                      pnl: '406.23975999'
                      positionPnl: '406.2397599999995'
                      funding: '-486.82005787000037'
                      positionFunding: '-486.82005787000037'
                      volume: '43545.091964'
                      fees: '43.54509196'
                      liquidationFees: '0'
                      margin: '762320.7471059860003337'
                      maintenanceMargin: '28902.648056'
                      indexPrice: '3611.831'
                      unrealizedPnl: '189.54'
                      leverage: '5'
                      marginMode: I
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - bearerAuth: []
components:
  parameters:
    market:
      name: market
      in: query
      description: >-
        Market name. Example value: `ETH-USDT`. To get all supported markets,
        call [/api/v1/markets](/latest/perps/rest-api/get-supported-markets)
        endpoint. Omit this parameter to get results across all markets.
      required: false
      schema:
        type: string
  schemas:
    balancesResponse:
      type: object
      properties:
        balances:
          type: object
          description: Account balances and related financial information.
          properties:
            totalBalance:
              type: string
              description: Total balance for the account.
            crossMarginBalance:
              type: string
              description: >-
                Total balance available as collateral for cross margin
                positions.
            availableBalance:
              type: string
              description: Available balance for trading or withdrawal.
            withdrawableBalance:
              type: string
              description: Maximum balance available for withdrawal.
            deposit:
              type: string
              description: Total amount deposited.
            withdraw:
              type: string
              description: Total amount withdrawn.
            withdrawFees:
              type: string
              description: Total withdrawal fees charged.
            fees:
              type: string
              description: Total trading fees paid.
            pnl:
              type: string
              description: All-time realized PnL for the account.
            funding:
              type: string
              description: All-time funding fees for the account.
            volume:
              type: string
              description: Total trading volume for the account.
            margin:
              type: string
              description: Current margin used for the account.
            maintenanceMargin:
              type: string
              description: Current maintenance margin for the account.
            leverage:
              type: string
              description: Current leverage setting for the account.
            accountLeverage:
              type: string
              description: Real-time leverage used by the account.
            promoCredit:
              type: string
              description: Promotional credit available in the account.
            transferIn:
              type: string
              description: Total amount transferred into the account.
            transferOut:
              type: string
              description: Total amount transferred out of the account.
            marketBalancesMap:
              type: object
              description: >-
                A map of market names (e.g., `BTC-USDT` and `ETH-USDT`) to
                market balance details. The key is the market name, and the
                value is an object containing market-specific balance details.
              properties:
                '[market-name]':
                  $ref: '#/components/schemas/marketBalance'
          required:
            - totalBalance
            - crossMarginBalance
            - availableBalance
            - withdrawableBalance
            - deposit
            - withdraw
            - withdrawFees
            - fees
            - pnl
            - funding
            - volume
            - margin
            - maintenanceMargin
            - leverage
            - accountLeverage
            - promoCredit
            - transferIn
            - transferOut
            - marketBalancesMap
      required:
        - balances
    marketBalance:
      type: object
      description: Market-specific balance details for an account.
      properties:
        position:
          type: string
          description: Value of the current position.
        positionQuantity:
          type: string
          description: Quantity of the current position.
        liquidationPrice:
          type: string
          description: Liquidation price for the current position.
        openBuy:
          type: string
          description: Total open buy order value.
        openBuyQty:
          type: string
          description: Total open buy order quantity.
        openSell:
          type: string
          description: Total open sell order value.
        openSellQty:
          type: string
          description: Total open sell order quantity.
        pnl:
          type: string
          description: All-time realized PnL for the market.
        positionPnl:
          type: string
          description: Realized PnL for the current position.
        funding:
          type: string
          description: >-
            All-time funding fee for the market. It can be positive or negative,
            depending on whether you are receiving or paying the funding fee.
        positionFunding:
          type: string
          description: >-
            Funding fee for the current position. It can be positive or
            negative, depending on whether you are receiving or paying the
            funding fee.
        volume:
          type: string
          description: Total trading volume for the market.
        fees:
          type: string
          description: Total trading fees paid for the market.
        liquidationFees:
          type: string
          description: Total liquidation fees paid for the market.
        margin:
          type: string
          description: Current margin used for the market.
        maintenanceMargin:
          type: string
          description: Current maintenance margin for the market.
        indexPrice:
          type: string
          description: Current index price for the market.
        unrealizedPnl:
          type: string
          description: Unrealized PnL for the current position.
        leverage:
          type: string
          description: Current leverage setting for the market.
        marginMode:
          type: string
          enum:
            - C
            - I
          description: >-
            Margin mode for this market. `C` for cross margin, `I` for isolated
            margin.
      required:
        - position
        - positionQuantity
        - liquidationPrice
        - openBuy
        - openBuyQty
        - openSell
        - openSellQty
        - pnl
        - positionPnl
        - funding
        - positionFunding
        - volume
        - fees
        - liquidationFees
        - margin
        - maintenanceMargin
        - indexPrice
        - unrealizedPnl
        - leverage
        - marginMode
  responses:
    Unauthorized:
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: A human-readable message describing the error.
            required:
              - message
          example:
            message: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````