Overview
The Appointments API allows you to create, manage, and track veterinary appointments with intelligent scheduling and triage integration.
The Appointment Object
Unique identifier for the appointment
Pet’s name (denormalized for performance)
ID of the assigned veterinarian
Appointment type: wellness, urgent, emergency, dental, surgery, grooming, follow_up
List of reported symptoms
Triage urgency: emergency, urgent, routine, info
Appointment date (YYYY-MM-DD)
Expected duration in minutes
Status: pending, scheduled, confirmed, checked_in, in_progress, completed, cancelled, no_show, rescheduled
Internal appointment notes
Diagnosis (filled after appointment)
Follow-up appointment date
Associated voice call ID (if booked via AI)
Whether confirmation was sent
Whether 24h reminder was sent
Whether 2h reminder was sent
List Appointments
curl -X GET "http://localhost:3000/api/appointments?date=2024-12-15&status=confirmed" \
-H "Authorization: Bearer $TOKEN"
Query Parameters
Filter by date (YYYY-MM-DD)
Get appointments for specific pet
Get appointments for specific owner
Response
[
{
"id": "appt-001",
"petId": "pet-123",
"petName": "Buddy",
"ownerId": "owner-456",
"ownerName": "John Smith",
"vetId": "vet-001",
"type": "wellness",
"reason": "Annual checkup and vaccinations",
"symptoms": [],
"triageLevel": "routine",
"scheduledDate": "2024-12-15",
"scheduledTime": "10:00",
"durationMinutes": 30,
"status": "confirmed",
"notes": "First visit with Dr. Chen",
"confirmationSent": true,
"reminder24hSent": true,
"reminder2hSent": false,
"createdAt": "2024-12-01T09:30:00Z",
"updatedAt": "2024-12-14T08:00:00Z"
}
]
Get Appointment by ID
curl -X GET http://localhost:3000/api/appointments/appt-001 \
-H "Authorization: Bearer $TOKEN"
Create Appointment
curl -X POST http://localhost:3000/api/appointments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"petId": "pet-123",
"petName": "Buddy",
"ownerId": "owner-456",
"ownerName": "John Smith",
"vetId": "vet-001",
"type": "urgent",
"reason": "Vomiting and lethargy",
"symptoms": ["vomiting", "lethargy"],
"triageLevel": "urgent",
"scheduledDate": "2024-12-16",
"scheduledTime": "14:30",
"durationMinutes": 45
}'
Request Body
Update Appointment
curl -X PATCH http://localhost:3000/api/appointments/appt-001 \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "completed",
"diagnosis": "Gastroenteritis",
"treatmentNotes": "Administered anti-nausea medication. Prescribed bland diet for 3 days.",
"prescriptions": ["Cerenia 16mg - 1 tablet daily for 3 days"]
}'
Delete Appointment
curl -X DELETE http://localhost:3000/api/appointments/appt-001 \
-H "Authorization: Bearer $TOKEN"
Search Available Slots
Find available appointment slots:
curl -X GET "http://localhost:3000/api/slots?date=2024-12-16&urgency=urgent&species=dog" \
-H "Authorization: Bearer $TOKEN"
Query Parameters
Preferred date (YYYY-MM-DD)
Urgency level (emergency, urgent, routine)
Pet species (for specialized vets)
Response
[
{
"vetId": "vet-001",
"vetName": "Dr. Sarah Chen",
"date": "2024-12-16",
"time": "14:30",
"type": "urgent"
},
{
"vetId": "vet-001",
"vetName": "Dr. Sarah Chen",
"date": "2024-12-16",
"time": "15:00",
"type": "urgent"
}
]
Appointment Workflow Example
import { appointmentsApi, slotsApi } from '@/lib/api';
// 1. Find available slots
const slots = await slotsApi.search({
date: '2024-12-16',
urgency: 'urgent'
});
if (slots.length === 0) {
console.log('No slots available');
return;
}
// 2. Book the first available slot
const appointment = await appointmentsApi.create({
petId: 'pet-123',
petName: 'Buddy',
ownerId: 'owner-456',
ownerName: 'John Smith',
vetId: slots[0].vetId,
type: 'urgent',
reason: 'Vomiting',
symptoms: ['vomiting', 'lethargy'],
triageLevel: 'urgent',
scheduledDate: slots[0].date,
scheduledTime: slots[0].time,
durationMinutes: 30
});
console.log('Appointment booked:', appointment.id);
// 3. Update status when client arrives
await appointmentsApi.update(appointment.id, {
status: 'checked_in'
});
// 4. Mark in progress during examination
await appointmentsApi.update(appointment.id, {
status: 'in_progress'
});
// 5. Complete with diagnosis and treatment
await appointmentsApi.update(appointment.id, {
status: 'completed',
diagnosis: 'Gastroenteritis',
treatmentNotes: 'Prescribed bland diet and anti-nausea medication',
prescriptions: ['Cerenia 16mg'],
followUpDate: '2024-12-23'
});