> ## 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 portfolio with returns by tenor

> Retrieve portfolio holdings, target allocation, and performance metrics (returns and upBy values) across all time periods.



## OpenAPI

````yaml GET /portfolios/{id}/with-returns-by-tenor
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/{id}/with-returns-by-tenor:
    get:
      tags:
        - Portfolio
      summary: Get portfolio with returns by tenor
      description: >
        Returns portfolio holdings and target allocation with performance
        metrics (returns and upBy values)

        across all time periods. The response includes calculated portfolio
        value, returns and upBy values for

        each tenor (1w, 1m, 3m, 6m, 1y, max), and detailed holdings with
        individual asset returns.
      parameters:
        - $ref: '#/components/parameters/ExternalUserId'
        - $ref: '#/components/parameters/PortfolioId'
      responses:
        '200':
          description: Portfolio with returns and upBy values by tenor.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortfolioWithReturns'
              examples:
                sample:
                  summary: Portfolio with returns data
                  value:
                    id: 64f0c51e7fb3fc001234abcd
                    currency: EUR
                    calculatedPrice: 5123.42
                    returnsValues:
                      max: 0.143
                      1y: 0.082
                      6m: 0.045
                      3m: 0.023
                      1m: 0.012
                      1w: 0.003
                    upByValues:
                      max: 642.15
                      1y: 390.25
                      6m: 210.5
                      3m: 105.3
                      1m: 54.2
                      1w: 13.5
                    holdings:
                      - isin: US88160R1014
                        assetCommonId: equities_tesla
                        quantity: 12.5
                        sinceBuyReturns: 0.156
                      - isin: US9229087699
                        assetCommonId: etf_vanguard_snp500
                        quantity: 8
                        sinceBuyReturns: 0.089
                    targetAllocation:
                      - assetCommonId: equities_tesla
                        percentage: 55
                      - assetCommonId: etf_vanguard_snp500
                        percentage: 45
                    createdAt: '2024-03-01T10:00:00.000Z'
                    updatedAt: '2024-07-10T12:00:00.000Z'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
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}$
    PortfolioId:
      name: id
      in: path
      required: true
      description: Portfolio identifier belonging to the authenticated user.
      schema:
        type: string
        pattern: ^[a-f0-9]{24}$
  schemas:
    PortfolioWithReturns:
      type: object
      required:
        - id
        - currency
        - calculatedPrice
        - returnsValues
        - upByValues
        - 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).
        calculatedPrice:
          type: number
          format: double
          description: Latest calculated portfolio value in the user's currency.
        returnsValues:
          $ref: '#/components/schemas/TenorValueMap'
        upByValues:
          $ref: '#/components/schemas/TenorValueMap'
        holdings:
          type: array
          description: Array of holdings with returns data.
          items:
            $ref: '#/components/schemas/HoldingWithReturns'
        targetAllocation:
          type: array
          description: Target allocation by asset.
          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
    TenorValueMap:
      type: object
      description: Map of tenor code to numeric value.
      additionalProperties:
        type: number
        format: double
      properties:
        max:
          type: number
          format: double
        1y:
          type: number
          format: double
        6m:
          type: number
          format: double
        3m:
          type: number
          format: double
        1m:
          type: number
          format: double
        1w:
          type: number
          format: double
    HoldingWithReturns:
      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.
        sinceBuyReturns:
          type: number
          format: double
          description: Cumulative return (ratio) since the asset was first purchased.
    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
    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
  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
    NotFoundError:
      description: Portfolio or related resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            status: 404
            error:
              message: Portfolio not found
            responseId: 77354fbd-2d0a-4f5a-8e15-a64c2b7ac3b5
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Auth0-issued access token that includes the scopes listed for the route.

````