> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morf.health/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Booking

> Event payload details and trigger documentation for Booking data from Square

<img src="https://mintlify.s3.us-west-1.amazonaws.com/morfhealth/images/square.svg" alt="images/square.svg" />

# Events

## Triggering Webhook Types

The following event types are associated with the Booking event payload from Square.

* `Square Booking Created`
* `Square Booking Updated`

<RequestExample>
  ```json Example theme={null}
  {
    "address": {
      "address_line_1": "1600 Pennsylvania Ave NW",
      "administrative_district_level_1": "DC",
      "locality": "Washington",
      "postal_code": "20500"
    },
    "all_day": false,
    "appointment_segments": [
      {
        "any_team_member": false,
        "duration_minutes": 30,
        "intermission_minutes": 0,
        "service_variation_client_id": "ZX7D4N2DOGPUGV4XZP7TAGU4",
        "service_variation_id": "T3WUWYFJOVW2EU6XGRU5YG4A",
        "service_variation_version": 1605808735978,
        "team_member_id": "_4GsfYnqGHyurOwzWdKj"
      }
    ],
    "created_at": "2020-12-08T19:56:53Z",
    "creator_details": {
      "creator_type": "TEAM_MEMBER",
      "team_member_id": "TM6aa35Z_aE_yl8n"
    },
    "customer_id": "SSKBT02ECWZXK6W3VWYC78E52R",
    "customer_note": "Please call before arriving",
    "id": "i2id2g3enyspi7",
    "location_id": "L9R0X9X5SGDBJ",
    "location_type": "BUSINESS_LOCATION",
    "seller_note": "Returning customer",
    "source": "FIRST_PARTY_MERCHANT",
    "start_at": "2020-12-17T16:00:00Z",
    "status": "ACCEPTED",
    "transition_time_minutes": 0,
    "updated_at": "2020-12-08T19:56:53Z",
    "version": 0
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Description theme={null}
  {
    "address": {
      "address_line_1": "First line of the address",
      "administrative_district_level_1": "State or province abbreviation",
      "locality": "City",
      "postal_code": "ZIP or postal code"
    },
    "all_day": "Whether the booking spans the entire day",
    "appointment_segments": {
      "any_team_member": "Whether any available team member can fulfill this segment",
      "duration_minutes": "Duration of the appointment segment in minutes",
      "intermission_minutes": "Minutes of intermission between this segment and the next",
      "service_variation_client_id": "Client-provided ID for the service variation",
      "service_variation_id": "ID of the catalog item variation representing the service",
      "service_variation_version": "Version of the catalog item variation at the time of booking",
      "team_member_id": "ID of the team member booked for this segment"
    },
    "created_at": "When the booking was created",
    "creator_details": {
      "creator_type": "Type of entity that created the booking (e.g. TEAM_MEMBER, CUSTOMER)",
      "team_member_id": "ID of the team member who created the booking, if applicable"
    },
    "customer_id": "ID of the customer who made the booking",
    "customer_note": "Free-text note from the customer",
    "id": "Unique identifier for the booking",
    "location_id": "ID of the location where the service is provided",
    "location_type": "Type of location for the booking (e.g. BUSINESS_LOCATION, CUSTOMER_LOCATION)",
    "seller_note": "Free-text note from the seller (not visible to customers)",
    "source": "Source that created the booking (e.g. FIRST_PARTY_MERCHANT, FIRST_PARTY_BUYER)",
    "start_at": "Start time of the booking",
    "status": "Status of the booking (e.g. ACCEPTED, CANCELLED_BY_CUSTOMER)",
    "transition_time_minutes": "Buffer time in minutes before the next booking",
    "updated_at": "When the booking was last updated",
    "version": "Revision number for optimistic concurrency control"
  }
  ```
</ResponseExample>

### Payload Field Details

