---
schema_version: "1"
id: 9cea17e061d19cdf130fd619946bb354fba42ebf86ca276b4acd85ec0dc733c7
title: Create Service Appointments
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/salesforce-scheduler-dev-guide/guides/salesforce-scheduler/uc2-create-anonymous-appointment.md
canonical_url: https://developer.salesforce.com/docs/service/salesforce-scheduler-dev-guide/guide/uc2-create-anonymous-appointment.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9c59fc3afdd7a66dcfd3fd16a2262422a39288842f6a82d7c099bdf758ce3251
products:
  - Salesforce Scheduler Developer Guide
  - Service Cloud Developer Content
---

# Create Service Appointments

A service appointment represents an appointment booked through Salesforce Scheduler. Make a POST request on the `service-appointments` Connect API to create the appointment.

1.  Create a page where the user can review the appointment details and create the appointment. Here’s how a Review Service Appointment page can look.

    **note:** To keep the service resource private, hide the resource’s name on the review appointment page.

    ![A representation of the Review Service Appointment screen.](https://developer.salesforce.com/media/salesforce-scheduler-dev-guide/screen_review_anonymous_appointment.png)

2.  Link the Next button to 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://yourInstance.salesforce.com/services/data/vXX.X/connect/scheduling/service-appointments
    ```

    **For an Existing User (Account)**

    **Sample Request**

    Pass the account ID as `parentRecordId` in the input request body.

    Set `IsAnonymousBooking` to `true` to indicate that the appointment is anonymous.

    ```nolang
    {
       "serviceAppointment": {
          "serviceTerritoryId": "0HhS700000001DYKAY",
          "parentRecordId" : "001S7000001pFlJIAU", 
          "schedStartTime" : "2023-11-29T20:00:00.000Z",
          "schedEndTime": "2023-11-29T21:00:00.000Z",
          "street": "121 Spear Street",
          "city": "Charlotte",
          "state": "VT",
          "postalCode": "05445",
          "country": "United States",
          "engagementChannelTypeId" : "0eFS70000004CG5MAM",
          "extendedFields" : [ {
            "name": "IsAnonymousBooking", 
            "value": "true"
          } ]
       },
       "assignedResources": [
          {
            "serviceResourceId": "0HnS700000002jAKAQ",
            "isRequiredResource": true,
            "extendedFields" : []
          }
       ]
    }
    ```

    **Sample Response**

    The API returns the service appointment ID and the assigned service resources.

    ```nolang
    {
      "result" : {
        "assignedResourceIds" : [ "03rS700000000oMIAQ" ],
        "serviceAppointmentId" : "08pS700000001G3IAI"
      }
    }
    ```

    **For a Guest User (Lead)**

    **Sample Request**

    Pass the required lead details in the input request body.

    Set `IsAnonymousBooking` to `true` to indicate that the appointment is anonymous.

    ```nolang
    {
       "serviceAppointment": {
          "serviceTerritoryId": "0HhS700000001DYKAY",
          "schedStartTime" : "2023-11-29T22:15:00.000Z",
          "schedEndTime": "2023-11-29T23:15:00.000Z",
          "street": "121 Spear Street",
          "city": "Charlotte",
          "state": "VT",
          "postalCode": "05445",
          "country": "United States",
          "engagementChannelTypeId" : "0eFS70000004CG5MAM",
          "extendedFields" : [ {
            "name": "IsAnonymousBooking", 
            "value": "true"
          } ]
       },
       "assignedResources": [
          {
            "serviceResourceId": "0HnS700000002jGKAQ",
            "isRequiredResource": true,
            "extendedFields" : []
          }
       ],
        "lead": {
            "firstName": "Tom",
            "lastName": "Smith",
            "phone": "(555) 555-1234",
            "email": "info@salesforce.com",
            "company": "MedLife, Inc.",
            "extendedFields" : []
       }
    }
    ```

    **Sample Response**

    The API returns the service appointment ID and the assigned service resources.

    ```nolang
    {
      "result" : {
        "assignedResourceIds" : [ "03rS700000000oRIAQ" ],
        "parentRecordId" : "00QS7000000sfcnMAA",
        "serviceAppointmentId" : "08pS700000001G8IAI"
      }
    }
    ```


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://developer.salesforce.com/media/salesforce-scheduler-dev-guide/screen_appointment_creation.png)

