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

# Find shortest paths between tables

> Find shortest FK paths between all pairs of input tables.



## OpenAPI

````yaml /openapi/em-runtime-utils-v2.yaml post /utils/{resource_type}/{resource_uri}/fk-edges/find-paths
openapi: 3.1.0
info:
  title: em_runtime_utils
  version: 5.27.0
servers: []
security: []
paths:
  /utils/{resource_type}/{resource_uri}/fk-edges/find-paths:
    post:
      tags:
        - fk-graph
      summary: Find shortest paths between tables
      description: Find shortest FK paths between all pairs of input tables.
      operationId: find_paths
      parameters:
        - name: resource_type
          in: path
          required: true
          schema:
            type: string
            title: Resource Type
        - name: resource_uri
          in: path
          required: true
          schema:
            type: string
            title: Resource Uri
        - name: X-Project-ID
          in: header
          required: true
          schema:
            type: string
            title: X-Project-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FindPathsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FindPathsResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    FindPathsRequest:
      properties:
        table_fqns:
          items:
            type: string
          type: array
          maxItems: 100
          minItems: 2
          title: Table Fqns
          description: Table FQNs to connect (min 2, max 100)
        max_hops:
          type: integer
          maximum: 10
          minimum: 1
          title: Max Hops
          description: Maximum path length (1-10, default 5)
          default: 5
      type: object
      required:
        - table_fqns
      title: FindPathsRequest
      description: Request to find shortest paths between tables.
    FindPathsResponse:
      properties:
        paths:
          items:
            $ref: '#/components/schemas/PathResult'
          type: array
          title: Paths
          description: Path results for each table pair
        total_pairs:
          type: integer
          title: Total Pairs
          description: Total table pairs evaluated
        paths_found:
          type: integer
          title: Paths Found
          description: Number of paths found
      type: object
      required:
        - paths
        - total_pairs
        - paths_found
      title: FindPathsResponse
      description: Response for path finding.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
      description: Standard error response model.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PathResult:
      properties:
        from_table:
          type: string
          title: From Table
          description: Start table
        to_table:
          type: string
          title: To Table
          description: End table
        found:
          type: boolean
          title: Found
          description: Whether path was found
        path:
          anyOf:
            - items:
                $ref: '#/components/schemas/PathStep'
              type: array
            - type: 'null'
          title: Path
          description: Path steps if found
        hops:
          anyOf:
            - type: integer
            - type: 'null'
          title: Hops
          description: Path length if found
      type: object
      required:
        - from_table
        - to_table
        - found
      title: PathResult
      description: Result for a single table pair path.
    ErrorBody:
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          title: Message
        details:
          additionalProperties: true
          type: object
          title: Details
        request_id:
          type: string
          title: Request Id
        timestamp:
          type: string
          format: date-time
          title: Timestamp
      type: object
      required:
        - code
        - message
        - request_id
        - timestamp
      title: ErrorBody
      description: Error body with structured details.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    PathStep:
      properties:
        from_table:
          type: string
          title: From Table
          description: Source table FQN
        from_column:
          type: string
          title: From Column
          description: Source column
        to_table:
          type: string
          title: To Table
          description: Target table FQN
        to_column:
          type: string
          title: To Column
          description: Target column
      type: object
      required:
        - from_table
        - from_column
        - to_table
        - to_column
      title: PathStep
      description: A single step in a path.
    ErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - INVALID_TOKEN
        - INSUFFICIENT_PERMISSIONS
        - RESOURCE_NOT_FOUND
        - RESOURCE_ALREADY_EXISTS
        - VALIDATION_ERROR
        - RATE_LIMIT_EXCEEDED
        - SERVICE_UNAVAILABLE
        - INTERNAL_ERROR
      title: ErrorCode
      description: Standard error codes for API responses.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````