Skip to content

Assign a unit (bike) to a rider

POST
/bookings/{booking_id}/assignments
curl --request POST \
--url https://quikstik-core.fly.dev/bookings/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/assignments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-tenant-id: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \
--data '{ "participant_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "resource_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Asserts the assigned_resource edge (closing the rider’s previous unit, if any) and puts “{unit} assigned · {rider} · {guest}” on the Heartbeat. A unit is held by one open booking per departure window: 409 {reason: unit_busy, booking_ref} names the holder. A unit that is not active is 409 unit_unavailable. The same unit again for the same rider is 200 {already: true}.

booking_id
required
string format: uuid
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
participant_id
required
string format: uuid
resource_id
required
string format: uuid

Example generated

{
"participant_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"resource_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Assigned.

Media typeapplication/json
object
assignment
required
object
participant_id
required
string format: uuid
resource_id
required
string format: uuid
unit_label
required
string
already
required
boolean

Example generated

{
"assignment": {
"participant_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"resource_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"unit_label": "example"
},
"already": true
}

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 such booking, participant_not_on_booking or unit_not_found.

unit_busy (with booking_ref), unit_unavailable, bad_transition.

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"
}