{
  "openapi": "3.0.3",
  "info": {
    "title": "VSee Clinic Visit API",
    "description": "The VSee Clinic Visit API allows developers to manage intakes, walk-in visits, e-consults, and appointments within the VSee Clinic platform.\n\n### Visit Status Codes\n| Code | Meaning | Description |\n|------|---------|-------------|\n| 10 | Pending | Visit was just created |\n| 20 | Confirmed | Appointment is confirmed |\n| 25 | In-progress | Visit is in progress |\n| 30 | Completed | Visit is closed |\n| 40 | Deleted / Cancelled | Visit is cancelled by patient or provider |\n\n### Visit Subtypes\n| Code | Meaning | Description |\n|------|---------|-------------|\n| 1 | In-person | In-person visit, no video call |\n| 2 | Phone | Appointment by phone, no video call |\n| 3 | Video | Default: VSee video call |\n| 4 | E-consult | Async visit, no video call |\n",
    "version": "3.0",
    "contact": {
      "email": "admin@vsee.com"
    }
  },
  "x-readme": {
    "explorer-enabled": false,
    "proxy-enabled": false,
    "samples-languages": [
      "curl",
      "python",
      "javascript",
      "java"
    ]
  },
  "servers": [
    {
      "url": "https://api.vseepreview.com/api_v3",
      "description": "Staging"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiToken": {
        "type": "apiKey",
        "in": "header",
        "name": "X-ApiToken",
        "description": "User access token obtained from login or SSO"
      },
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-ApiKey",
        "description": "API Key generated under Developers menu"
      },
      "ApiSecret": {
        "type": "apiKey",
        "in": "header",
        "name": "X-ApiSecret",
        "description": "API Secret generated under Developers menu"
      }
    },
    "parameters": {
      "AccountCode": {
        "name": "X-AccountCode",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Your VSee Clinic Account Code",
        "example": "vclinic"
      }
    },
    "schemas": {
      "IntakeObject": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "56e8c536-566c-44b6-bbca-66f0ac1f0144"
          },
          "provider_id": {
            "type": "integer",
            "example": 541
          },
          "reason_for_visit": {
            "type": "string",
            "example": "Test intake functionalities"
          },
          "type": {
            "type": "integer",
            "example": 1,
            "description": "1=walkin, 2=scheduled"
          },
          "member_id": {
            "type": "string",
            "example": "508"
          },
          "room_code": {
            "type": "string",
            "example": "ceproom1"
          },
          "location": {
            "type": "string",
            "example": "CA"
          },
          "phone": {
            "type": "string",
            "example": "7123456789"
          },
          "created": {
            "type": "integer",
            "example": 1471465080
          },
          "modified": {
            "type": "integer",
            "example": 1471465080
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                },
                "ext": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "VisitObject": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "18407167"
          },
          "member_id": {
            "type": "integer",
            "example": 17778181
          },
          "provider_id": {
            "type": "integer",
            "example": 12456470
          },
          "account_code": {
            "type": "string",
            "example": "vclinic"
          },
          "code": {
            "type": "string",
            "example": "615f2e2eabc46ad94e9b6457b11"
          },
          "room_code": {
            "type": "string",
            "example": "vclinicroom"
          },
          "start": {
            "type": "integer",
            "example": 1631628616,
            "description": "UNIX timestamp"
          },
          "end": {
            "type": "integer",
            "example": 1631628916,
            "description": "UNIX timestamp"
          },
          "actual_start": {
            "type": "integer",
            "example": 1631628211,
            "description": "UNIX timestamp"
          },
          "actual_end": {
            "type": "integer",
            "example": null,
            "description": "UNIX timestamp"
          },
          "type": {
            "type": "integer",
            "example": 2,
            "description": "1=walkin, 2=scheduled, 3=e-consult"
          },
          "status": {
            "type": "integer",
            "example": 30,
            "description": "Visit status code"
          },
          "created": {
            "type": "integer",
            "example": 1633627694
          },
          "modified": {
            "type": "integer",
            "example": 1633630312
          },
          "payment": {
            "type": "object",
            "properties": {
              "duration": {
                "type": "integer"
              },
              "amount": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          "intake_id": {
            "type": "string",
            "example": "615f2de7-8ab8-48d3-80d8-53f564457b11"
          },
          "intake": {
            "type": "object",
            "properties": {
              "provider_id": {
                "type": "string"
              },
              "member_id": {
                "type": "string"
              },
              "room_code": {
                "type": "string"
              },
              "location": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "reason_for_visit": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          "provider": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "full_name": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            }
          },
          "member": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "full_name": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              }
            }
          }
        }
      },
      "AvailabilitySlot": {
        "type": "object",
        "properties": {
          "slot_id": {
            "type": "string",
            "example": "10996909"
          },
          "slot_start": {
            "type": "integer",
            "example": 1669239900,
            "description": "UNIX timestamp"
          },
          "slot_end": {
            "type": "integer",
            "example": 1669240800,
            "description": "UNIX timestamp"
          },
          "slot_booked": {
            "type": "integer",
            "example": 0
          },
          "slot_available": {
            "type": "integer",
            "example": 1
          },
          "group_id": {
            "type": "string",
            "example": "637e920e-bd34-4d3f-82c0-804b0adc0a9f"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "Unauthorized"
          },
          "message": {
            "type": "string",
            "example": "Invalid or missing API token"
          }
        }
      }
    }
  },
  "paths": {
    "/intakes": {
      "post": {
        "tags": [
          "Intakes"
        ],
        "summary": "Create intake data object",
        "description": "Create a new intake object. Supports custom JSON field-value pairs.",
        "operationId": "createIntake",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "provider_id",
            "in": "query",
            "description": "The ID of the provider who is being visited (optional)",
            "schema": {
              "type": "integer"
            },
            "example": 541
          },
          {
            "name": "reason_for_visit",
            "in": "query",
            "description": "Reason for visit (optional)",
            "schema": {
              "type": "string"
            },
            "example": "Test intake functionalities"
          },
          {
            "name": "type",
            "in": "query",
            "description": "Visit type: 1=walkin, 2=schedule (optional)",
            "schema": {
              "type": "integer"
            },
            "example": 1
          },
          {
            "name": "member_id",
            "in": "query",
            "description": "Patient's code ID (optional)",
            "schema": {
              "type": "string"
            },
            "example": "508"
          },
          {
            "name": "room_code",
            "in": "query",
            "required": true,
            "description": "Room's code",
            "schema": {
              "type": "string"
            },
            "example": "ceproom1"
          },
          {
            "name": "location",
            "in": "query",
            "description": "State location code like CA, AL (optional)",
            "schema": {
              "type": "string"
            },
            "example": "CA"
          },
          {
            "name": "phone",
            "in": "query",
            "description": "Patient phone number (optional)",
            "schema": {
              "type": "string"
            },
            "example": "7123465789"
          }
        ],
        "requestBody": {
          "description": "Custom parameters can be sent as JSON",
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Intake created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Basic intake": {
                    "summary": "Create basic intake",
                    "value": {
                      "data": {
                        "id": "56e8c536-566c-44b6-bbca-66f0ac1f0144"
                      }
                    }
                  },
                  "Intake with custom fields": {
                    "summary": "Create intake with custom parameters",
                    "value": {
                      "data": {
                        "id": "56e8c536-566c-44b6-bbca-66f0ac1f0144",
                        "custom_is_allergic": "Yes",
                        "custom_symptoms": "Rash, Red Eyes",
                        "custom_symptoms_duration": "2 weeks"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/intakes/{id}": {
      "post": {
        "tags": [
          "Intakes"
        ],
        "summary": "Update intake data object",
        "description": "Update an existing intake object",
        "operationId": "updateIntake",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Intake ID",
            "schema": {
              "type": "string"
            },
            "example": "57a0705e-1c4c-4f24-b51d-3c71ac1f0144"
          },
          {
            "name": "provider_id",
            "in": "query",
            "description": "The ID of the provider (optional)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "reason_for_visit",
            "in": "query",
            "description": "Reason for visit (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "location",
            "in": "query",
            "description": "State location code (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phone",
            "in": "query",
            "description": "Patient phone number (optional)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Intake updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Updated intake": {
                    "summary": "Intake successfully updated",
                    "value": {
                      "data": {
                        "id": "56e8c536-566c-44b6-bbca-66f0ac1f0144"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      },
      "get": {
        "tags": [
          "Intakes"
        ],
        "summary": "Get intake data object",
        "description": "Retrieve a selected intake data object",
        "operationId": "getIntake",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Intake ID",
            "schema": {
              "type": "string"
            },
            "example": "57a0705e-1c4c-4f24-b51d-3c71ac1f0144"
          }
        ],
        "responses": {
          "200": {
            "description": "Intake retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/IntakeObject"
                    }
                  }
                },
                "examples": {
                  "Intake with attachments": {
                    "summary": "Retrieve intake with attachments",
                    "value": {
                      "data": {
                        "modified": 1471465080,
                        "created": 1471465080,
                        "type": "1",
                        "reason_for_visit": "the reason",
                        "attachments": [
                          {
                            "_id": "57b4c65d-7ef8-461f-8951-43b1ac1f0144",
                            "name": "document.png",
                            "path": "files/2016/08/17/57b4c65d-7ef8-461f-8951-43b1ac1f0144.png",
                            "size": 12859,
                            "ext": "png"
                          }
                        ],
                        "id": "57b4c678-de20-4c1a-a52b-43e9ac1f0144"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/visits/add_walkin": {
      "post": {
        "tags": [
          "Walk-in Visits"
        ],
        "summary": "Create a walk-in visit",
        "description": "Create a new walk-in visit for a patient",
        "operationId": "createWalkinVisit",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "provider_id",
            "in": "query",
            "description": "The ID of the provider (optional)",
            "schema": {
              "type": "string"
            },
            "example": "826"
          },
          {
            "name": "intake_id",
            "in": "query",
            "required": true,
            "description": "The ID of the intake",
            "schema": {
              "type": "string"
            },
            "example": "57a0705e-1c4c-4f24-b51d-3c71ac1f0144"
          },
          {
            "name": "visit_data_id",
            "in": "query",
            "required": true,
            "description": "The ID of a scheduled appointment",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "visit_id",
            "in": "query",
            "description": "The ID of a scheduled appointment (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user_code",
            "in": "query",
            "description": "Patient's code ID (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "room_code",
            "in": "query",
            "required": true,
            "description": "Current room's code",
            "schema": {
              "type": "string"
            },
            "example": "ceproom1"
          }
        ],
        "responses": {
          "200": {
            "description": "Walk-in visit created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/VisitObject"
                    }
                  }
                },
                "examples": {
                  "Walk-in visit created": {
                    "summary": "Successfully created walk-in visit",
                    "value": {
                      "data": {
                        "id": "1525",
                        "member_id": "508",
                        "provider_id": "509",
                        "account_code": null,
                        "code": "56e8c580f55c44a2868b66f0ac1f0144",
                        "start": "1458095488",
                        "end": "1458096388",
                        "type": "1",
                        "status": "10",
                        "room_id": null,
                        "intake": {
                          "provider": "509",
                          "reason_for_visit": "Test intake functionalities 1",
                          "type": "1",
                          "visit_id": "1525",
                          "id": "56e8c536-566c-44b6-bbca-66f0ac1f0144"
                        },
                        "provider": {
                          "id": "509",
                          "first_name": "Ligeng",
                          "last_name": "Doctor"
                        },
                        "member": {
                          "id": "508",
                          "first_name": "Ligeng",
                          "last_name": "01"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/visits/add_econsult": {
      "post": {
        "tags": [
          "E-consult Visits"
        ],
        "summary": "Create an asynchronous e-consult visit",
        "description": "Create an asynchronous e-consult. The e-consult will be created without scheduling, and providers will see it on their dashboards to accept.",
        "operationId": "createEconsult",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "intake_id",
                  "room_code"
                ],
                "properties": {
                  "intake_id": {
                    "type": "string",
                    "example": "6050d1a8-b120-45b4-a568-61a664457b11",
                    "description": "The ID of the intake"
                  },
                  "room_code": {
                    "type": "string",
                    "example": "vclinic_room_code",
                    "description": "Room code (required)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "E-consult created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/VisitObject"
                    }
                  }
                },
                "examples": {
                  "E-consult created": {
                    "summary": "Successfully created e-consult visit",
                    "value": {
                      "data": {
                        "incharge": false,
                        "isEditExpired": false,
                        "id": "14814100",
                        "member_id": 14396847,
                        "provider_id": 0,
                        "account_code": "vclinic",
                        "code": "6050d2e590d847429d312c8664457b11",
                        "start": 1615909605,
                        "end": 1615910505,
                        "type": 3,
                        "status": 20,
                        "room_id": 10019500,
                        "room_code": "vclinic_room_code",
                        "member": {
                          "id": "14396847",
                          "code": "member_01",
                          "first_name": "Ligeng",
                          "last_name": "Member 01"
                        },
                        "intake": {
                          "reason_for_visit": "This is to test the API",
                          "question_1": "Answer 1",
                          "question_2": "Answer 2",
                          "id": "6050d1a8-b120-45b4-a568-61a664457b11"
                        },
                        "account": {
                          "code": "vclinic",
                          "name": "VClinic"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/availability": {
      "get": {
        "tags": [
          "Appointments"
        ],
        "summary": "Get provider's available slots",
        "description": "Retrieve available appointment slots for providers based on search criteria",
        "operationId": "getAvailability",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "room_code",
            "in": "query",
            "description": "Room code (optional if using intake_id)",
            "schema": {
              "type": "string"
            },
            "example": "xxxx"
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "description": "UNIX timestamp - search for available slots from this start time",
            "schema": {
              "type": "integer"
            },
            "example": 1668129300
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "description": "UNIX timestamp - search for available slots up to this end time",
            "schema": {
              "type": "integer"
            },
            "example": 1670000000
          },
          {
            "name": "duration",
            "in": "query",
            "description": "Duration in seconds - search for available slots during this duration (optional)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "description": "Provider ID - pick only this provider's slots (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "intake_id",
            "in": "query",
            "description": "Intake ID - should be passed when patient is choosing a slot (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "consultation_id",
            "in": "query",
            "description": "Consultation ID - helps determine slot duration (optional)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "location",
            "in": "query",
            "description": "Location code like AL, CA (optional - for filtering by state)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Available slots retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "slots": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AvailabilitySlot"
                          }
                        },
                        "slot_data": {
                          "type": "object"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Available slots": {
                    "summary": "List of available appointment slots",
                    "value": {
                      "data": {
                        "slots": [
                          {
                            "slot_id": "10996909",
                            "slot_start": 1669239900,
                            "slot_end": 1669240800,
                            "slot_booked": 0,
                            "slot_available": 1,
                            "group_id": "637e920e-bd34-4d3f-82c0-804b0adc0a9f"
                          },
                          {
                            "slot_id": "10996909",
                            "slot_start": 1669240800,
                            "slot_end": 1669241700,
                            "slot_booked": 0,
                            "slot_available": 1,
                            "group_id": "637e920e-bd34-4d3f-82c0-804b0adc0a9f"
                          }
                        ],
                        "slot_data": {
                          "10996909": {
                            "id": "10996909",
                            "provider_id": "12456470",
                            "account_code": "carebyte",
                            "start": "1669239900",
                            "end": "1669243500",
                            "group_id": "637e920e-bd34-4d3f-82c0-804b0adc0a9f",
                            "status": "10",
                            "consultation": {
                              "duration": 15,
                              "slots": 1
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/visits": {
      "post": {
        "tags": [
          "Appointments"
        ],
        "summary": "Create an appointment",
        "description": "Create a new scheduled appointment for a patient with a provider",
        "operationId": "createAppointment",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "member_id",
            "in": "query",
            "description": "The ID of the visiting patient (optional)",
            "schema": {
              "type": "string"
            },
            "example": "575"
          },
          {
            "name": "slot_start",
            "in": "query",
            "required": true,
            "description": "UNIX timestamp of appointment beginning",
            "schema": {
              "type": "integer"
            },
            "example": 1470669300
          },
          {
            "name": "slot_end",
            "in": "query",
            "required": true,
            "description": "UNIX timestamp of appointment ending",
            "schema": {
              "type": "integer"
            },
            "example": 1470670200
          },
          {
            "name": "room_code",
            "in": "query",
            "required": true,
            "description": "Room code (required)",
            "schema": {
              "type": "string"
            },
            "example": "vclinicroom"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Visit type: 2=scheduling",
            "schema": {
              "type": "integer"
            },
            "example": 2
          },
          {
            "name": "intake_id",
            "in": "query",
            "required": true,
            "description": "The ID of the intake",
            "schema": {
              "type": "string"
            },
            "example": "57a0705e-1c4c-4f24-b51d-3c71ac1f0144"
          },
          {
            "name": "provider_id",
            "in": "query",
            "description": "The ID of the provider (optional)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Appointment created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/VisitObject"
                    }
                  }
                },
                "examples": {
                  "Appointment created": {
                    "summary": "Successfully created appointment",
                    "value": {
                      "data": {
                        "member_id": 17778181,
                        "provider_id": 12456470,
                        "account_code": "vclinic",
                        "code": "615f2e2eabc46ad94e9b6457b11",
                        "start": 1631628616,
                        "end": 1631628916,
                        "type": 2,
                        "status": 30,
                        "room_code": "vclinicroom",
                        "created": 1633627694,
                        "modified": 1633630312,
                        "provider": {
                          "id": "12456470",
                          "email": "doctor@vseelab.com",
                          "full_name": "Dr. Anton Provider"
                        },
                        "member": {
                          "id": "17778181",
                          "email": "patient@vseelab.com",
                          "full_name": "Anton Test"
                        },
                        "intake_id": "615f2de7-8ab8-48d3-80d8-53f564457b11"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      },
      "get": {
        "tags": [
          "Appointments"
        ],
        "summary": "List visits",
        "description": "Get the visits list of the patient. Upcoming appointments have start > current timestamp.",
        "operationId": "listVisits",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "room_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter visits by room code"
          },
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Filter visits starting after this UNIX timestamp"
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Filter visits ending before this UNIX timestamp"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by visit status. Values: 10 (Pending), 20 (Confirmed), 25 (In-progress), 30 (Completed), 40 (Cancelled)"
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated field names to return. Include `recordings` to receive recording objects for each visit."
          },
          {
            "name": "with_recordings_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1
              ]
            },
            "description": "Set to `1` to filter out visits without recordings. When `fields` includes `recordings`, this flag includes the recordings object in each visit."
          }
        ],
        "responses": {
          "200": {
            "description": "Visits list retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/VisitObject"
                      }
                    }
                  }
                },
                "examples": {
                  "Visits list": {
                    "summary": "List of patient visits",
                    "value": {
                      "data": [
                        {
                          "id": "7727",
                          "member_id": "575",
                          "provider_id": "1096",
                          "account_code": "vclinic",
                          "code": "57a07c26947c4544aeef4e5cac1f0144",
                          "start": "1470669300",
                          "end": "1470670200",
                          "type": "2",
                          "status": "20",
                          "created": 1470135334,
                          "modified": 1470135334,
                          "provider": {
                            "id": "1096",
                            "first_name": "Anton",
                            "last_name": "Provider III"
                          },
                          "member": {
                            "id": "575",
                            "first_name": "Keven2",
                            "last_name": "Teodoro2"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/visits/{id}": {
      "get": {
        "tags": [
          "Appointments"
        ],
        "summary": "Get visit detail",
        "description": "Get detailed information for a specific visit or appointment\n\nReturns full visit details including members, intake data, meeting info, and (optionally) recordings.",
        "operationId": "getVisit",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Visit ID",
            "schema": {
              "type": "string"
            },
            "example": "7727"
          }
        ],
        "responses": {
          "200": {
            "description": "Visit details retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/VisitObject"
                    }
                  }
                },
                "examples": {
                  "Visit details": {
                    "summary": "Complete visit information",
                    "value": {
                      "data": {
                        "id": "18407167",
                        "member_id": 17778181,
                        "provider_id": 12456470,
                        "account_code": "vclinic",
                        "code": "615f2e2eabc46ad94e9b6457b11",
                        "start": 1631628616,
                        "end": 1631628916,
                        "actual_start": 1631628211,
                        "type": 2,
                        "status": 30,
                        "room_code": "vclinicroom",
                        "created": 1633627694,
                        "modified": 1633630312,
                        "provider": {
                          "id": "12456470",
                          "email": "doctor@vseelab.com",
                          "full_name": "Dr. Anton Provider"
                        },
                        "member": {
                          "id": "17778181",
                          "email": "patient@vseelab.com",
                          "full_name": "Anton Test",
                          "phone": "5551231122"
                        },
                        "intake": {
                          "provider_id": "12456470",
                          "member_id": "17778181",
                          "room_code": "vclinicroom",
                          "reason_for_visit": "Follow-up consultation"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      },
      "post": {
        "tags": [
          "Appointments"
        ],
        "summary": "Update an appointment",
        "description": "Update an existing appointment (e.g., change time or provider)",
        "operationId": "updateVisit",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Visit ID",
            "schema": {
              "type": "string"
            },
            "example": "666"
          },
          {
            "name": "version",
            "in": "query",
            "description": "API version - use 2 for update operations",
            "schema": {
              "type": "integer"
            },
            "example": 2
          },
          {
            "name": "slot_start",
            "in": "query",
            "description": "UNIX timestamp of new appointment start (optional)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "slot_end",
            "in": "query",
            "description": "UNIX timestamp of new appointment end (optional)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "description": "New provider ID (optional). Set to 0 to remove provider.",
            "schema": {
              "type": "string"
            },
            "example": "566"
          }
        ],
        "responses": {
          "200": {
            "description": "Visit updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/VisitObject"
                    }
                  }
                },
                "examples": {
                  "Visit updated": {
                    "summary": "Successfully updated appointment",
                    "value": {
                      "data": {
                        "member_id": 567,
                        "provider_id": 566,
                        "account_code": "vclinic",
                        "code": "615f2e2eabc46ad94e9b6457b11",
                        "start": 1631628616,
                        "end": 1631628916,
                        "type": 2,
                        "status": 30
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/visits/close": {
      "post": {
        "tags": [
          "Appointments"
        ],
        "summary": "Close or cancel a visit",
        "description": "Close, cancel, or end a visit or appointment",
        "operationId": "closeVisit",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "The ID of the visit/appointment",
            "schema": {
              "type": "string"
            },
            "example": "14"
          },
          {
            "name": "reason",
            "in": "query",
            "description": "Reason for closing. Options: patient_end_call, patient_exit_room, call_ended, patient_cancel_appointment, max_waiting_time_reached",
            "schema": {
              "type": "string"
            },
            "example": "patient_end_call"
          }
        ],
        "responses": {
          "200": {
            "description": "Visit closed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Visit closed": {
                    "summary": "Successfully closed visit",
                    "value": {
                      "data": {
                        "id": "1525"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/visits/delete": {
      "post": {
        "tags": [
          "Appointments"
        ],
        "summary": "Force cancel a visit",
        "description": "Force cancel an existing visit. Requires admin token.",
        "operationId": "deleteVisit",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "The ID of the visit/appointment",
            "schema": {
              "type": "string"
            },
            "example": "5010007042332"
          }
        ],
        "responses": {
          "200": {
            "description": "Visit deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  }
                },
                "examples": {
                  "Visit deleted": {
                    "summary": "Successfully deleted visit",
                    "value": {
                      "data": {}
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "admin-token"
      }
    },
    "/visits/current": {
      "get": {
        "tags": [
          "Appointments"
        ],
        "summary": "Get current visit in progress",
        "description": "Get the visit that is currently in progress for the authenticated user",
        "operationId": "getCurrentVisit",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          }
        ],
        "responses": {
          "200": {
            "description": "Current visit retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/VisitObject"
                    }
                  }
                },
                "examples": {
                  "Current visit": {
                    "summary": "Active visit in progress",
                    "value": {
                      "data": {
                        "id": "1504",
                        "member_id": "508",
                        "provider_id": "509",
                        "account_code": "fruitstreet",
                        "code": "56e7b1d2b90c4d68953e3d02ac1f0144",
                        "start": "1459973100",
                        "end": "1459974000",
                        "type": "2",
                        "status": "40",
                        "completed_by": "508",
                        "created": 1458024914,
                        "modified": 1458024914,
                        "intake": {
                          "provider": "509",
                          "reason_for_visit": "Test intake functionalities",
                          "type": "1",
                          "id": "56e7b104-ded0-4096-979b-395bac1f0144"
                        },
                        "provider": {
                          "id": "509",
                          "first_name": "Ligeng",
                          "last_name": "Doctor"
                        },
                        "member": {
                          "id": "508",
                          "first_name": "Ligeng",
                          "last_name": "01"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/visits/{id}/exports/visit_summary": {
      "get": {
        "tags": [
          "Visit Export"
        ],
        "summary": "Export visit summary",
        "description": "Retrieve a PDF visit summary for a specific visit",
        "operationId": "exportVisitSummary",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Visit ID",
            "schema": {
              "type": "string"
            },
            "example": "1000000"
          }
        ],
        "responses": {
          "200": {
            "description": "Visit summary exported successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "URL to download the PDF summary"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Export URL": {
                    "summary": "URL to visit summary PDF",
                    "value": {
                      "data": {
                        "url": "https://clinic.vsee.me/visits/exports/d6880792f1fa01xxxxx"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    }
  },
  "tags": [
    {
      "name": "Intakes",
      "description": "Manage patient intake data and forms"
    },
    {
      "name": "Walk-in Visits",
      "description": "Create and manage walk-in visits"
    },
    {
      "name": "E-consult Visits",
      "description": "Create and manage asynchronous e-consult visits"
    },
    {
      "name": "Appointments",
      "description": "Manage appointments, availability, and scheduling"
    },
    {
      "name": "Visit Export",
      "description": "Export visit summaries and reports"
    }
  ]
}