curl --request POST \
--url https://api.example.com/api/time-blocks \
--header 'Content-Type: application/json' \
--data '
{
"doctorId": 123,
"startTime": "<string>",
"endTime": "<string>"
}
'{
"id": 123,
"doctorId": 123,
"startTime": "<string>",
"endTime": "<string>",
"date": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}curl --request POST \
--url https://api.example.com/api/time-blocks \
--header 'Content-Type: application/json' \
--data '
{
"doctorId": 123,
"startTime": "<string>",
"endTime": "<string>"
}
'{
"id": 123,
"doctorId": 123,
"startTime": "<string>",
"endTime": "<string>",
"date": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}Authorization: Bearer <token>
doctor - Can create time blocks for themselves (doctorId auto-assigned)admin - Can create time blocks for any doctor (must specify doctorId)YYYY-MM-DDTHH:mm:ss.sssZExample: 2026-03-15T09:00:00.000ZYYYY-MM-DDTHH:mm:ss.sssZValidation: Must be greater than startTimeExample: 2026-03-15T10:00:00.000Z{
"error": "Validation failed",
"details": [
"startTime must be a valid ISO 8601 date",
"endTime must be greater than startTime"
]
}
{
"error": "Unauthorized"
}
{
"error": "Forbidden"
}
{
"error": "Time block already exists"
}
curl -X POST https://api.example.com/api/time-blocks \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"startTime": "2026-03-15T09:00:00.000Z",
"endTime": "2026-03-15T10:00:00.000Z"
}'
curl -X POST https://api.example.com/api/time-blocks \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"doctorId": 5,
"startTime": "2026-03-15T09:00:00.000Z",
"endTime": "2026-03-15T10:00:00.000Z"
}'
{
"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"
}
doctorId, startTime, and endTime