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

# Fetch Patients

> Fetch a list of patients belonging to a doctor. If a workspace ID is provided, only patients belonging to that workspace will be returned.



## OpenAPI

````yaml GET /patients/fetch_patients
openapi: 3.1.0
info:
  title: IOLOKIS API
  description: You can use the REST API to manage your IOLOKIS account and resources.
  version: 1.0.0
servers:
  - url: https://api.iolokis.com
security:
  - bearerAuth: []
paths:
  /patients/fetch_patients:
    get:
      description: >-
        Fetch a list of patients belonging to a doctor. If a workspace ID is
        provided, only patients belonging to that workspace will be returned.
      parameters:
        - name: workspace_id
          in: query
          description: >-
            Workspace ID is used to filter patients. If not provided, all
            patients will be returned.
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Patient'
        '400':
          description: Invalid input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid or missing JWT token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
      security:
        - bearerAuth: []
components:
  schemas:
    Patient:
      required:
        - id
        - first_name
        - last_name
        - age
        - gender
        - phone_number
        - workspace_id
        - dirPath
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Patient unique identifier.
        first_name:
          type: string
        last_name:
          type: string
        age:
          type: integer
        gender:
          type: string
        dirPath:
          type: array
          items:
            type: string
        phone_number:
          type: string
        workspace_id:
          type: integer
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message indicating the error
      required:
        - error
    UnauthorizedError:
      type: object
      properties:
        message:
          type: string
          description: Error message indicating missing authorization header
      required:
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````