Write Restrictions of Properties over date ranges
/api/v1/restriction-batchesrestrictions.writeStores the batch and answers at once; the changes then reach ZenHost and the Sales Channels shortly after, in submission order: on a date and field, the latest batch wins and an older change not sent yet is superseded. A value equal to the current one is not sent again. A field ZenHost will not write (Manual Override, another pricing tool, a night closed by a linked Property; see unwritable_fields of GET /restrictions) is refused and reported, never forced; the rest of the batch still applies, with no rollback. Read the outcome with GET /restriction-batches/{id}. Every POST, dry_run included, counts against the submission rate limit.
Parameters
Headers
Idempotency-KeystringReplaying the same key on the same App Connection within 24 hours returns the batch it created instead of a new one. Reusing it with a different body answers
idempotency_key_reused. Ignored withdry_run.at most 255 characters
Request body
application/jsonRestrictionBatchRequest
Up to 20000 entries over at most 100 Properties (to cover more, send one batch per page of GET /properties). Dates run from today to today + 730 days, both in the time zone of each Property (its timezone).
entriesRestrictionBatchEntry[]required1 to 20000 items
Show 4 child attributesHide child attributes
property_idstring (uuid)requiredfromstring (date)requiredFirst night, inclusive.
tostring (date)requiredLast night, inclusive.
valuesRestrictionValuesrequiredThe values to write on every date of the entry; a field left out is not touched. At least one field.
Show 5 child attributesHide child attributes
ratenumberBase nightly rate, decimal, in the currency of the Property, rounded to the cent. Property Pricing Modifiers still apply on top per Sales Channel.
min 0.01 · max 99999999.99
min_stayintegerMinimum stay in nights.
min 1 · max 365
closed_to_arrivalbooleanclosed_to_departurebooleanavailabilitybooleanOpen (
true) or close (false) the night for sale. A booked night stays closed on the Sales Channels whatever this value.
dry_runbooleanWhen
true, nothing is stored or sent: the answer is200with what would change per Property.
Responses
200With dry_run: what the batch would change now.
application/jsonRestrictionBatchPreview
dry_runtruerequiredpropertiesRestrictionBatchPreviewProperty[]requiredShow 4 child attributesHide child attributes
property_idstring (uuid)requiredchangesobjectrequiredDate × field changes of this Property.
Show 4 child attributesHide child attributes
submittedintegerrequiredchangedintegerrequiredunchangedintegerrequiredrefusedintegerrequired
changedRestrictionChangePreview[]requiredEvery change that would be sent, in date order.
Show 4 child attributesHide child attributes
datestring (date)requiredfieldstringrequiredOne of:
ratemin_stayclosed_to_arrivalclosed_to_departureavailabilitycurrentnumber | boolean | nullrequiredThe value now;
nullwhen unset or not in the calendar.newnumber | boolean | nullrequired
refused_fieldsRefusedField[]requiredShow 4 child attributesHide child attributes
fieldstringrequiredOne of:
ratemin_stayclosed_to_arrivalclosed_to_departureavailabilityreasonstringrequiredOne of:
manual_overridemanaged_by_another_pricing_toolblocked_by_linked_propertyfromstring (date)requiredtostring (date)required
202The batch is stored and queued.
application/jsonRestrictionBatchAccepted
idstring (uuid)requiredstatusstringrequiredqueuedthenprocessingwhile changes wait for the Sales Channels (each Property is sent at a pace the Sales Channels accept, and retried when they are unavailable); final:completed(nothing failed),partially_failed,failed(nothing applied),cancelled.One of:
queuedprocessingcompletedpartially_failedfailedcancelled
401Error code: unauthorized, connection_revoked.
Error codes
unauthorizedThe access token is missing, unknown, expired or revoked, or was issued before the account connected the App again. Refresh it; if refreshing fails, ask the owner to connect again.connection_revokedThe owner revoked the App Connection (or your App revoked its own refresh token). Stop calling for this account and drop its tokens.
402Error code: subscription_blocked.
Error codes
subscription_blockedThe ZenHost subscription of the account is blocked (unpaid, cancelled…). The connection is kept: tell your customer, calls work again once the subscription is restored.
403Error code: app_suspended, forbidden_permission.
Error codes
app_suspendedZenHost suspended your App, or no longer allows it on this account. Stop calling and contact ZenHost.forbidden_permissionYour App was not granted the Permission this endpoint requires.
422Error code: validation_failed, property_out_of_scope, idempotency_key_reused.
Error codes
validation_failedThe query, headers or body are invalid;details.issuespoints at each problem (path,message, andmaximumwhen a value or list is too big).property_out_of_scopeA requested Property is outside the Connection Scope;details.property_idslists them.idempotency_key_reusedThisIdempotency-Keywas already used on this App Connection with a different body.
429Error code: rate_limited.
Header Retry-After — Seconds to wait before the next call is allowed. Limits per App Connection: 60 reads (GET), 10 writes (other POST) and 30 messages sent to guests per minute.
Error codes
rate_limitedToo many calls on this App Connection. Wait for the number of seconds inRetry-After.
500Error code: internal_error.
Error codes
internal_errorZenHost failed to answer. Retry later with a back-off.