# Schedule Appointment Flow URL: https://developers.vsee.com/guides/clinickit/schedule-appointment A patient logs in and schedules a new appointment. This flow uses the iOS ClinicKit APIs. For Android, see the [Android Schedule Appointment Flow](https://developers.vsee.com/guides/clinickit/android-schedule-appointment). ### Precondition - The user has logged in with a valid username and password. ### Use case steps #### User login The app starts the login process. Call `userLogin` with the user's credentials: ```swift public func userLogin(userName: String, password: String, success: @escaping() -> Void, failure: @escaping (Error) -> Void) { // Perform the login process with the provided username and password. } ``` Handle the success and failure cases. ![Login](https://developers.vsee.com/images/guides/clinickit/schedule-appointment/login.png) #### Create intake information with IntakeConfig Define an `IntakeConfig` with the relevant information: ```swift let intakeConfig = IntakeConfig(reasonForVisit: "Routine check-up") ``` Use `VisitService` to create the intake with that configuration: ```swift VisitService.shared.createIntake(with: intakeConfig, success: { intake // Store the intake to update later }, failure: { error in // Handle the failure to create the intake. }) ``` ![Intake](https://developers.vsee.com/images/guides/clinickit/schedule-appointment/intake.png) #### Get the list of consultation types Get the consultation types for the current room: ```swift public func getConsultationList() throws -> [Consultation] ``` ![Select a consultation](https://developers.vsee.com/images/guides/clinickit/schedule-appointment/select-consultation.png) #### Select a consultation type and update the intake Choose a consultation type from the list, then update the intake you created with it: ```swift VisitService.shared.updateIntakeWithConsultation(intake: Intake, consultation: Consultation, success: @escaping () -> Void, failure: @escaping (Error) -> Void) ``` #### Get available room slots for the updated intake Use the updated intake to get the available room slots for each day: ```swift VisitService.shared.getRoomSlotAvailableFrom(date: Date, provider: Provider?, intake: Intake, success: @escaping ([RoomSlot]) -> Void, failure: @escaping (Error) -> Void) ``` ![Select a slot](https://developers.vsee.com/images/guides/clinickit/schedule-appointment/select-slot.png) #### Select a room slot and schedule the visit Choose a slot from the available ones. Schedule the visit with the intake, the provider (if any), and the slot: ```swift VisitService.shared.scheduleVisit(intake: Intake, provider: Provider?, slot: RoomSlot, success: @escaping (Visit?) -> Void, failure: @escaping (Error?) -> Void) ``` Handle the success and failure cases. ![Appointment confirmed](https://developers.vsee.com/images/guides/clinickit/schedule-appointment/confirmed.png) With these steps, a patient can log in and schedule a new appointment based on their preferences and the available slots. ### Try the API calls interactively The [Appointment Scheduling](https://developers.vsee.com/use-cases/appointment-scheduling) use case walks through the same flow with live API calls.