# Appointment Scheduling URL: https://developers.vsee.io/use-cases/appointment-scheduling Log patient in using SSO, look up the room's consultation, create an intake, find an available time slot, then schedule the appointment. ## Step 1: Obtain patient access token POST /users/sso (auth: API Key + Secret) Call SSO with patient details (type=200). Use ?fields=vsee to include VSee ID and token in the response. headers: - X-ApiKey (required) — API Key - X-ApiSecret (required) — API Secret - X-AccountCode (required) — Account code queryParams: - fields — Set to 'vsee' to include VSee ID and token bodyFields: - first_name (required) — Patient's first name - last_name (required) — Patient's last name - type (required) — User type: 200 = Patient - email — Patient email address - code (required) — Unique patient identifier on your end (max 128 chars) ## Step 2: Get room information GET /rooms/{room_code} (auth: Account Code Only) Look up room details. The response's data.payment.consultations[0].id is the consultation_id used when fetching available slots. headers: - X-AccountCode (required) — Account code pathParams: - room_code (required) — Waiting room code (e.g., sandbox) ## Step 3: Create intake object POST /intakes (auth: User Token) Create an intake data object to capture the reason for visit. Uses the patient's access token from Step 1. headers: - X-ApiToken (required) — User access token from SSO response - X-AccountCode (required) — Account code bodyFields: - type (required) — Intake type (1 = standard) - room_code (required) — Room code for the waiting room - reason_for_visit — Reason for visit / chief complaint ## Step 4: Get available slots GET /availability (auth: User Token) Fetch available appointment slots for the provider. start/end are Unix timestamps. duration is in seconds (900 = 15 min). slot_start/slot_end from the first slot auto-fill into Step 5. headers: - X-ApiToken (required) — User access token from SSO response - X-AccountCode (required) — Account code queryParams: - member_id (required) — Provider's VSee member ID (auto-fills from stored Provider Member ID) - start (required) — Search window start (Unix timestamp — defaults to now) - end (required) — Search window end (Unix timestamp — defaults to now + 7 days) - duration (required) — Slot duration in seconds - consultation_id (required) — Consultation ID from Step 2 - intake_id (required) — Intake ID from Step 3 ## Step 5: Create a scheduled appointment POST /visits (auth: User Token) Create the scheduled visit. type=2 marks it as scheduled. one_time_link_token is only returned if the clinic is configured for one-time appointment links. headers: - X-ApiToken (required) — User access token from SSO response - X-AccountCode (required) — Account code bodyFields: - member_id (required) — Provider's VSee member ID (same as Step 4 — auto-fills from stored Provider Member ID) - intake_id (required) — Intake ID from Step 3 - room_code (required) — Room code - slot_start (required) — Start time from Step 4 (Unix timestamp) - slot_end (required) — End time from Step 4 (Unix timestamp) - type (required) — Visit type: 2 = scheduled ## Step 6: Build appointment link Redirect: https://{your_clinic}.vseepreview.com/members/appointment/{visit_id}?token={one_time_link_token} Uses the visit's one-time link token (not SSO token) for direct appointment access.