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

# Get card context

> Retrieve hierarchical context for a card including ancestors (parent cards), descendants (child cards), or both. Each card in the response includes a 'level' field (0=target card, positive integers=distance from target) and a 'children' array (IDs of direct child cards). Use direction='ancestors' to understand what problems/objectives a card supports, direction='descendants' to see solutions/experiments beneath a card, or direction='both' for complete tree context. The hierarchy can be reconstructed using the children arrays and level fields.



## OpenAPI

````yaml https://api.vistaly.com/v1/swagger.json get /beta/cards/{cardId}/context
openapi: 3.1.0
info:
  contact:
    email: support@vistaly.com
    name: Vistaly Support Team
  description: >-
    Vistaly's public API for interacting with our platform, enabling developers
    to integrate with various features such as feedback, cards, and system
    health.
  termsOfService: https://vistaly.com/terms-of-service
  title: Vistaly API
  version: '2025-06-21'
servers:
  - description: Production server
    url: https://api.vistaly.com
security: []
tags:
  - description: System-related endpoints to interact with the overall service.
    name: system
  - description: >-
      Endpoints related to card management, including the creation and
      modification of card metrics and related data.
    externalDocs:
      description: Learn more about Cards
      url: https://docs.vistaly.com/en/card-types/overview
    name: cards
  - description: >-
      Endpoints for handling insights data, such as user feedback and interview
      records.
    externalDocs:
      description: Learn more about Insights
      url: https://docs.vistaly.com/en/insights/overview
    name: insights
paths:
  /beta/cards/{cardId}/context:
    get:
      tags:
        - cards
      summary: Get card context
      description: >-
        Retrieve hierarchical context for a card including ancestors (parent
        cards), descendants (child cards), or both. Each card in the response
        includes a 'level' field (0=target card, positive integers=distance from
        target) and a 'children' array (IDs of direct child cards). Use
        direction='ancestors' to understand what problems/objectives a card
        supports, direction='descendants' to see solutions/experiments beneath a
        card, or direction='both' for complete tree context. The hierarchy can
        be reconstructed using the children arrays and level fields.
      parameters:
        - description: The unique identifier for the card
          in: path
          name: cardId
          required: true
          schema:
            type: string
        - in: query
          name: direction
          schema:
            type: string
            enum:
              - ancestors
              - descendants
              - both
            default: descendants
          description: Direction to traverse the card hierarchy
        - in: query
          name: maxLevels
          schema:
            type: integer
            minimum: 1
            maximum: 10
            default: 4
          description: Maximum depth for traversal (1-10)
        - in: query
          name: includeTargetCard
          schema:
            type: boolean
            default: true
          description: Include the target card in results
        - in: query
          name: includeComments
          schema:
            type: boolean
            default: false
          description: Include comments for each card
        - in: query
          name: includeInsights
          schema:
            type: boolean
            default: true
          description: Include insights for each card
        - in: query
          name: includeDescriptions
          schema:
            type: boolean
            default: false
          description: Include card descriptions (details)
      responses:
        '200':
          description: Card context retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CardContextResponse'
        '400':
          description: Bad request
          content:
            application/json:
              example:
                message: Bad request
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                message: Unauthorized
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                message: Forbidden
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              example:
                message: Internal server error
              schema:
                $ref: '#/components/schemas/MessageResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CardContextResponse:
      additionalProperties: false
      description: Response containing card context with hierarchical data
      properties:
        context:
          description: Array of enriched card contexts
          items:
            $ref: '#/components/schemas/EnrichedCardContext'
          type: array
        metadata:
          $ref: '#/components/schemas/CardContextMetadata'
      required:
        - context
        - metadata
      type: object
    MessageResponse:
      additionalProperties: false
      properties:
        message:
          example: System provided message
          type: string
      type: object
    EnrichedCardContext:
      additionalProperties: false
      description: Enriched card data with full hierarchical context
      properties:
        cardId:
          description: The unique identifier of the card
          type: string
        cardTitle:
          description: The title of the card (plain text)
          type: string
        cardDetails:
          description: >-
            The detailed description of the card (plain text, only if
            includeDescriptions=true)
          type: string
        cardType:
          $ref: '#/components/schemas/CardType'
          description: The type of the card
        cardStatus:
          description: >-
            The current status of the card (type-dependent: experiment,
            opportunity, outcome, or solution status)
          type: string
        cardUrl:
          description: Direct link to the card in Vistaly
          type: string
          format: uri
        level:
          description: >-
            Distance from target card (0 = target card, positive for
            descendants/ancestors)
          type: integer
        children:
          description: Array of child card IDs
          type: array
          items:
            type: string
        organizationId:
          description: The organization this card belongs to
          type: string
        workspaceId:
          description: The workspace this card belongs to
          type: string
        metricCurrent:
          description: Current metric value (only for KPI and Outcome card types)
          type: number
          nullable: true
        metricTarget:
          description: Target metric value (only for KPI and Outcome card types)
          type: number
          nullable: true
        metricUnit:
          description: >-
            Unit of measurement for the metric (e.g., '$', '%') (only for KPI
            and Outcome card types)
          type: string
          nullable: true
        insights:
          description: Associated insights (only if includeInsights=true)
          items:
            type: object
            properties:
              insightId:
                description: The unique identifier of the insight
                type: string
              insightUrl:
                description: Direct link to the insight in Vistaly
                type: string
                format: uri
              textPreview:
                description: Preview text of the insight
                type: string
              customerInteractionId:
                description: The customer interaction this insight belongs to
                type: string
              interviewUrl:
                description: >-
                  Direct link to the interview/interaction (null if not
                  available)
                type: string
                format: uri
                nullable: true
              customerOrganization:
                description: The customer organization associated with this insight
                type: object
                nullable: true
                properties:
                  id:
                    description: The customer organization ID
                    type: string
                  name:
                    description: The customer organization name
                    type: string
                required:
                  - id
                  - name
            required:
              - insightId
              - insightUrl
              - textPreview
              - customerInteractionId
              - interviewUrl
              - customerOrganization
          type: array
        comments:
          description: Card comments (only if includeComments=true)
          items:
            type: object
            properties:
              commentId:
                description: The unique identifier of the comment
                type: string
              commentUrl:
                description: Direct link to the comment in Vistaly
                type: string
                format: uri
              text:
                description: The comment text (plain text)
                type: string
              author:
                description: The comment author information
                type: object
                properties:
                  userId:
                    description: The user ID of the comment author
                    type: string
                  name:
                    description: The display name of the comment author
                    type: string
                required:
                  - userId
                  - name
              createdAt:
                description: ISO 8601 timestamp of when the comment was created
                type: string
                format: date-time
            required:
              - commentId
              - commentUrl
              - text
              - author
              - createdAt
          type: array
      required:
        - cardId
        - cardTitle
        - cardType
        - cardUrl
        - level
        - children
        - organizationId
        - workspaceId
      type: object
    CardContextMetadata:
      additionalProperties: false
      description: Metadata about the card context response
      properties:
        direction:
          description: The direction of traversal
          enum:
            - ancestors
            - descendants
            - both
          type: string
        cardCount:
          description: Total number of cards in the response
          type: integer
        maxLevel:
          description: Maximum level (distance) in the response
          type: integer
      required:
        - direction
        - cardCount
        - maxLevel
      type: object
    CardType:
      enum:
        - assumption
        - experiment
        - kpi
        - objective
        - opportunity
        - outcome
        - problem
        - product
        - solution
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````