Direct Implementation Guide: Xtime API Extraction for Retell AI
Integration
Vault - The Unsealed Depository
1 Core Objective
To bypass the Xtime GUI and programmatically schedule service appointments via a Retell AI Voice Agent.
This requires a full mapping of the Xtime REST headers, payload schemas, and state transitions.
2 Postman Collection Mapping: Logic Flow
2.1 Phase 1: Customer Identification (The Fork)
The system must differentiate between a new and returning user to determine the payload structure for the final
booking.
• Existing User Path:
1 GET / api / v2 / dealers /{ dealerId }/ customers ? query ={ phone_number }
2 // Result : Returns customerId and array of vehicleId
• New User Path:
1 GET / api / v2 / vehicles / years
2 GET / api / v2 / vehicles /{ year }/ makes
3 // Result : Requires full manual construction of Vehicle Object
2.2 Phase 2: Availability & Service Mapping
• Endpoint: POST /api/v2/dealers/dealerId/availability
• Payload: Must include opCodes[] (e.g., ”LOF” for Oil Change) and transportationOption.
• Response: A flat list of startDateTime strings.
3 Implementation: [Link] + Supabase + Retell
3.1 The Middleware Logic
The [Link] route /api/schedule-xtime performs the following linear actions:
1. Receive transcript or tool call from Retell.
2. Query Supabase to find the dealerId for the specific phone number the agent is calling for.
3. Execute the Reverse Engineered Xtime sequence:
• Lookup Customer → Select/Create Vehicle → Fetch Slots → Final Book.
4. Comfim the booking to Retell to be spoken to the user.
1
4 The Reverse Engineering Task List
• Task 1: Use a proxy to intercept the X-AUTH-TOKEN or Cookie patterns used by mcgovernsubaruofac-
[Link].
• Task 2: Map the JSON payload for POST /api/v2/appointments. This is the ”God Request” that
finalizes the schedule.
• Task 3: Build the Postman collection with tests that verify if a customerId exists before attempting a
customer/create call.
5 Final Architecture Formula
Appointment = Retell(V oice) → N extJS(M appingLogic) → Xtime(EndpointInjection)