> ## 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 Portfolio Coins

> Get detailed information about all coins in your portfolio

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

<AccordionGroup>
  <Accordion title="You will get">
    * Current holdings and their USD value
    * Profit/Loss (PnL) information
    * Performance metrics and statistics
    * Risk assessment scores (optional)
  </Accordion>

  <Accordion title="Required">
    <Note>This endpoint is only available for users with a Degen plan subscription (when using shareToken).</Note>

    * shareToken OR portfolioId: Provide one of these to identify the portfolio.
      * shareToken: Get this from your CoinStats portfolio page by clicking "Share"
      * portfolioId: Use a portfolio connected via POST /portfolio/wallet or POST /portfolio/exchange
    * If neither is provided, returns aggregated coins from all API-connected portfolios
  </Accordion>

  <Accordion title="Optional">
    * page & limit: Control the number of results per page
    * includeRiskScore: Set to "true" to include risk metrics
    * passcode: Passcode for accessing protected portfolio data (can be passed in header or query parameter)
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml /api-reference/openapi.json get /v1/portfolio/coins
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/portfolio/coins:
    get:
      tags:
        - User Portfolio
      summary: Get detailed information about all coins in your portfolio
      operationId: get-portfolio-coins
      parameters:
        - name: sharetoken
          required: false
          in: header
          description: '[Get Share Token](/sharetoken)'
          schema:
            type: string
        - name: passcode
          required: false
          in: header
          description: Passcode for accessing protected portfolio data
          schema:
            example: '123456'
            type: string
        - name: page
          required: false
          in: query
          description: Page number to retrieve (1-based indexing)
          schema:
            example: 1
            type: number
        - name: limit
          required: false
          in: query
          description: Number of items to return per page
          schema:
            example: 20
            type: number
        - name: includeRiskScore
          required: false
          in: query
          description: Include Risk Score Information
          schema:
            default: 'false'
            example: 'true'
            type: string
            enum:
              - 'true'
              - 'false'
        - name: portfolioId
          required: false
          in: query
          description: >-
            Portfolio ID for accessing a specific API-connected portfolio.
            Required if shareToken is not provided.
          schema:
            example: abc123def456
            type: string
      responses:
        '200':
          description: Portfolio coins
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortfolioItemResponseDto'
        '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:
    PortfolioItemResponseDto:
      type: object
      properties:
        result:
          description: >-
            Array of portfolio items containing detailed information about each
            held cryptocurrency including prices, profits, averages, and risk
            metrics
          type: array
          items:
            $ref: '#/components/schemas/PortfolioItemDto'
      required:
        - result
    PortfolioItemDto:
      type: object
      properties:
        count:
          type: number
          example: 44.4987
          description: Quantity of coins held in the portfolio
        coin:
          description: Coin information including symbol, name, rank, and market data
          allOf:
            - $ref: '#/components/schemas/CoinDto'
        price:
          description: Current market prices in multiple currencies (USD, BTC, ETH)
          allOf:
            - $ref: '#/components/schemas/PriceDto'
        profit:
          description: Profit and loss data across different time periods and categories
          allOf:
            - $ref: '#/components/schemas/ProfitDto'
        averageBuy:
          description: Average purchase prices across different time periods
          allOf:
            - $ref: '#/components/schemas/AverageDto'
        averageSell:
          description: Average sale prices across different time periods
          allOf:
            - $ref: '#/components/schemas/AverageDto'
        profitPercent:
          description: Profit/loss percentages across different time periods and categories
          allOf:
            - $ref: '#/components/schemas/ProfitPercentDto'
        liquidityScore:
          type: number
          example: 94.44676177373067
          description: >-
            Liquidity score indicating how easily the asset can be traded
            (0-100)
        volatilityScore:
          type: number
          example: 6.823477152064536
          description: Volatility score indicating price stability (lower = more stable)
        marketCapScore:
          type: number
          example: 90.15554879029162
          description: Market capitalization score relative to other assets (0-100)
        riskScore:
          type: number
          example: 7.407055529347417
          description: Risk score indicating investment risk level (lower = less risky)
        avgChange:
          type: number
          example: 2.631321607022045
          description: Average price change percentage across multiple time periods
        totalCost:
          type: object
          example:
            USD: 160
            BTC: 0.0016
            ETH: 0.032
          description: Current open-holdings cost basis in multiple currencies
      required:
        - count
        - coin
        - price
        - profitPercent
    CoinDto:
      type: object
      properties:
        rank:
          type: number
          example: 2
          description: Market rank of the coin
        identifier:
          type: string
          example: ethereum
          description: Unique identifier for the coin
        symbol:
          type: string
          example: ETH
          description: Trading symbol of the coin
        name:
          type: string
          description: Full name of the coin
          example: Ethereum
        icon:
          type: string
          example: https://static.coinstats.app/coins/1650455629727.png
          description: URL to the coin icon image
        isFake:
          type: boolean
          example: false
          description: Whether the coin is identified as fake
        isFiat:
          type: boolean
          example: false
          description: Whether the coin is a fiat currency
        priceChange24h:
          type: number
          example: -5.74
          description: Price change percentage in the last 24 hours
        priceChange1h:
          type: number
          example: 0.1
          description: Price change percentage in the last 1 hour
        priceChange7d:
          type: number
          example: 1.12
          description: Price change percentage in the last 7 days
        priceChange1m:
          type: number
          example: 8.42
          description: Price change percentage in the last 1 month
        volume:
          type: number
          example: 61315198931.43572
          description: Trading volume in the last 24 hours (USD)
      required:
        - rank
        - identifier
        - symbol
        - name
        - icon
        - priceChange24h
        - priceChange1h
        - priceChange7d
        - priceChange1m
        - volume
    PriceDto:
      type: object
      properties:
        USD:
          type: number
          example: 4343.564311034
          description: Current price in USD
        BTC:
          type: number
          example: 0.039479708
          description: Current price in BTC
        ETH:
          type: number
          example: 1
          description: Current price in ETH
      required:
        - USD
        - BTC
        - ETH
    ProfitDto:
      type: object
      properties:
        allTime:
          description: All-time profit/loss amounts in multiple currencies
          allOf:
            - $ref: '#/components/schemas/AllTimeDto'
        hour24:
          description: 24-hour profit/loss amounts in multiple currencies
          allOf:
            - $ref: '#/components/schemas/Hour24Dto'
        lastTrade:
          description: Last trade profit/loss amounts in multiple currencies
          allOf:
            - $ref: '#/components/schemas/LastTradeDto'
        unrealized:
          description: Unrealized profit/loss amounts in multiple currencies
          allOf:
            - $ref: '#/components/schemas/UnrealizedDto'
        realized:
          description: Realized profit/loss amounts in multiple currencies
          allOf:
            - $ref: '#/components/schemas/RealizedDto'
      required:
        - allTime
        - hour24
        - lastTrade
        - unrealized
        - realized
    AverageDto:
      type: object
      properties:
        allTime:
          description: All-time average buy/sell price across all transactions
          allOf:
            - $ref: '#/components/schemas/AllTimeDto'
        hour24:
          description: 24-hour average buy/sell price
          allOf:
            - $ref: '#/components/schemas/Hour24Dto'
        lastTrade:
          description: Average price of the most recent trade
          allOf:
            - $ref: '#/components/schemas/LastTradeDto'
        unrealized:
          description: Average price for unrealized positions
          allOf:
            - $ref: '#/components/schemas/UnrealizedDto'
        realized:
          description: Average price for realized positions
          allOf:
            - $ref: '#/components/schemas/RealizedDto'
    ProfitPercentDto:
      type: object
      properties:
        allTime:
          description: All-time profit/loss percentages in multiple currencies
          allOf:
            - $ref: '#/components/schemas/AllTimeDto'
        hour24:
          description: 24-hour profit/loss percentages in multiple currencies
          allOf:
            - $ref: '#/components/schemas/Hour24Dto'
        lastTrade:
          description: Last trade profit/loss percentages in multiple currencies
          allOf:
            - $ref: '#/components/schemas/LastTradeDto'
        unrealized:
          description: Unrealized profit/loss percentages in multiple currencies
          allOf:
            - $ref: '#/components/schemas/UnrealizedDto'
        realized:
          description: Realized profit/loss percentages in multiple currencies
          allOf:
            - $ref: '#/components/schemas/RealizedDto'
      required:
        - allTime
        - hour24
        - lastTrade
        - unrealized
        - realized
    AllTimeDto:
      type: object
      properties:
        USD:
          type: number
          example: 83720.75297372
          description: All-time value in USD
        BTC:
          type: number
          example: 0.054246576
          description: All-time value in BTC
        ETH:
          type: number
          example: -0.0008427712028833412
          description: All-time value in ETH
      required:
        - USD
        - BTC
        - ETH
    Hour24Dto:
      type: object
      properties:
        USD:
          type: number
          example: -11770.04265107636
          description: 24-hour period value in USD
        BTC:
          type: number
          example: -0.055726915608058335
          description: 24-hour period value in BTC
        ETH:
          type: number
          example: 0
          description: 24-hour period value in ETH
      required:
        - USD
        - BTC
        - ETH
    LastTradeDto:
      type: object
      properties:
        USD:
          type: number
          example: -0.0011652685976688212
          description: Last trade value in USD
        BTC:
          type: number
          example: -8.325768295004658e-9
          description: Last trade value in BTC
        ETH:
          type: number
          example: 8.470329472543003e-22
          description: Last trade value in ETH
      required:
        - USD
        - BTC
        - ETH
    UnrealizedDto:
      type: object
      properties:
        USD:
          type: number
          example: 64875.375139922
          description: Unrealized gains/losses in USD
        BTC:
          type: number
          example: 0.516615331
          description: Unrealized gains/losses in BTC
        ETH:
          type: number
          example: -0.000013421973257266018
          description: Unrealized gains/losses in ETH
      required:
        - USD
        - BTC
        - ETH
    RealizedDto:
      type: object
      properties:
        USD:
          type: number
          example: 18844.785945298
          description: Realized gains/losses in USD
        BTC:
          type: number
          example: -0.46237401135664413
          description: Realized gains/losses in BTC
        ETH:
          type: number
          example: -0.0008426785167330308
          description: Realized gains/losses in ETH
      required:
        - USD
        - BTC
        - ETH
  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.

````