curl --request GET \
--url https://api.example.com/api/time-blocks/:id{
"id": 123,
"doctorId": 123,
"startTime": "<string>",
"endTime": "<string>",
"date": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"doctor": {},
"appointment": {}
}curl --request GET \
--url https://api.example.com/api/time-blocks/:id{
"id": 123,
"doctorId": 123,
"startTime": "<string>",
"endTime": "<string>",
"date": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"doctor": {},
"appointment": {}
}Authorization: Bearer <token>
doctor - Can view their own time blocksadmin - Can view any time block42{
"error": "Unauthorized"
}
{
"error": "Forbidden"
}
{
"error": "TimeBlock not found"
}
curl -X GET https://api.example.com/api/time-blocks/42 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"id": 42,
"doctorId": 5,
"startTime": "2026-03-15T09:00:00.000Z",
"endTime": "2026-03-15T10:00:00.000Z",
"date": "2026-03-03T10:30:00.000Z",
"createdAt": "2026-03-03T10:30:00.000Z",
"updatedAt": "2026-03-03T10:30:00.000Z",
"appointment": null
}
{
"id": 42,
"doctorId": 5,
"startTime": "2026-03-15T09:00:00.000Z",
"endTime": "2026-03-15T10:00:00.000Z",
"date": "2026-03-03T10:30:00.000Z",
"createdAt": "2026-03-03T10:30:00.000Z",
"updatedAt": "2026-03-03T10:30:00.000Z",
"appointment": {
"id": 15,
"patientId": 8,
"doctorId": 5,
"status": "CONFIRMED",
"reason": "Annual checkup",
"notes": "Patient has been fasting"
}
}
appointment: null indicates it’s available for booking