Skip to content

bookActivityTime

bookActivityTime(activity: EntityRef!, startAt: DateTime!, endAt: DateTime, services: [EntityRef!], buyer: BuyerInput, formData: [RegistrationDataInput!], productPurchase: EntityRef, tipAmount: Int, emailMarketingConsent: Boolean, attribution: AttributionInput): AppointmentBookingResult!

Books an open time range on a structure: booking activity. Validates [startAt, endAt) is a contiguous run of the activity's open increments whose increment count is within [minIncrements, maxIncrements], then creates the booking — an activityId-tied appointment session + registration. Free bookings confirm immediately; activities set to request mode create a pending request the business approves or declines. Paid bookings charge bookingPricePerIncrement × increments and create the booking only once payment succeeds (via completeCheckout). buyer supplies guest details when the caller is not signed in.

productPurchase redeems one of the caller's passes/memberships (as surfaced by Activity.bookingPaymentResolution) against the booking: a pass spends the activity's creditCost (default 1) per booked increment, so a covering purchase settles the whole booking for creditCost × increments, confirming immediately via the free path — no charge, no checkout (unless a tip is added; see tipAmount). It's all-or-nothing — the purchase must belong to the buyer, be active, cover the activity, and (for a finite session count) have enough sessions for the whole booking; otherwise it's rejected and the caller pays by card.

formData carries answers to the activity's registration blocks — intake questionnaires and consent/waiver signatures collected before the appointment — persisted as block metadata + an agreement PDF on the resulting registration, exactly like registerForActivity.

tipAmount adds an optional gratuity (cents). On a paid booking it rides the same charge, added after tax; on a pass/membership-covered booking it mints a tip-only checkout instead of confirming immediately — the booking (and the pass debit) then commits only once the tip payment succeeds, so an abandoned checkout books nothing. A tip is always excluded from both the tax base and the platform-fee base, and ignored for free bookings. Tipping is per-activity — a booking activity accepts tips by default, but one whose operator turned tipping off rejects a non-zero tipAmount outright.

emailMarketingConsent records the participant's optional opt-in to the business's marketing email, exactly like registerForActivity — honoured only when the booked activity carries an emailMarketing registration block and the business has consent collection enabled.

Arguments

activityEntityRef!
startAtDateTime!

Required (and meaningful) only for a duration-priced activity, where the client chooses the range. For a services activity the end is derived server-side from the selected services and this value is ignored.

services[EntityRef!]

The selected menu services for a services-priced activity: exactly one primary service plus any add-ons. Must be omitted for duration activities.

productPurchaseEntityRef
tipAmountInt
emailMarketingConsentBoolean
attributionAttributionInput

Marketing attribution captured client-side. See registerForActivity.

Returns

AppointmentBookingResult!

See AppointmentBookingResult for the full shape.

Try it

Authentication
Example
Query
mutation BookActivityTime($activity: EntityRef!, $startAt: DateTime!, $endAt: DateTime, $services: [EntityRef!], $buyer: BuyerInput, $formData: [RegistrationDataInput!], $productPurchase: EntityRef, $tipAmount: Int, $emailMarketingConsent: Boolean, $attribution: AttributionInput) {
  bookActivityTime(activity: $activity, startAt: $startAt, endAt: $endAt, services: $services, buyer: $buyer, formData: $formData, productPurchase: $productPurchase, tipAmount: $tipAmount, emailMarketingConsent: $emailMarketingConsent, attribution: $attribution) {
    __typename
  }
}
Variables
{}
POST https://go.sessions.website/api/graphql