<ResponseField name="Booking" type="Event Payload">
  <Expandable title="fields" defaultOpen="true">
    <ResponseField name="id" type="string" required>
      Unique identifier for the booking

      ```json CEL theme={null}
      id
      ```

      ```json Example theme={null}
      "i2id2g3enyspi7"
      ```
    </ResponseField>

    <ResponseField name="status" type="string" required>
      Status of the booking (e.g. ACCEPTED, CANCELLED\_BY\_CUSTOMER)

      ```json CEL theme={null}
      status
      ```

      ```json Example theme={null}
      "ACCEPTED"
      ```
    </ResponseField>

    <ResponseField name="customer_id" type="string">
      ID of the customer who made the booking

      ```json CEL theme={null}
      customer_id
      ```

      ```json Example theme={null}
      "SSKBT02ECWZXK6W3VWYC78E52R"
      ```
    </ResponseField>

    <ResponseField name="customer_note" type="string">
      Free-text note from the customer

      ```json CEL theme={null}
      customer_note
      ```

      ```json Example theme={null}
      "Please call before arriving"
      ```
    </ResponseField>

    <ResponseField name="seller_note" type="string">
      Free-text note from the seller (not visible to customers)

      ```json CEL theme={null}
      seller_note
      ```

      ```json Example theme={null}
      "Returning customer"
      ```
    </ResponseField>

    <ResponseField name="location_id" type="string">
      ID of the location where the service is provided

      ```json CEL theme={null}
      location_id
      ```

      ```json Example theme={null}
      "L9R0X9X5SGDBJ"
      ```
    </ResponseField>

    <ResponseField name="start_at" type="timing.v1.Timestamp">
      Start time of the booking

      ```json CEL theme={null}
      start_at
      ```

      ```json Example theme={null}
      "2020-12-17T16:00:00Z"
      ```
    </ResponseField>

    <ResponseField name="created_at" type="timing.v1.Timestamp" required>
      When the booking was created

      ```json CEL theme={null}
      created_at
      ```

      ```json Example theme={null}
      "2020-12-08T19:56:53Z"
      ```
    </ResponseField>

    <ResponseField name="updated_at" type="timing.v1.Timestamp" required>
      When the booking was last updated

      ```json CEL theme={null}
      updated_at
      ```

      ```json Example theme={null}
      "2020-12-08T19:56:53Z"
      ```
    </ResponseField>

    <ResponseField name="version" type="int64" required>
      Revision number for optimistic concurrency control

      ```json CEL theme={null}
      version
      ```

      ```json Example theme={null}
      0
      ```
    </ResponseField>

    <ResponseField name="appointment_segments" type="[]object" required>
      List of appointment segments for this booking

      ```json CEL theme={null}
      appointment_segments
      ```

      ```json Example theme={null}
      [
      {
      "any_team_member": false,
      "duration_minutes": 30,
      "intermission_minutes": 0,
      "service_variation_client_id": "ZX7D4N2DOGPUGV4XZP7TAGU4",
      "service_variation_id": "T3WUWYFJOVW2EU6XGRU5YG4A",
      "service_variation_version": 1605808735978,
      "team_member_id": "_4GsfYnqGHyurOwzWdKj"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="appointment_segments.map(x, x.service_variation_id)" type="[]string" required>
      Mapped array of: ID of the catalog item variation representing the service

      ```json CEL theme={null}
      appointment_segments.map(x, x.service_variation_id)
      ```

      ```json Example theme={null}
      [
      "T3WUWYFJOVW2EU6XGRU5YG4A"
      ]
      ```
    </ResponseField>

    <ResponseField name="appointment_segments.map(x, x.team_member_id)" type="[]string" required>
      Mapped array of: ID of the team member booked for this segment

      ```json CEL theme={null}
      appointment_segments.map(x, x.team_member_id)
      ```

      ```json Example theme={null}
      [
      "_4GsfYnqGHyurOwzWdKj"
      ]
      ```
    </ResponseField>

    <ResponseField name="appointment_segments.map(x, x.duration_minutes)" type="[]int64" required>
      Mapped array of: Duration of the appointment segment in minutes

      ```json CEL theme={null}
      appointment_segments.map(x, x.duration_minutes)
      ```

      ```json Example theme={null}
      [
      30
      ]
      ```
    </ResponseField>

    <ResponseField name="appointment_segments.map(x, x.service_variation_version)" type="[]int64" required>
      Mapped array of: Version of the catalog item variation at the time of booking

      ```json CEL theme={null}
      appointment_segments.map(x, x.service_variation_version)
      ```

      ```json Example theme={null}
      [
      1605808735978
      ]
      ```
    </ResponseField>

    <ResponseField name="appointment_segments.map(x, x.any_team_member)" type="[]bool" required>
      Mapped array of: Whether any available team member can fulfill this segment

      ```json CEL theme={null}
      appointment_segments.map(x, x.any_team_member)
      ```

      ```json Example theme={null}
      [
      false
      ]
      ```
    </ResponseField>

    <ResponseField name="appointment_segments.map(x, x.intermission_minutes)" type="[]int64" required>
      Mapped array of: Minutes of intermission between this segment and the next

      ```json CEL theme={null}
      appointment_segments.map(x, x.intermission_minutes)
      ```

      ```json Example theme={null}
      [
      0
      ]
      ```
    </ResponseField>

    <ResponseField name="appointment_segments.map(x, x.service_variation_client_id)" type="[]string" required>
      Mapped array of: Client-provided ID for the service variation

      ```json CEL theme={null}
      appointment_segments.map(x, x.service_variation_client_id)
      ```

      ```json Example theme={null}
      [
      "ZX7D4N2DOGPUGV4XZP7TAGU4"
      ]
      ```
    </ResponseField>

    <ResponseField name="address" type="object">
      Address of the booking location

      ```json CEL theme={null}
      address
      ```

      ```json Example theme={null}
      {
      "address_line_1": "1600 Pennsylvania Ave NW",
      "administrative_district_level_1": "DC",
      "locality": "Washington",
      "postal_code": "20500"
      }
      ```
    </ResponseField>

    <ResponseField name="address.address_line_1" type="string">
      First line of the address

      ```json CEL theme={null}
      address.address_line_1
      ```

      ```json Example theme={null}
      "1600 Pennsylvania Ave NW"
      ```
    </ResponseField>

    <ResponseField name="address.administrative_district_level_1" type="string">
      State or province abbreviation

      ```json CEL theme={null}
      address.administrative_district_level_1
      ```

      ```json Example theme={null}
      "DC"
      ```
    </ResponseField>

    <ResponseField name="address.locality" type="string">
      City

      ```json CEL theme={null}
      address.locality
      ```

      ```json Example theme={null}
      "Washington"
      ```
    </ResponseField>

    <ResponseField name="address.postal_code" type="string">
      ZIP or postal code

      ```json CEL theme={null}
      address.postal_code
      ```

      ```json Example theme={null}
      "20500"
      ```
    </ResponseField>

    <ResponseField name="all_day" type="bool">
      Whether the booking spans the entire day

      ```json CEL theme={null}
      all_day
      ```

      ```json Example theme={null}
      false
      ```
    </ResponseField>

    <ResponseField name="creator_details" type="object">
      Details about who created the booking

      ```json CEL theme={null}
      creator_details
      ```

      ```json Example theme={null}
      {
      "creator_type": "TEAM_MEMBER",
      "team_member_id": "TM6aa35Z_aE_yl8n"
      }
      ```
    </ResponseField>

    <ResponseField name="creator_details.creator_type" type="string">
      Type of entity that created the booking (e.g. TEAM\_MEMBER, CUSTOMER)

      ```json CEL theme={null}
      creator_details.creator_type
      ```

      ```json Example theme={null}
      "TEAM_MEMBER"
      ```
    </ResponseField>

    <ResponseField name="creator_details.team_member_id" type="string">
      ID of the team member who created the booking, if applicable

      ```json CEL theme={null}
      creator_details.team_member_id
      ```

      ```json Example theme={null}
      "TM6aa35Z_aE_yl8n"
      ```
    </ResponseField>

    <ResponseField name="location_type" type="string">
      Type of location for the booking (e.g. BUSINESS\_LOCATION, CUSTOMER\_LOCATION)

      ```json CEL theme={null}
      location_type
      ```

      ```json Example theme={null}
      "BUSINESS_LOCATION"
      ```
    </ResponseField>

    <ResponseField name="source" type="string">
      Source that created the booking (e.g. FIRST\_PARTY\_MERCHANT, FIRST\_PARTY\_BUYER)

      ```json CEL theme={null}
      source
      ```

      ```json Example theme={null}
      "FIRST_PARTY_MERCHANT"
      ```
    </ResponseField>

    <ResponseField name="transition_time_minutes" type="int64">
      Buffer time in minutes before the next booking

      ```json CEL theme={null}
      transition_time_minutes
      ```

      ```json Example theme={null}
      0
      ```
    </ResponseField>
  </Expandable>
</ResponseField>
