/v1/sites/{siteId}/bookings/{bookingId}/communication-preferencesBehavior
scope: booking affects this booking. scope: all_whatsapp withdraws or explicitly renews permission for this phone across this business. Booking-only opt-in cannot remove global withdrawal. Global resubscription requires the displayed globalVersion and fresh confirmation if it changes. A replay returns its original receipt plus current state; render current preferences, which may remain globally blocked after a later withdrawal.
Authentication
CustomerSession
Credential rules
Opaque short-lived customer session, upgraded by CRAD phone proof; neither a website account nor a cookie grants this authority. A session created with a companion integration credential remains bound to that credential: every request rechecks its expiry and revocation. Omitting or replacing the companion header later does not rebind the session. Current phone proof is required where stated by the operation. After expiry, create a new session and explicitly verify the same phone and integration to recover a known request or booking; retain the original locators and never auto-confirm during recovery.
X-CRAD-Integration-Key (optional header): Optional companion backend credential for the same integration, server requests only; never send from a browser. Required to bind an externalCustomerId on registration.
If this customer session was created with a companion integration credential, that bound credential must still grant bookings:write:customer. Its current expiry/revocation is checked as well; an unrelated key sent later does not repair the session.
Request
Idempotency and recovery
Persist one UUID and the exact request before sending. After an uncertain result, retain that UUID, body and preconditions; do not create a replacement operation just to retry.
siteIdpath · stringRequiredFormat and constraints
{ "type": "string", "format": "uuid" }bookingIdpath · stringRequiredFormat and constraints
{ "type": "string", "format": "uuid" }If-Matchheader · stringRequiredStrong preference ETag returned by notifications. Separate from appointment version.
Format and constraints
{ "type": "string", "pattern": "^\"n[1-9][0-9]*\"$" }Idempotency-Keyheader · stringRequiredPersist and reuse this exact UUID and request after an unknown result. Do not create a fresh operation to retry.
Format and constraints
{ "type": "string", "format": "uuid" }X-CRAD-Integration-Keyheader · stringOptionalOptional companion backend credential for the same integration, server requests only; never send from a browser. Required to bind an externalCustomerId on registration.
Format and constraints
{ "type": "string", "pattern": "^(?:wbi|wbm)_[a-f0-9]{64}$" }
Request body · required
application/json · NotificationPreferences
All of these schema rules apply together.
-
whatsappbooleanRequiredThe explicit customer choice. A booking-only true value does not undo an existing global withdrawal.
-
scopestringRequiredbooking changes this booking only. all_whatsapp changes global WhatsApp permission for the same phone at this business; it is not limited to this integration or booking.
Allowed values:
["booking","all_whatsapp"] -
noticeVersionstringOptionalValue:
"website-transactional-whatsapp-v1" -
expectedGlobalVersionintegerOptionalRequired only for all_whatsapp=true. Copy the current preferences.globalVersion shown to the customer; a stale value requires refresh and fresh confirmation, not an automatic retry with a newer version.
minimum:0maximum:9007199254740991 -
allOf 1unspecifiedSchema branchView branch fields and rules
-
ifobjectSchema ruleView branch fields and rules
-
whatsappbooleanCondition predicateValue:
true
-
-
thenunspecifiedSchema ruleView branch fields and rules
-
noticeVersionunspecifiedRequired in this branchPresence constraint in this rule; evaluate its enclosing condition or negation. The field’s type may be defined elsewhere.
-
-
-
allOf 2unspecifiedSchema branchView branch fields and rules
-
ifobjectSchema ruleView branch fields and rules
-
whatsappbooleanCondition predicateValue:
true -
scopestringCondition predicateValue:
"all_whatsapp"
-
-
thenunspecifiedSchema ruleView branch fields and rules
-
expectedGlobalVersionunspecifiedRequired in this branchPresence constraint in this rule; evaluate its enclosing condition or negation. The field’s type may be defined elsewhere.
-
-
elseunspecifiedSchema ruleView branch fields and rules
-
notunspecifiedSchema ruleThis rule must not match.
View branch fields and rules
-
expectedGlobalVersionunspecifiedPart of a negated rulePresence constraint in this rule; evaluate its enclosing condition or negation. The field’s type may be defined elsewhere.
-
-
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"properties": {
"whatsapp": {
"type": "boolean",
"description": "The explicit customer choice. A booking-only true value does not undo an existing global withdrawal."
},
"scope": {
"enum": [
"booking",
"all_whatsapp"
],
"description": "booking changes this booking only. all_whatsapp changes global WhatsApp permission for the same phone at this business; it is not limited to this integration or booking."
},
"noticeVersion": {
"const": "website-transactional-whatsapp-v1"
},
"expectedGlobalVersion": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Required only for all_whatsapp=true. Copy the current preferences.globalVersion shown to the customer; a stale value requires refresh and fresh confirmation, not an automatic retry with a newer version."
}
},
"required": [
"whatsapp",
"scope"
],
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"whatsapp": {
"const": true
}
},
"required": [
"whatsapp"
]
},
"then": {
"required": [
"noticeVersion"
]
}
},
{
"if": {
"properties": {
"whatsapp": {
"const": true
},
"scope": {
"const": "all_whatsapp"
}
},
"required": [
"whatsapp",
"scope"
]
},
"then": {
"required": [
"expectedGlobalVersion"
]
},
"else": {
"not": {
"required": [
"expectedGlobalVersion"
]
}
}
}
]
} Successful responses
200 · NotificationPreferenceResult
Authoritative result; notification acceptance is independent of booking success.
ETag · Strong quoted version of returned current.preferences, including on replay. It is not the version of the historical preference receipt.
{
"type": "string",
"pattern": "^\"n[1-9][0-9]*\"$"
} application/json · NotificationPreferenceResult
-
receiptallOf (object & unspecified)RequiredAll of these schema rules apply together.
View nested fields
-
allOf 1objectSchema branchView branch fields and rules
-
bookingIdstring · uuidRequired -
preferencesVersionintegerRequiredminimum:1 -
whatsappbooleanRequired -
scopestringRequiredAllowed values:
["booking","all_whatsapp"] -
additionalPropertiesno value allowedSchema rule
-
-
allOf 2unspecifiedSchema branchImmutable result of the original accepted preference operation. On replay it may differ from current consent after a later change.
-
-
currentallOf (object & unspecified)RequiredAll of these schema rules apply together.
View nested fields
-
allOf 1objectSchema branchView branch fields and rules
-
bookingIdstring · uuidRequired -
bookingVersionintegerRequiredminimum:1 -
preferencesobjectRequiredView nested fields
-
versionintegerRequiredminimum:1 -
whatsappbooleanRequired -
globallyBlockedbooleanRequired -
globalVersionintegerRequiredminimum:0maximum:9007199254740991 -
noticeVersionanyOf (string | null)RequiredAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branch -
anyOf 2nullSchema branch
-
-
additionalPropertiesno value allowedSchema rule
-
-
notificationsarrayRequiredView nested fields
-
[]objectArray itemOne logical notification. A booking can have multiple reminder entries with different offsetMinutes. The default is one reminder approximately two hours before the appointment; businesses explicitly enabled for configurable reminders may schedule up to their authorized limit of three. Confirmation, change and cancellation entries do not consume that reminder allowance. A changed appointment start has a separate allowance; returning to a previously used start does not replay an already attempted reminder. Availability depends on the deployed scheduler and the business configuration. Customer booking and communication-preference requests cannot change the business reminder limit or offsets. Businesses explicitly choose a 24-hour reminder (1440 minutes) through owner preview/apply; this is not a global default. Pending requests do not receive confirmed-appointment reminders. Proposal/rejection use separate approved templates and current opt-in.
View nested fields
-
idstring · uuidRequired -
purposestringRequiredAllowed values:
["confirmation","change","cancellation","reminder","proposal","rejection"] -
channelstringRequiredValue:
"whatsapp" -
statestringRequiredaccepted is provider acceptance, not delivery. unknown is an uncertain send outcome and is not an instruction to resend. Notification failure does not undo an accepted appointment.
Allowed values:
["not_requested","unavailable","scheduled","queued","accepted","delivered","failed","unknown","suppressed","expired"] -
reasonanyOf (string | null)RequiredAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branch -
anyOf 2nullSchema branch
-
-
dueAtstring · date-timeRequired -
offsetMinutesintegerOptionalReminder lead time in elapsed minutes, for example 1440, 480 or 60. Optional for compatibility with legacy projections; it does not indicate a customer-service messaging window.
minimum:60maximum:10080multipleOf:60 -
scheduledAtstring · date-timeOptionalSame instant as dueAt for configurable reminder entries. Legacy projections may omit this additive field.
-
updatedAtstring · date-timeRequired -
additionalPropertiesno value allowedSchema rule
-
-
-
additionalPropertiesno value allowedSchema rule
-
-
allOf 2unspecifiedSchema branchCurrent authorized notification and consent state. Use this for display after either a new operation or a replay.
-
-
replayedbooleanRequired -
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"properties": {
"receipt": {
"allOf": [
{
"type": "object",
"properties": {
"bookingId": {
"type": "string",
"format": "uuid"
},
"preferencesVersion": {
"type": "integer",
"minimum": 1
},
"whatsapp": {
"type": "boolean"
},
"scope": {
"enum": [
"booking",
"all_whatsapp"
]
}
},
"required": [
"bookingId",
"preferencesVersion",
"whatsapp",
"scope"
],
"additionalProperties": false
},
{
"description": "Immutable result of the original accepted preference operation. On replay it may differ from current consent after a later change."
}
]
},
"current": {
"allOf": [
{
"type": "object",
"properties": {
"bookingId": {
"type": "string",
"format": "uuid"
},
"bookingVersion": {
"type": "integer",
"minimum": 1
},
"preferences": {
"type": "object",
"properties": {
"version": {
"type": "integer",
"minimum": 1
},
"whatsapp": {
"type": "boolean"
},
"globallyBlocked": {
"type": "boolean"
},
"globalVersion": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"noticeVersion": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"version",
"whatsapp",
"globallyBlocked",
"globalVersion",
"noticeVersion"
],
"additionalProperties": false
},
"notifications": {
"type": "array",
"items": {
"type": "object",
"description": "One logical notification. A booking can have multiple reminder entries with different offsetMinutes. The default is one reminder approximately two hours before the appointment; businesses explicitly enabled for configurable reminders may schedule up to their authorized limit of three. Confirmation, change and cancellation entries do not consume that reminder allowance. A changed appointment start has a separate allowance; returning to a previously used start does not replay an already attempted reminder. Availability depends on the deployed scheduler and the business configuration. Customer booking and communication-preference requests cannot change the business reminder limit or offsets. Businesses explicitly choose a 24-hour reminder (1440 minutes) through owner preview/apply; this is not a global default. Pending requests do not receive confirmed-appointment reminders. Proposal/rejection use separate approved templates and current opt-in.",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"purpose": {
"enum": [
"confirmation",
"change",
"cancellation",
"reminder",
"proposal",
"rejection"
]
},
"channel": {
"const": "whatsapp"
},
"state": {
"enum": [
"not_requested",
"unavailable",
"scheduled",
"queued",
"accepted",
"delivered",
"failed",
"unknown",
"suppressed",
"expired"
],
"description": "accepted is provider acceptance, not delivery. unknown is an uncertain send outcome and is not an instruction to resend. Notification failure does not undo an accepted appointment."
},
"reason": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"dueAt": {
"type": "string",
"format": "date-time"
},
"offsetMinutes": {
"type": "integer",
"minimum": 60,
"maximum": 10080,
"multipleOf": 60,
"description": "Reminder lead time in elapsed minutes, for example 1440, 480 or 60. Optional for compatibility with legacy projections; it does not indicate a customer-service messaging window."
},
"scheduledAt": {
"type": "string",
"format": "date-time",
"description": "Same instant as dueAt for configurable reminder entries. Legacy projections may omit this additive field."
},
"updatedAt": {
"type": "string",
"format": "date-time"
}
},
"required": [
"id",
"purpose",
"channel",
"state",
"reason",
"dueAt",
"updatedAt"
],
"additionalProperties": false
}
}
},
"required": [
"bookingId",
"bookingVersion",
"preferences",
"notifications"
],
"additionalProperties": false
},
{
"description": "Current authorized notification and consent state. Use this for display after either a new operation or a replay."
}
]
},
"replayed": {
"type": "boolean"
}
},
"required": [
"receipt",
"current",
"replayed"
],
"additionalProperties": false
} Errors and recovery
Input validation
413REQUEST_TOO_LARGEThe JSON request body exceeds 8,192 bytes.
415JSON_REQUIREDSend Content-Type: application/json.
Error responses declared in the contract (10)
The preview contract shares generic error definitions across operations. This list is not an exhaustive list of runtime errors.
401 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 403 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 404 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 409 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 410 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 412 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 422 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 428 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 429 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 503 · Structured failure. Keep the same operation key if outcome is uncertain.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
}