Skip to content

Search guests — one result per human

GET
/guests
curl --request GET \
--url 'https://quikstik-core.fly.dev/guests?q=example&limit=20' \
--header 'Authorization: Bearer <token>' \
--header 'x-tenant-id: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0'

A guest is not a row: identity is spread across persons, booking buyers (commerce_obligations.notify_*), thread counterparties and prospects. Every hit is grouped by lower(email) — the join key — with fallbacks person:{person_id} (a person with no email) and booking:{obligation_ref} (a booking with neither). The text decides the leg: QS- + 4–8 hex digits (confirmation number) or VIA-/GET- + digits (channel code) → reference; contains @ → email (exact, case-insensitive); at least 7 digits once spaces, -, (, ), . and + are stripped → phone (suffix match, so country-code variants hit); anything else → name (person display name) and text (buyer name/email, rider names; the booking search needs 3+ characters).

bookings_count, the departure stamps and the balance count active (non-cancelled) bookings only. currency is null when the guest has no priced booking (the balance is then 0). Order: exact email/reference matches first, then next_departure_at_ms ascending (none last), then last_departure_at_ms descending. limit is clamped to 1..50.

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.

q
required
string
>= 2 characters

What the operator has — a surname, email, phone or reference. At least 2 characters.

limit
integer
default: 20

Maximum guests returned; values outside 1..50 are clamped.

The matching guests (possibly none).

Media typeapplication/json
object
guests
required
Array<object>
object
key
required

Stable id: lower-cased email, person:{uuid} or booking:{uuid}.

string
person_id
required
string format: uuid
nullable
display_name
required

Person’s name, else the most recent booking’s buyer name, else the email’s local part, else the booking reference.

string
email
required

Lower-cased join key.

string
nullable
phone
required

As the buyer gave it (newest booking with one), else a thread’s counterparty phone.

string
nullable
bookings_count
required

Active (non-cancelled) bookings.

integer format: int64
next_departure_at_ms
required

Earliest active departure at or after now.

integer format: int64
nullable
last_departure_at_ms
required

Latest active departure before now.

integer format: int64
nullable
balance_due_minor
required

Sum of gross − settled over active bookings in currency, minor units.

integer format: int64
currency
required

ISO 4217 code; null when the guest has no priced booking.

string
nullable
open_threads
required

Threads in state awaiting_us.

integer format: int64
held_sends
required

Hub sends held for a human on this guest’s threads.

integer format: int64
last_contact_at_ms
required

Latest inbound or outbound stamp across the guest’s threads.

integer format: int64
nullable
match
required

The strongest leg that found this guest.

string
Allowed values: reference email phone name text

Example

{
"guests": [
{
"match": "reference"
}
]
}

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

q is shorter than 2 characters (reason query_too_short) or limit is not an integer (reason bad_limit).

Media typeapplication/json
object
code
required

Stable machine-readable error code

string
message
required

Human-readable explanation (never leaks SQL, URLs, or secrets)

string

Example generated

{
"code": "example",
"message": "example"
}

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