# Create Service Appointments

Show your users the details of a service appointment—an appointment booked through Salesforce Scheduler—so that users can review and create the appointment.

1. Create a page where the user can review the appointment details and create the appointment.

2. Make a `POST` request on the [`service-appointments`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_service_appointments.htm) Connect API to create the service appointment.

   **Resource URI**

   ```nolang
   https://YOUR_INSTANCE.salesforce.com/services/data/v68.0/connect/scheduling/service-appointments
   ```

   Where `YOUR_INSTANCE` is a variable.

   **For an Existing User (Account)**

   **Sample Request**

   Pass the account ID as `parentRecordId` in the input request body.

   To indicate that the appointment is scheduled, set `status` to `Scheduled`.

   ```nolang
   {
     "serviceAppointment": {
       "serviceTerritoryId": "0HhS700000001DYKAY",
       "parentRecordId": "001S7000001pFlJIAU",
       "engagementChannelTypeId": "0eFS70000004CG5MAM",
       "schedStartTime": "2023-02-15T17:00:00.000+0000",
       "schedEndTime": "2023-02-15T18:00:00.000+0000",
       "street": "121 Spear Street",
       "city": "Charlotte",
       "state": "VT",
       "postalCode": "05445",
       "country": "United States",
       "extendedFields": [
         {
           "name": "status",
           "value": "Scheduled"
         }
       ]
     },
     "assignedResources": [
       {
         "serviceResourceId": "0HnS700000002jAKAQ",
         "isRequiredResource": true
       }
     ]
   }
   ```

   **Sample Response**

   The API returns the service appointment ID and the assigned service resources.

   ```nolang
   {
     "result": {
       "assignedResourceIds": [
         "03rS700000000hPIAQ"
       ],
       "serviceAppointmentId": "08pS7000000018wIAA"
     }
   }
   ```

   **For a Guest User (Lead)**

   **Sample Request**

   Pass the required lead details in the input request body.

   To indicate that the appointment is scheduled, set `status` to `Scheduled`.

   ```nolang

   {
     "serviceAppointment": {
       "serviceTerritoryId": "0HhS700000001DYKAY",
       "engagementChannelTypeId": "0eFS70000004CG5MAM",
       "schedStartTime": "2023-02-15T17:00:00.000+0000",
       "schedEndTime": "2023-02-15T18:00:00.000+0000",
       "street": "121 Spear Street",
       "city": "Charlotte",
       "state": "VT",
       "postalCode": "05445",
       "country": "United States",
       "extendedFields": [
         {
           "name": "status",
           "value": "Scheduled"
         }
       ]
     },
     "assignedResources": [
       {
         "serviceResourceId": "0HnS700000002jAKAQ",
         "isRequiredResource": true
       }
     ],
     "lead": {
       "firstName": "Mark",
       "lastName": "Taylor",
       "phone": "012-345-6789",
       "email": "mtaylor@company.com",
       "company": "Company1"
     }
   }
   ```

   **Sample Response**

   The API returns the service appointment ID and the assigned service resources.

   ```nolang

   {
     "result": {
       "assignedResourceIds": [
         "03rS700000000hUIAQ"
       ],
       "parentRecordId": "00QS7000000sfbOMAQ",
       "serviceAppointmentId": "08pS70000000191IAA"
     }
   }
   ```

Create a page to show confirmation when the service appointment is created successfully.

Here’s how a sample confirmation page can look.

![A representation of the confirmation screen.](https://a.sfdcstatic.com/developer-website/sfdocs/service-cloud/media/salesforce-scheduler-dev-guide/screen_appointment_creation.png)
