Available from CaptainBook CLI API spec 1.53.0.
Two fields, not one
GET /products/{id} returns both:
Field | Meaning |
|---|---|
| What the operator configured: |
| Whether a booking may actually span resources right now. |
They differ behind four account- and product-level gates that all degrade silently. spans_several_resources is the value every pricing, capacity and channel read goes through, so that is the one to branch on.
allocation_mode is null only on the unsaved preview a dry_run create returns. A persisted product always has a value.
Never price a party from allocation_mode
On a per-group-priced product, the number of units a party takes is the number of groups it pays for. Five riders across three jet skis pay three times. A party that spans nothing pays once.
If spans_several_resources is false while allocation_mode is homogeneous_multi, the configuration is not being honoured and the product is pricing as a single-resource product.
Writing it
PATCH /products/{id} is the only endpoint that writes it.
POST /products and POST /products/bookable refuse the field with a 422. A spanning mode needs a fleet to span, and a product created in one call has no schedules yet. The sequence is:
POST /productscreate its schedules
attach two or more assets with a capacity each to one schedule
PATCH /products/{id}withallocation_mode: homogeneous_multi
Refusals
homogeneous_multi is refused with a 422 that names which gate refused it. The error lands under error.details.allocation_mode.
Gate | Fixable by the caller |
|---|---|
The | No. Not self-serve. The operator must contact CaptainBook support. Do not retry. |
The product sets a shared | Yes. Send |
A schedule gives a capacity to a guide or a piece of equipment | Yes. Remove that capacity first. |
The Payroll app is installed and a schedule has several guides | No, short of restructuring the crew. |
No schedule carries two or more capacity-bearing assets | Yes. Attach the fleet. |
Two behaviours worth relying on:
single_resourceis never refused. A product can always be moved back off a spanning mode.Echoing the stored value is not a change and runs none of the gates. A read-modify-write round trip is never refused over this field, even on a product whose mode a gate now blocks.
Sending a capacity above 0 that starts sharing is judged, because that is the same downgrade reached through the other field. The pair is judged on the state the product will be in, so {allocation_mode, capacity} sent together is refused if the capacity would still be sharing. Lowering or clearing a capacity is never judged.
Side effect: channel capacity is republished
Changing the effective mode republishes the product's capacity to every connected channel, because the figure a channel publishes is chosen by the mode: the sum of free seats across the fleet for a spanning product, the largest single free unit otherwise.
Changing capacity does the same. Nothing else about the product changes and no departure is rewritten.
Pricing categories
Two fields on a pricing category only mean anything on a product that spreads a party:
max_per_resource(1 to 99, null for no limit): how many guests of this category one resource may carry.1for a Driver per jet ski.companions[].same_resource: whether the companions must sit on every resource carrying this category, rather than merely be in the booking.
Both are writable through create_pricing_category and update_pricing_category. companions replaces every link; [] clears them; omitting it leaves them unchanged. A link sent without same_resource keeps its stored value.
Related
Multi-resource bookings: letting one booking take several units
Pricing a fleet
