An API that connects multiple Microsoft services, enabling data access and automation across platforms
This might be caused by a malformed or incomplete request body. The /appointments endpoint requires a fairly strict payload, and leaving out required fields or providing mismatched IDs (like staff or service IDs that don’t exist in the business) will trigger a generic UnknownError.
Try this sample payload when creating an appointment. Replace IDs and email addresses with valid values from your Bookings business.
{
"@odata.type": "#microsoft.graph.bookingAppointment",
"customerTimeZone": "UTC",
"smsNotificationsEnabled": false,
"isLocationOnline": false,
"optOutOfCustomerEmail": false,
"serviceId": "YOUR_SERVICE_ID",
"serviceName": "Consultation",
"duration": "PT1H",
"preBuffer": "PT0M",
"postBuffer": "PT0M",
"priceType": "fixedPrice",
"startDateTime": {
"dateTime": "2026-05-01T10:00:00",
"timeZone": "UTC"
},
"endDateTime": {
"dateTime": "2026-05-01T11:00:00",
"timeZone": "UTC"
},
"staffMemberIds": [
"YOUR_STAFF_ID"
],
"customers": [
{
"@odata.type": "#microsoft.graph.bookingCustomerInformation",
"customerId": "YOUR_CUSTOMER_ID",
"name": "John Doe",
"emailAddress": "john.doe@example.com",
"phone": "1234567890",
"timeZone": "UTC"
}
]
}
If you don’t already have a customer created, you can omit customerId and just provide name and email, but the structure must still be correct.
This is a POST example in PowerShell matching your $url:
$headers = @{
Authorization = "Bearer $accessToken"
"Content-Type" = "application/json"
}
$body = @"
{
"@odata.type": "#microsoft.graph.bookingAppointment",
"customerTimeZone": "UTC",
"serviceId": "YOUR_SERVICE_ID",
"startDateTime": {
"dateTime": "2026-05-01T10:00:00",
"timeZone": "UTC"
},
"endDateTime": {
"dateTime": "2026-05-01T11:00:00",
"timeZone": "UTC"
},
"staffMemberIds": ["YOUR_STAFF_ID"],
"customers": [
{
"name": "John Doe",
"emailAddress": "john.doe@example.com"
}
]
}
"@
Invoke-RestMethod -Uri $url -Headers $headers -Method Post -Body $body
Common causes of the error you posted are invalid serviceId or staffMemberIds, mismatched time zones, using a staff member not assigned to the service, or missing required permissions such as BookingsAppointment.ReadWrite.All. Also ensure the booking business is active and the service allows scheduling.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin