Square: Cancel Booking
Square bookings.cancelBooking: arguments, response, policy and SDK examples.
← Bookings operations · Get started
Operation square.cancelbooking
Provider route: POST /v2/bookings/{booking_id}/cancel. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/square with npm, or alter-sdk-square with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { SquareIntegration } from "@alter-ai/square";
async function execute(input: Parameters<SquareIntegration["bookings"]["cancelBooking"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new SquareIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.bookings.cancelBooking(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_square import SquareIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = SquareIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.bookings.cancel_booking(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.booking_id | string | Required within parent | |
body | Model | Required within parent | Expand Cancel Booking — request body — body |
Referenced models: Cancel Booking — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Cancel Booking — response body |
Referenced models: Cancel Booking — response body
Schemas
Section titled “Schemas”4 more schemas are linked from the tables above, on the schema pages.
Cancel Booking — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
booking_version | JSON | Optional | |
booking_version (anyOf 1) | integer | Alternative | The revision number for the booking used for optimistic concurrency. |
booking_version (anyOf 2) | null | Alternative | |
idempotency_key | JSON | Optional | |
idempotency_key (anyOf 1) | string | Alternative | A unique key to make this request an idempotent operation. Maximum length: 255 |
idempotency_key (anyOf 2) | null | Alternative |
Cancel Booking — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
booking | Model | Optional | Expand Cancel Booking — response body — booking The booking that was cancelled. |
errors | array | Optional | Errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
Referenced models: Cancel Booking — response body — booking, Get Shift — response body — errors item
Cancel Booking — response body — booking
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service at a given location to a requesting customer in one or more appointment segments. |
address | JSON | Optional | |
address (anyOf 1) | Model | Alternative | Expand Get Payment — response body — payment billing address Stores a customer address if the location type is `CUSTOMER_LOCATION`. |
address (anyOf 2) | null | Alternative | |
all_day | boolean | Optional | Whether the booking is of a full business day. Read only: true |
appointment_segments | JSON | Optional | |
appointment_segments (anyOf 1) | array | Alternative | A list of appointment segments for this booking. |
appointment_segments (anyOf 1)[] | Model | Each item | Expand Cancel Booking — response body — booking appointment segments A list of appointment segments for this booking item |
appointment_segments (anyOf 2) | null | Alternative | |
created_at | string | Optional | The RFC 3339 timestamp specifying the creation time of this booking. Read only: true |
creator_details | Model | Optional | Expand Cancel Booking — response body — booking creator details Information about the booking creator. Read only: true |
customer_id | JSON | Optional | |
customer_id (anyOf 1) | string | Alternative | The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service. Maximum length: 192 |
customer_id (anyOf 2) | null | Alternative | |
customer_note | JSON | Optional | |
customer_note (anyOf 1) | string | Alternative | The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](entity:CatalogObject) instance. Maximum length: 4096 |
customer_note (anyOf 2) | null | Alternative | |
id | string | Optional | A unique ID of this object representing a booking. Maximum length: 36 Read only: true |
location_id | JSON | Optional | |
location_id (anyOf 1) | string | Alternative | The ID of the [Location](entity:Location) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed. Maximum length: 32 |
location_id (anyOf 2) | null | Alternative | |
location_type | JSON | Optional | |
location_type (anyOf 1) | string | Alternative | Supported types of location where service is provided. The type of location where the booking is held. See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values Known values: BUSINESS_LOCATION, CUSTOMER_LOCATION, PHONE |
location_type (anyOf 2) | null | Alternative | |
seller_note | JSON | Optional | |
seller_note (anyOf 1) | string | Alternative | The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](entity:CatalogObject) instance. This field should not be visible to customers. Maximum length: 4096 |
seller_note (anyOf 2) | null | Alternative | |
source | string | Optional | Supported sources a booking was created from. The source of the booking. Access to this field requires seller-level permissions. See [BookingBookingSource](#type-bookingbookingsource) for possible values Known values: FIRST_PARTY_MERCHANT, FIRST_PARTY_BUYER, THIRD_PARTY_BUYER, API Read only: true |
start_at | JSON | Optional | |
start_at (anyOf 1) | string | Alternative | The RFC 3339 timestamp specifying the starting time of this booking. |
start_at (anyOf 2) | null | Alternative | |
status | string | Optional | Supported booking statuses. The status of the booking, describing where the booking stands with respect to the booking state machine. See [BookingStatus](#type-bookingstatus) for possible values Known values: PENDING, CANCELLED_BY_CUSTOMER, CANCELLED_BY_SELLER, DECLINED, ACCEPTED, NO_SHOW Read only: true |
transition_time_minutes | JSON | Optional | |
transition_time_minutes (anyOf 1) | integer | Alternative | Additional time at the end of a booking. Applications should not make this field visible to customers of a seller. Read only: true |
transition_time_minutes (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
updated_at | string | Optional | The RFC 3339 timestamp specifying the most recent update time of this booking. Read only: true |
version | JSON | Optional | |
version (anyOf 1) | integer | Alternative | The revision number for the booking used for optimistic concurrency. |
version (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Referenced models: Get Payment — response body — payment billing address, Cancel Booking — response body — booking appointment segments A list of appointment segments for this booking item, Cancel Booking — response body — booking creator details
Get Shift — response body — errors item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an error encountered during a request to the Connect API. See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. |
category | string | Required within parent | Indicates which high-level category of error has occurred during a request to the Connect API. The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values Known values: API_ERROR, AUTHENTICATION_ERROR, INVALID_REQUEST_ERROR, RATE_LIMIT_ERROR, PAYMENT_METHOD_ERROR, REFUND_ERROR, MERCHANT_SUBSCRIPTION_ERROR, EXTERNAL_VENDOR_ERROR |
code | Model | Required within parent | Expand Get Shift — response body — errors item code The specific code of the error. See [ErrorCode](#type-errorcode) for possible values |
detail | string | Optional | A human-readable description of the error for debugging purposes. |
field | string | Optional | The name of the field provided in the original request (if any) that the error pertains to. |
Referenced models: Get Shift — response body — errors item code
Cancel Booking — response body — booking appointment segments A list of appointment segments for this booking item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines an appointment segment of a booking. |
any_team_member | boolean | Optional | Whether the customer accepts any team member, instead of a specific one, to serve this segment. Read only: true |
duration_minutes | JSON | Optional | |
duration_minutes (anyOf 1) | JSON | Alternative | |
duration_minutes (anyOf 1) (anyOf 1) | integer | Alternative | The time span in minutes of an appointment segment. Maximum: 1500 |
duration_minutes (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
duration_minutes (anyOf 2) | null | Alternative | |
intermission_minutes | JSON | Optional | |
intermission_minutes (anyOf 1) | integer | Alternative | Time between the end of this segment and the beginning of the subsequent segment. Read only: true |
intermission_minutes (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resource_ids | array | Optional | The IDs of the seller-accessible resources used for this appointment segment. Read only: true |
resource_ids[] | string | Each item | |
service_variation_id | JSON | Optional | |
service_variation_id (anyOf 1) | string | Alternative | The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. Maximum length: 36 |
service_variation_id (anyOf 2) | null | Alternative | |
service_variation_version | JSON | Optional | |
service_variation_version (anyOf 1) | JSON | Alternative | |
service_variation_version (anyOf 1) (anyOf 1) | integer | Alternative | The current version of the item variation representing the service booked in this segment. Format: int64 |
service_variation_version (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
service_variation_version (anyOf 2) | null | Alternative | |
team_member_id | string | Required within parent | The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment. Maximum length: 32 Minimum length: 1 |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.cancelbooking. Catalog operation: CancelBooking. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["APPOINTMENTS_WRITE"]
Pinned headers: {"Square-Version": "2026-11-18"}