Run night audit
const url = 'https://api.aerandil.com/v1/actions/hospitality.action.run_night_audit/apply';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"branch":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","params":{"accrue_commission":true,"balance_packages":true,"business_date":"2026-04-15","enforce_deposits":true,"expire_waitlist":true,"open_next":true,"post_no_show_fees":true,"post_room_and_tax":true,"release_block_cutoffs":true,"retire_expired_cards":true,"strip_visitor_keys":true,"sweep_no_shows":true},"return_modified":false,"target":{"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","object_type":"hospitality.property"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.aerandil.com/v1/actions/hospitality.action.run_night_audit/apply \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "branch": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "params": { "accrue_commission": true, "balance_packages": true, "business_date": "2026-04-15", "enforce_deposits": true, "expire_waitlist": true, "open_next": true, "post_no_show_fees": true, "post_room_and_tax": true, "release_block_cutoffs": true, "retire_expired_cards": true, "strip_visitor_keys": true, "sweep_no_shows": true }, "return_modified": false, "target": { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "object_type": "hospitality.property" } }'Close the property’s open business date — a real audit, not a bookkeeping stamp, and never a blocking batch: the whole run is one transaction (a failure rolls everything back and the day stays open; a re-run replays idempotently), and nothing else stops while it runs. In order: (1) sweeps the day’s unresolved arrivals to no_show through the mark_reservation_no_show path, releasing their forward room-nights — and on partially-arrived multi-room reservations cancels the individual legs that never showed, releasing theirs (disable with sweep_no_shows = false); (1a) assesses the no-show fee from the reservation’s frozen cancellation policy and posts it as a rooms-bucket no_show_fee charge, recording the amount and an assessed status on the reservation — OPERA’s Post-Revenue-To-No-Shows, and like OPERA’s it is opt-in: enable with post_no_show_fees = true. The fee carries the tax the house’s rules for a no_show_fee produce, and none where it authored none (the UK taxes it, Austria does not); a booking’s tax exemption reaches it. Assessment only; collecting the fee off-session against a stored card is a separate step, because the audit runs inside the ontology and the card rail does not; (1c) releases group-block rooms nobody picked up, per each definite block’s cutoff mode — after the no-show sweep, so a room a no-show hands back to its block is cut off the same night rather than sitting held for a day (disable with release_block_cutoffs = false); (1d) accrues commission on stays that departed today — one row per payee, with the contract that produced it frozen on the row (disable with accrue_commission = false); (1e) expires waitlist entries two business days past their requested departure — OPERA’s End-of-Day auto-delete, as a terminal status rather than a deletion, so the turnaway stays countable (disable with expire_waitlist = false); (1g) strips the booking engine’s visitor key from the offers, turnaways and reservations whose arrival night is the property’s visitor_key_grace_days past (30 unset), keeping the records — the key only joins records of one night (disable with strip_visitor_keys = false); (1h) expires payment requests still pending whose expires_at falls on or before the audited date — the pay link lapses at the close (always on; absent from the summary when none expired); (2) posts the night’s room charge to every in-house stay’s window-1 folio from its reservation_night rate — replay-safe via the charge external_ref business key, complimentary nights skipped, tax_application lines derived from the property’s active rooms tax_rule rows (inclusive rules carve out of the rate, exclusive rules join the folio debit; no rules = zero tax) — disable with post_room_and_tax = false; (2c) balances package allowances: components due on the closing date with no consumption row settle as profit — an append-only consumption row plus the package_discount_adjustment charge, replay-safe (disable with balance_packages = false); (3) counts exceptions instead of halting on them — due-outs still in house, open cashier sessions, unresolvable folios, malformed tax or package config — the OPERA halt conditions turned into a queue (the date roll never waits on a drawer); (4) mints an immutable NightAuditRun carrying posted_room_revenue, posted_room_tax, package_adjustments_posted and exception_count (re-runs create new rows, never edit); (5) closes the BusinessDate and rolls the next day open (disable with open_next = false), moving the property’s open_business_date to it — or clearing it when nothing is opened — so postings from the close on are dated to the new hotel date.
Effects: modify hospitality.property; modify hospitality.block_allocation; modify hospitality.waitlist_entry; modify hospitality.payment_request; modify hospitality.stay_offer; modify hospitality.turnaway; modify hospitality.payment_card; create hospitality.commission_detail; link hospitality.link.commission_detail_for_reservation; link hospitality.link.commission_detail_owed_to_company; link hospitality.link.commission_detail_owed_to_channel; create hospitality.night_audit_run; modify hospitality.business_date; create hospitality.business_date; modify hospitality.reservation; modify hospitality.reservation_room; modify hospitality.availability_day; create hospitality.charge; link hospitality.link.folio_has_charge; link hospitality.link.charge_at_outlet; modify hospitality.folio; create hospitality.folio; link hospitality.link.reservation_has_folio; create hospitality.tax_application; link hospitality.link.charge_has_tax_application; create hospitality.package_component_consumption; link hospitality.link.package_sale_has_consumption; link hospitality.link.consumption_for_charge; link hospitality.link.charge_attributed_to_package_sale; link hospitality.link.charge_attributed_to_package_component; modify hospitality.room_status_block; modify hospitality.room; modify hospitality.share_group; unlink hospitality.link.reservation_in_share_group; link hospitality.link.charge_for_service_item; create hospitality.payment; link hospitality.link.folio_has_payment.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Apply against an open branch’s overlay view instead of the canonical (main) plane. The action’s writes land in the branch’s copy-on-first-write overlay, its events in the branch’s own stream, and the invocation is journaled for merge-by-replay. Branch writes are action-only, so this is the write-side entry point to a branch (POST /v1/branches forks one).
object
When true, the response carries modified_objects and modified_links projections — the engine reads the event log inside the same transaction so the projection observes the handler’s own writes.
object
Responses
Section titled “Responses”Action applied. modified_objects and modified_links populated when return_modified: true was supplied.
Envelope returned by the Aerandil action engine. correlation_id ties every event emitted by this invocation; modified_objects and modified_links project the events the handler emitted (per the action’s declared effects); warnings carries any non-blocking soft-validator observations.
object
Per-invocation correlation id; matches events.correlation_id for every event this action appended.
Links established or removed by this invocation. Empty when the caller did not request return_modified.
object
Objects created, modified, or soft-deleted by this invocation. Empty when the caller did not request return_modified.
object
Non-blocking soft-validator observations emitted during this invocation (e.g. comp-authority over-limit, recipe pour-cost over sell-price). Absent when no warnings were emitted.
object
Human-readable summary, suitable for logging or operator-UI surfacing.
Object type the warning was raised against.
Property the warning anchors to, when a single field is the locus. Absent for multi-field rules.
Stable kebab-case rule identifier (e.g. comp-authority-over-limit).
Example
{ "modified_links": [ { "kind": "linked", "link_type": "hospitality.link.commission_detail_for_reservation" } ], "modified_objects": [ { "kind": "modified", "object_type": "hospitality.property" } ]}Conflict — concurrent modification or unique constraint violation.
Validation error — parameter validation or business-rule violation.