Trip endpoints
Trip endpoints
Unless noted, success body is { "data": … } and the tables describe the payload inside data.
Trips
GET /api/trips
- Auth: session
- Response:
TripSummary[]— trips the user may see (member of, plus legacy/demo). See TripSummary.
POST /api/trips
- Auth: session
- Status:
201 - Body:
| Field | Type | Rules |
|---|---|---|
title | string | trim, 1–120 |
currency | string? | optional ISO-ish code, 1–8 chars |
startDate | string? | optional ISO YYYY-MM-DD |
endDate | string? | optional ISO YYYY-MM-DD (inclusive) |
dayCount | number? | optional integer 1–60 |
destination | string? | optional city/region label, 1–120 |
budgetAmount | number? | optional planned budget (positive) |
partySize | number? | optional planned party size 1–100 |
Omitted optional fields mean “TBD” in the create wizard. When any intake field
is present, the trip is created with agentSeedPending: true and an intake
object. The planner opens the agent and pre-fills a suggested @agent prompt;
the member can edit it and must explicitly send it. If destination is set and
UNSPLASH_ACCESS_KEY is configured, the
server searches Unsplash for a landscape cover and stores coverUrl. When
destination is set, the server also geocodes it via GeoService and stores
intake.destinationLat / destinationLng so the planner map can open near
that place before any stops exist.
Day rows are derived from dates / day count (defaults to one day starting
today). Day 1’s city is set from destination when provided.
- Response: full
TripDto(owner is first member).
Clients should apply the returned TripDto to the React Query cache
(setQueryData for both the trip detail and a prepended TripSummary on the
list via toTripSummary) and navigate to the planner. Do not rely on an
immediate GET /api/trips after create — Hyperdrive may serve a stale cached
SELECT for up to ~60s (same pattern as agent message echo; see
data-caching.md and
cloudflare.md).
GET /api/trips/:id
- Auth: session + member (
404if not) - Response:
TripDto
PATCH /api/trips/:id
- Auth: session + edit
- Body: one of:
{ title: string }(trim, 1–120) — rename{ clearAgentSeedPending: true }— clear the one-shot agent seed flag after the member sends the suggested prompt
- Response:
TripDto