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

# Get Exchange Balance

> Get your cryptocurrency exchange balances

<Note>**10** credits per request</Note><hr />

<AccordionGroup>
  <Accordion title="You will get">
    * Real-time balance information
    * All coins and tokens in your account
    * Current value in USD and BTC
    * Available and locked amounts
  </Accordion>

  <Accordion title="Required">
    * connectionId: Exchange identifier (e.g., "binance", "coinbase")
    * connectionFields: Exchange API credentials
      * apiKey: Your exchange API key
      * apiSecret: Your exchange API secret
  </Accordion>

  <Accordion title="Optional">
    * name: Custom name for the portfolio
  </Accordion>

  <Accordion title="Security Note">
    * Use read-only API keys when possible
    * Keep your API credentials secure
    * Enable IP restrictions on exchange side
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml /api-reference/openapi.json post /v1/exchange/balance
openapi: 3.0.0
info:
  title: CoinStats Public API
  description: >-
    CoinStats Public API — programmatic access to market data, news, NFTs,
    wallets, exchange connections, and user portfolios. Authenticate every
    request with the `X-API-KEY` header (or an OAuth Bearer token in the
    `Authorization` header). Generate keys at https://openapi.coinstats.app.
  version: '1.0'
  contact: {}
servers:
  - url: https://openapiv1.coinstats.app
security: []
tags:
  - name: CoinStats
    description: ''
  - name: Market Data
    description: >-
      The Market Data section of the API provides endpoints to access a wide
      range of market-related information, including cryptocurrency coins,
      ticker data, and fiat currency rates. This category offers comprehensive
      data to help users monitor and analyze the cryptocurrency market, track
      prices, and gain insights into market trends
  - name: News
    description: >-
      The News section of the API allows you to access news articles and updates
      related to cryptocurrencies and the blockchain industry. It provides
      valuable information from various sources to keep you informed about the
      latest developments
  - name: NFTs
    description: >-
      The NFT section of the API provides endpoints to interact with
      Non-Fungible Tokens (NFTs), which are unique digital assets stored on a
      blockchain. These endpoints allow you to retrieve information about NFTs,
      including collections, assets, trending NFTs, and specific assets
      associated with wallet addresses.
  - name: Wallet Data
    description: >-
      The Wallet section of the API provides a comprehensive set of endpoints to
      manage and interact with wallets. It enables users to retrieve wallet
      balances, monitor syncing status, fetch transaction data, and synchronize
      wallet information with the blockchain. By integrating these endpoints
      into your application, you can offer robust wallet functionality to your
      users.
  - name: Exchange Connection
    description: >-
      The Exchange Connection section of the API provides a comprehensive set of
      endpoints to manage and interact with exchanges. It enables users to
      retrieve exchange balances, monitor syncing status, fetch transaction
      data. By integrating these endpoints into your application, you can offer
      robust exchange portfolio tracking functionality to your users.
  - name: User Portfolio
    description: >-
      The Portfolio section of the API provides a comprehensive set of endpoints
      to manage and interact with Share Portfolios. It enables users to retrieve
      current Portfolio Coins and Transactions.
  - name: Usage
    description: The Usage section provides account-level API usage data.
  - name: Status
    description: The Status section provides API availability checks.
paths:
  /v1/exchange/balance:
    post:
      tags:
        - Exchange Connection
      summary: Get your cryptocurrency exchange balances
      operationId: get-exchange-balance
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExchangeBalanceQueryDto'
      responses:
        '200':
          description: Get exchange balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeBalanceResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              example:
                statusCode: 400
                message: Bad Request
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                statusCode: 401
                message: Unauthorized
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                statusCode: 403
                message: Forbidden
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '404':
          description: Not Found
          content:
            application/json:
              example:
                statusCode: 404
                message: Not Found
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '409':
          description: Conflict (for some endpoints)
          content:
            application/json:
              example:
                statusCode: 409
                message: Transactions not synced
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '429':
          description: Too Many Requests
          content:
            application/json:
              example:
                statusCode: 429
                message: Rate limit exceeded
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '503':
          description: Service Unavailable
          content:
            application/json:
              example:
                statusCode: 503
                message: Service Unavailable. Please Contact Support
      security:
        - X-API-KEY: []
components:
  schemas:
    ExchangeBalanceQueryDto:
      type: object
      properties:
        connectionFields:
          type: object
          additionalProperties:
            type: string
          example:
            apiKey: your_binance_api_key_here
            apiSecret: your_binance_api_secret_here
          description: >-
            Authentication credentials required to connect to the exchange. This
            object should contain the API key, secret, and any additional
            authentication fields from [Exchanges
            request](/openapi/get-exchanges)
        connectionId:
          type: string
          example: binance
          description: >-
            The connectionId for the cryptocurrency exchange platform from
            [Exchanges request](/openapi/get-exchanges)
        name:
          type: string
          example: My Binance Portfolio
          description: Name for the portfolio
      required:
        - connectionFields
        - connectionId
    ExchangeBalanceResponseDto:
      type: object
      properties:
        balances:
          description: Array of cryptocurrency balances in the exchange account
          type: array
          items:
            $ref: '#/components/schemas/ExchangeBalanceItemDto'
        portfolio:
          description: Portfolio information including sync status and connection details
          allOf:
            - $ref: '#/components/schemas/PortfolioResponseDto'
      required:
        - balances
        - portfolio
    ExchangeBalanceItemDto:
      type: object
      properties:
        coinId:
          type: string
          description: Unique identifier for the cryptocurrency
          example: popcat
        amount:
          type: number
          description: Amount of the cryptocurrency held in the exchange balance
          example: 0.00342
        price:
          type: number
          description: Current price of the cryptocurrency in USD
          example: 0.25946
        priceBtc:
          type: number
          description: Current price of the cryptocurrency in Bitcoin (BTC)
          example: 0.0000023571544854315866
      required:
        - coinId
        - amount
        - price
        - priceBtc
    PortfolioResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the portfolio
          example: 618f0bb0f2cf07dce25bc5007750bf1646825509bb63519bd491ab6a56daa419
        status:
          type: string
          description: Current synchronization status of the portfolio
          example: syncing
          enum:
            - syncing
            - synced
        connectionId:
          type: string
          description: Identifier of the exchange connection
          example: bybit
        name:
          type: string
          description: Name of the portfolio
          example: My Binance Portfolio
      required:
        - id
        - status
        - connectionId
  securitySchemes:
    X-API-KEY:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        API key required to access the endpoints. Generate one from your
        dashboard at https://openapi.coinstats.app and pass it in the
        `X-API-KEY` request header. Never expose your key in client-side code.

````