Cancel a single booking and request its refund
const url = 'https://quikstik-core.fly.dev/cancellations';const options = { method: 'POST', headers: { 'x-tenant-id': '2489E9AD-2EE2-8E00-8EC9-32D5F69181C0', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"obligation_ref":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","reason":"operator_trip_cancelled","effective_date":{"year":1,"month":1,"day":1}}'};
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://quikstik-core.fly.dev/cancellations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'x-tenant-id: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \ --data '{ "obligation_ref": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "reason": "operator_trip_cancelled", "effective_date": { "year": 1, "month": 1, "day": 1 } }'Cancels one booking, addressed by its obligation_ref, and enqueues the refund for the
ledger to settle asynchronously — the refund is not settled inline. The
durable effect is one transaction: the booking’s status flips to cancelled, its capacity is
released, and a cancellation.requested event is enqueued. Idempotent: a cancellation
moves money, so an Idempotency-Key is required (400 without one) and a retry with the same
key is a no-op. This slice issues a full refund for both reasons; the customer-initiated
time-to-departure partial schedule arrives later. Fail-closed: 503 when no backend is wired.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Tenant identifier (UUID).
Authn/authz semantics are intentionally TBD for this contract slice; this header exists to keep the contract explicitly multi-tenant from day 0.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The booking/obligation being cancelled.
Why it is being cancelled. Reason-coded because it governs financial treatment over the cancellation arc (an operator trip cancellation is always a full refund).
Business/effective date of the cancellation, for period close.
object
Responses
Section titled “Responses”Cancellation accepted; refund enqueued for asynchronous settlement
object
The lifecycle status the booking transitions to.
The refund has been enqueued for the ledger to settle asynchronously; it is not settled inline.
Example
{ "status": "cancelled"}Malformed body, or missing idempotency key (a money move must be idempotent)
object
Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).
Example
{ "reason": "sold_out"}Missing or invalid session bearer token
object
Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).
Example
{ "reason": "sold_out"}The session’s effect authority does not cover this operation
object
Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).
Example
{ "reason": "sold_out"}No durable backend is wired for this operation (fail-closed)
object
Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).
Example
{ "reason": "sold_out"}