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

# Get user portfolio

> 
    Retrieves the authenticated user's complete token portfolio including:
    - All tokens owned by the user across all chains
    - Per-chain balance breakdown for each token
    - Token metadata (name, symbol, logo, etc.)
    - Available chains where each token is deployed

    Balances are grouped by token and include both raw balance (in wei) and formatted balance.
  



## OpenAPI

````yaml post /get-user-portfolio
openapi: 3.0.3
info:
  title: Token Layer API
  version: 1.0.0
  description: |2-

          Token Layer is an omnichain token trading platform where users can create and trade tokens across multiple chains.

          This API provides comprehensive access to token operations, trading, earnings,
          blockchain transactions, and portfolio management.

          ## Base URL
          All endpoints are accessed via: `https://api.tokenlayer.network/{endpoint}`

          ## Authentication
          Most endpoints require authentication using an JWT token or API key passed as a Bearer token in the Authorization header.

          ## Rate Limiting
          API calls are rate limited per user. Please implement appropriate backoff strategies.
        
  contact:
    name: Token Layer API Support
    url: https://app.tokenlayer.network
servers:
  - url: https://api.tokenlayer.network/functions/v1
    description: Production server
  - url: https://api.tokenlayer.network/functions/v1
    description: Staging server
security: []
tags:
  - name: Tokens
    description: Token creation, browsing, search, trading, and price operations
  - name: Transactions
    description: Blockchain transactions (send, tip, ownership checks)
paths:
  /get-user-portfolio:
    post:
      tags:
        - Portfolio
        - Tokens
      summary: Get user portfolio
      description: |2-

            Retrieves the authenticated user's complete token portfolio including:
            - All tokens owned by the user across all chains
            - Per-chain balance breakdown for each token
            - Token metadata (name, symbol, logo, etc.)
            - Available chains where each token is deployed

            Balances are grouped by token and include both raw balance (in wei) and formatted balance.
          
      operationId: getUserPortfolio
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetUserPortfolioRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUserPortfolioResponse'
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    GetUserPortfolioRequest:
      type: object
      properties:
        chains:
          type: array
          items:
            type: string
          description: Filter portfolio to only include tokens on specified chains
          example:
            - base
            - solana
            - ethereum
    GetUserPortfolioResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: object
          properties:
            tokens:
              type: array
              items:
                $ref: '#/components/schemas/TokenPortfolio'
            totalValueUsd:
              type: number
            totalTokensCount:
              type: number
          required:
            - tokens
            - totalValueUsd
            - totalTokensCount
      required:
        - success
        - data
    Error:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: string
      required:
        - success
        - error
      description: Error response
    TokenPortfolio:
      type: object
      properties:
        tokenId:
          type: string
        name:
          type: string
        symbol:
          type: string
        slug:
          type: string
        logo:
          type: string
        tokenLayerId:
          type: string
        totalBalanceUsd:
          type: number
        chainBalances:
          type: array
          items:
            $ref: '#/components/schemas/ChainBalance'
        availableChains:
          type: array
          items:
            type: string
        firstAcquired:
          type: string
      required:
        - tokenId
        - name
        - symbol
        - slug
        - totalBalanceUsd
        - chainBalances
        - availableChains
    ChainBalance:
      type: object
      properties:
        chain:
          type: string
        chainSlug:
          type: string
        balance:
          type: string
        balanceFormatted:
          type: string
        walletAddress:
          type: string
        tokenAddress:
          type: string
        decimals:
          type: number
        eid:
          type: number
        createdAt:
          type: string
        priceUsd:
          type: number
        valueUsd:
          type: number
      required:
        - chain
        - chainSlug
        - balance
        - balanceFormatted
        - walletAddress
        - tokenAddress
        - decimals
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token or API key

````