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

# Get user portfolios

> Retrieve all portfolios for the authenticated user with holdings and target allocation.



## OpenAPI

````yaml GET /portfolios
openapi: 3.0.3
info:
  title: Wealthyhood Portfolio API
  version: 1.0.0
  description: >
    Investments screen portfolio endpoints that expose chart prices and return
    metrics.


    All requests require a bearer token with the scopes advertised in the
    primary specification, 

    and must include the `x-user-id` header so the platform can resolve the
    acting investor.
servers:
  - url: https://{host}
    variables:
      host:
        default: api.wealthyhood.com
        description: Wealthyhood API host name.
security:
  - bearerAuth: []
tags:
  - name: Portfolio
    description: >-
      Investments screen data for a single portfolio (prices and performance by
      tenor).
paths:
  /portfolios:
    get:
      tags:
        - Portfolio
      summary: Get all portfolios for the signed-in user
      description: >
        Returns all portfolios belonging to the authenticated user. This
        endpoint retrieves the user's 

        portfolio holdings and target allocation using the user ID from the
        x-user-id header.
      parameters:
        - $ref: '#/components/parameters/ExternalUserId'
      responses:
        '200':
          description: Array of user portfolios with holdings and target allocation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PortfolioHoldings'
              examples:
                sample:
                  summary: User with one portfolio
                  value:
                    - id: 64f0c51e7fb3fc001234abcd
                      currency: EUR
                      holdings:
                        - isin: US0378331005
                          assetCommonId: equities_apple
                          quantity: 12.5
                        - isin: EU0009658145
                          assetCommonId: etf_vanguard_snp500
                          quantity: 8
                      targetAllocation:
                        - assetCommonId: equities_apple
                          percentage: 40
                        - assetCommonId: etf_vanguard_snp500
                          percentage: 60
                      createdAt: '2024-03-01T10:00:00.000Z'
                      updatedAt: '2024-07-10T12:00:00.000Z'
                empty:
                  summary: User with no portfolios
                  value: []
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
              example:
                status: 404
                error:
                  message: User not found
                responseId: 77354fbd-2d0a-4f5a-8e15-a64c2b7ac3b5
components:
  parameters:
    ExternalUserId:
      name: x-user-id
      in: header
      required: true
      description: MongoDB identifier of the user whose portfolio is being queried.
      schema:
        type: string
        pattern: ^[a-f0-9]{24}$
  schemas:
    PortfolioHoldings:
      type: object
      required:
        - id
        - currency
        - holdings
        - targetAllocation
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          description: Portfolio unique identifier.
        currency:
          type: string
          description: ISO currency code for the portfolio (e.g. EUR, GBP, USD).
        holdings:
          type: array
          description: Array of holdings with asset details and quantities.
          items:
            $ref: '#/components/schemas/Holding'
        targetAllocation:
          type: array
          description: >-
            Target allocation by asset. Weights are persisted with the
            portfolio. May be an empty array when unset.
          items:
            $ref: '#/components/schemas/TargetAllocationItem'
        createdAt:
          type: string
          format: date-time
          description: Portfolio creation timestamp.
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp.
      additionalProperties: false
    ApiErrorResponse:
      type: object
      properties:
        status:
          type: integer
        error:
          type: object
          properties:
            message:
              type: string
            description:
              type: string
              nullable: true
        responseId:
          type: string
          format: uuid
      additionalProperties: false
    Holding:
      type: object
      required:
        - isin
        - assetCommonId
        - quantity
      properties:
        isin:
          type: string
          description: International Securities Identification Number (ISIN) for the asset.
        assetCommonId:
          type: string
          description: Wealthyhood internal asset identifier.
        quantity:
          type: number
          format: double
          description: Number of shares/units held.
    TargetAllocationItem:
      type: object
      required:
        - assetCommonId
        - percentage
      properties:
        assetCommonId:
          type: string
          description: Wealthyhood internal asset identifier.
        percentage:
          type: number
          format: double
          description: >-
            Target allocation percentage for the asset (weights for active
            assets sum to 100 when a target is configured).
      additionalProperties: false
  responses:
    UnauthorizedError:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            status: 401
            error:
              message: User not found
            responseId: 56962f31-e1bc-4a32-8b47-623f793aa2f8
    ForbiddenError:
      description: >-
        Authenticated user cannot access the requested portfolio or lacks
        scopes.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            status: 403
            error:
              message: Portfolio does not belong to user
            responseId: 1c8b2106-5f8f-4f71-8f06-23a53205b384
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Auth0-issued access token that includes the scopes listed for the route.

````