Skip to content

Cancel a single booking and request its refund

POST
/cancellations
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.

x-tenant-id
required
string format: uuid

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.

Media typeapplication/json
object
obligation_ref
required

The booking/obligation being cancelled.

string format: uuid
reason
required

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).

string
Allowed values: operator_trip_cancelled customer_initiated
effective_date
required

Business/effective date of the cancellation, for period close.

object
year
required
integer format: int32
month
required
integer
>= 1 <= 12
day
required
integer
>= 1 <= 31

Cancellation accepted; refund enqueued for asynchronous settlement

Media typeapplication/json
object
obligation_ref
required
string format: uuid
status
required

The lifecycle status the booking transitions to.

string
Allowed values: cancelled
refund_requested
required

The refund has been enqueued for the ledger to settle asynchronously; it is not settled inline.

boolean

Example

{
"status": "cancelled"
}

Malformed body, or missing idempotency key (a money move must be idempotent)

Media typeapplication/json
object
reason
required

Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).

string

Example

{
"reason": "sold_out"
}

Missing or invalid session bearer token

Media typeapplication/json
object
reason
required

Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).

string

Example

{
"reason": "sold_out"
}

The session’s effect authority does not cover this operation

Media typeapplication/json
object
reason
required

Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).

string

Example

{
"reason": "sold_out"
}

No durable backend is wired for this operation (fail-closed)

Media typeapplication/json
object
reason
required

Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).

string

Example

{
"reason": "sold_out"
}