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

# Get relationship between two members

> Returns the relationship and path between two members.



## OpenAPI

````yaml api/openapi-integration.yaml get /api/v1/members/{userId}/relationship/{targetUserId}
openapi: 3.1.0
info:
  title: MLM Platform Integration API
  version: 1.0.0
  description: >
    Tenant integrator APIs for external platform federation and member-data
    access,

    including OIDC token exchange, external user linking, genealogy, referrals,
    and commissions.


    ## Authentication

    All API requests require a tenant API key passed in the `x-tenant-api-key`
    header.


    ## Token Exchange

    External platforms can exchange their JWT tokens for MLM platform tokens
    using

    the `/api/v1/auth/exchange` endpoint.
  contact:
    name: MLM Platform Support
    email: support@mlm-platform.example.com
servers:
  - url: https://app.mlm-platform.com
    description: Production API
  - url: http://localhost:3000
    description: Local Development
security:
  - TenantApiKey: []
tags:
  - name: Auth
    description: Authentication and token exchange
  - name: Genealogy
    description: Member hierarchy and relationships
  - name: Referrals
    description: Referral statistics and QR codes
  - name: Commissions
    description: Commission history and breakdowns
  - name: Webhooks
    description: Webhook receivers for third-party providers (Stripe, Wise)
paths:
  /api/v1/members/{userId}/relationship/{targetUserId}:
    get:
      tags:
        - Genealogy
      summary: Get relationship between two members
      description: Returns the relationship and path between two members.
      operationId: getRelationshipPath
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: targetUserId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Relationship path
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RelationshipPath'
        '404':
          description: User not found
components:
  schemas:
    RelationshipPath:
      type: object
      properties:
        connected:
          type: boolean
        relationship:
          type: string
          enum:
            - upline
            - downline
            - sibling
            - none
        distance:
          type: integer
        path:
          type: array
          items:
            $ref: '#/components/schemas/GenealogyNode'
    GenealogyNode:
      type: object
      properties:
        userId:
          type: string
          format: uuid
        email:
          type: string
          format: email
        name:
          type: string
          nullable: true
          description: Display name (computed from givenName and surname)
        givenName:
          type: string
          nullable: true
          description: Given/first name
        surname:
          type: string
          nullable: true
          description: Surname/family name
        membershipTier:
          type: string
          enum:
            - ORDINARY
            - SENIOR
            - MANAGER
            - DIRECTOR
        isActive:
          type: boolean
        depth:
          type: integer
        directReferrals:
          type: integer
        totalDownline:
          type: integer
        joinedAt:
          type: string
          format: date-time
        children:
          type: array
          items:
            $ref: '#/components/schemas/GenealogyNode'
  securitySchemes:
    TenantApiKey:
      type: apiKey
      in: header
      name: x-tenant-api-key
      description: Tenant API key for authentication

````