Skip to content

Mutation

bookActivityTime

bookActivityTime(activity: EntityRef!, startAt: DateTime!, endAt: DateTime!, 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. 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 top of a paid booking's service price; it is added after tax, ignored for free / package-covered bookings, and excluded from both the tax base and the platform-fee base.

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!
endAtDateTime!
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!, $buyer: BuyerInput, $formData: [RegistrationDataInput!], $productPurchase: EntityRef, $tipAmount: Int, $emailMarketingConsent: Boolean, $attribution: AttributionInput) {
  bookActivityTime(activity: $activity, startAt: $startAt, endAt: $endAt, buyer: $buyer, formData: $formData, productPurchase: $productPurchase, tipAmount: $tipAmount, emailMarketingConsent: $emailMarketingConsent, attribution: $attribution) {
    __typename
  }
}
Variables
{}
POST https://go.sessions.website/api/graphql