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

# Get balance

> Get a wallet's account value, used margin and available balance on one perps provider.

This is a read that uses `POST` with a JSON body. Unlike positions and orders, it accepts exactly one provider: pass `providerId`, or a `providerIds` array with a single entry. Two different providers return `400`. Returns one object, not an array. All amounts are denominated in the `collateral` token. `unifiedAccountMode` is present only for providers that support it.


## OpenAPI

````yaml openapi-perps.json POST /v1/balances
openapi: 3.0.0
info:
  title: 'Yield API: Trade (Perps)'
  description: >-
    API Documentation. Errors follow a uniform envelope with `details.code` from
    the public catalog (https://docs.yield.xyz). ValidationPipe failures use
    `validation.message: string[]`.
  version: '1.0'
  contact: {}
servers:
  - url: https://perps.yield.xyz
    description: Production
security: []
tags:
  - name: Discovery
    description: Browse and discover perps markets, networks, and providers
  - name: Portfolio
    description: User-specific positions, orders, and balances
  - name: Actions
    description: Generate transactions to open, close, and manage positions
externalDocs:
  description: For more information
  url: https://docs.yield.xyz
paths:
  /v1/balances:
    post:
      tags:
        - Portfolio
        - Portfolio
      summary: Get account balance
      description: >-
        Retrieve account balance and margin for one provider. Use providerId or
        providerIds with exactly one provider (not multiple).
      operationId: PortfolioController_getBalances_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BalancesRequestDto'
      responses:
        '200':
          description: Account balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BalanceDto'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    example: 401
                  timestamp:
                    type: string
                    example: '2026-05-04T12:00:00.000Z'
                  path:
                    type: string
                    example: /v1/actions
                  message:
                    type: string
                    example: Invalid API key
                  details:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Invalid API key
                      code:
                        type: string
                        example: AUTH_INVALID_API_KEY
        '429':
          description: Rate limit exceeded
          headers:
            x-ratelimit-limit:
              description: Request limit per window
              schema:
                type: string
            x-ratelimit-remaining:
              description: Remaining requests (will be 0)
              schema:
                type: string
            x-ratelimit-reset:
              description: Unix timestamp when window resets
              schema:
                type: string
            retry-after:
              description: Seconds to wait before retrying
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    example: 429
                  timestamp:
                    type: string
                    example: '2026-05-04T12:00:00.000Z'
                  path:
                    type: string
                    example: /v1/actions
                  message:
                    type: string
                    example: Rate limit exceeded
                  details:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Rate limit exceeded
                      code:
                        type: string
                        example: RATE_LIMIT_EXCEEDED
                      error:
                        type: string
                        example: Too Many Requests
                      retryAfter:
                        type: number
                        example: 30
      security:
        - ApiKey: []
components:
  schemas:
    BalancesRequestDto:
      type: object
      properties:
        providerId:
          type: string
          description: >-
            Single provider identifier. At least one of providerId or
            providerIds must be provided.
          example: hyperliquid
          enum:
            - hyperliquid
            - hyperliquid-xyz
        providerIds:
          type: array
          description: >-
            Single provider only (one CSV value, one repeated param, or a
            one-element JSON array). At least one of providerId or providerIds
            must be provided. Must not combine with a different providerId.
          example:
            - hyperliquid
          items:
            type: string
            enum:
              - hyperliquid
              - hyperliquid-xyz
          maxItems: 1
        address:
          type: string
          description: User wallet address
          example: 0x1234...
      required:
        - address
    BalanceDto:
      type: object
      properties:
        providerId:
          type: string
          description: Provider ID
          example: hyperliquid
        collateral:
          description: Collateral token (all values denominated in this token)
          allOf:
            - $ref: '#/components/schemas/TokenDto'
        accountValue:
          type: number
          description: Total account value in collateral asset
          example: 1280.44
        usedMargin:
          type: number
          description: Margin used by positions in collateral asset
          example: 320.13
        availableBalance:
          type: number
          description: Available balance for new positions in collateral asset
          example: 960.31
        unrealizedPnl:
          type: number
          description: >-
            Total price PnL across all positions in collateral asset (excludes
            funding)
          example: 12.8
        unifiedAccountMode:
          type: boolean
          description: >-
            Whether the account currently has Unified Account Mode enabled
            (collateral unified across venues). Only present for providers that
            support it (Hyperliquid).
          example: false
      required:
        - providerId
        - collateral
        - accountValue
        - usedMargin
        - availableBalance
        - unrealizedPnl
    TokenDto:
      type: object
      properties:
        symbol:
          type: string
          description: Token symbol
          example: ETH
        name:
          type: string
          description: Token name
          example: Ethereum
        network:
          description: Blockchain network
          example: hyperliquid
          allOf:
            - $ref: '#/components/schemas/Networks'
        decimals:
          type: number
          description: Token decimals
          example: 6
        address:
          type: string
          description: Token contract address (optional for native tokens)
          example: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'
        logoURI:
          type: string
          description: Token logo URI
      required:
        - symbol
        - network
    Networks:
      type: string
      enum:
        - ethereum
        - ethereum-goerli
        - ethereum-holesky
        - ethereum-sepolia
        - ethereum-hoodi
        - arbitrum
        - base
        - base-sepolia
        - gnosis
        - optimism
        - polygon
        - polygon-amoy
        - starknet
        - zksync
        - linea
        - unichain
        - plume
        - monad-testnet
        - monad
        - robinhood
        - robinhood-testnet
        - arc-testnet
        - arc
        - avalanche-c
        - avalanche-c-atomic
        - avalanche-p
        - binance
        - celo
        - fantom
        - harmony
        - moonriver
        - okc
        - viction
        - core
        - sonic
        - plasma
        - katana
        - hyperevm
        - tempo
        - pharos
        - agoric
        - akash
        - axelar
        - band-protocol
        - bitsong
        - canto
        - chihuahua
        - comdex
        - coreum
        - cosmos
        - crescent
        - cronos
        - cudos
        - desmos
        - dydx
        - evmos
        - fetch-ai
        - gravity-bridge
        - injective
        - irisnet
        - juno
        - kava
        - ki-network
        - mars-protocol
        - nym
        - okex-chain
        - onomy
        - osmosis
        - persistence
        - quicksilver
        - regen
        - secret
        - sentinel
        - sommelier
        - stafi
        - stargaze
        - stride
        - teritori
        - tgrade
        - umee
        - sei
        - mantra
        - celestia
        - saga
        - zetachain
        - dymension
        - humansai
        - neutron
        - polkadot
        - kusama
        - westend
        - bittensor
        - aptos
        - binancebeacon
        - cardano
        - near
        - solana
        - solana-devnet
        - stellar
        - stellar-testnet
        - sui
        - tezos
        - tron
        - ton
        - ton-testnet
        - hyperliquid
      description: Blockchain network
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key

````

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