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

# Find all references to a symbol

> The input position should point to the identifier of the symbol you want to get the references for.

Returns a list of locations where the symbol at the given position is referenced.

The returned positions point to the start of the reference identifier.

e.g. for `User` on line 0 of `src/main.py`:
```
 0: class User:
 input____^^^^
 1:     def __init__(self, name, age):
 2:         self.name = name
 3:         self.age = age
 4:
 5: user = User("John", 30)
 output____^
```



## OpenAPI

````yaml openapi.json post /symbol/find-references
openapi: 3.1.0
info:
  title: lsproxy
  description: ''
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.2.1
servers:
  - url: http://localhost:4444/v1
    description: API server v1
security:
  - bearer_auth: []
tags:
  - name: lsproxy-api
    description: LSP Proxy API
paths:
  /symbol/find-references:
    post:
      tags:
        - symbol
      summary: Find all references to a symbol
      description: >-
        The input position should point to the identifier of the symbol you want
        to get the references for.


        Returns a list of locations where the symbol at the given position is
        referenced.


        The returned positions point to the start of the reference identifier.


        e.g. for `User` on line 0 of `src/main.py`:

        ```
         0: class User:
         input____^^^^
         1:     def __init__(self, name, age):
         2:         self.name = name
         3:         self.age = age
         4:
         5: user = User("John", 30)
         output____^
        ```
      operationId: find_references
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetReferencesRequest'
        required: true
      responses:
        '200':
          description: References retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferencesResponse'
        '400':
          description: Bad request
        '500':
          description: Internal server error
components:
  schemas:
    GetReferencesRequest:
      type: object
      required:
        - identifier_position
      properties:
        identifier_position:
          $ref: '#/components/schemas/FilePosition'
        include_code_context_lines:
          type:
            - integer
            - 'null'
          format: int32
          description: |-
            Whether to include the source code of the symbol in the response.
            Defaults to none.
          example: 5
          minimum: 0
        include_raw_response:
          type: boolean
          description: >-
            Whether to include the raw response from the langserver in the
            response.

            Defaults to false.
          example: false
    ReferencesResponse:
      type: object
      description: >-
        Response to a references request.


        Points to the start position of the symbol's identifier.


        e.g. for the references of `User` on line 0 character 6 of `src/main.py`
        with the code:

        ```

        0: class User:

        1:     def __init__(self, name, age):

        2:         self.name = name

        3:         self.age = age

        4:

        5: user = User("John", 30)

        _________^

        6:

        7: print(user.name)

        ```

        The references will be `[{"path": "src/main.py", "line": 5, "character":
        7}]`.
      required:
        - references
        - selected_identifier
      properties:
        context:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/CodeContext'
          description: The source code around the references.
        raw_response:
          description: >-
            The raw response from the langserver.


            https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_references
        references:
          type: array
          items:
            $ref: '#/components/schemas/FilePosition'
        selected_identifier:
          $ref: '#/components/schemas/Identifier'
          description: The identifier that was "clicked-on" to get the references.
    FilePosition:
      type: object
      description: A position within a specific file in the workspace
      required:
        - path
        - position
      properties:
        path:
          type: string
          description: Path to the file, relative to the workspace root
          example: src/main.py
        position:
          $ref: '#/components/schemas/Position'
          description: Position within the file
    CodeContext:
      type: object
      required:
        - range
        - source_code
      properties:
        range:
          $ref: '#/components/schemas/FileRange'
        source_code:
          type: string
    Identifier:
      type: object
      required:
        - name
        - file_range
      properties:
        file_range:
          $ref: '#/components/schemas/FileRange'
        kind:
          type:
            - string
            - 'null'
        name:
          type: string
    Position:
      type: object
      description: A position within a text document, using 0-based indexing
      required:
        - line
        - character
      properties:
        character:
          type: integer
          format: int32
          description: 0-indexed character index within the line.
          example: 5
          minimum: 0
        line:
          type: integer
          format: int32
          description: 0-indexed line number.
          example: 10
          minimum: 0
    FileRange:
      type: object
      description: A range within a specific file, defined by start and end positions
      required:
        - path
        - range
      properties:
        path:
          type: string
          description: The path to the file.
          example: src/main.py
        range:
          $ref: '#/components/schemas/Range'
          description: The range within the file
    Range:
      type: object
      required:
        - start
        - end
      properties:
        end:
          $ref: '#/components/schemas/Position'
          description: The end position of the range.
        start:
          $ref: '#/components/schemas/Position'
          description: The start position of the range.
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````