Skip to content

Journeys API ​

A journey is a driver's existing trip. It is created by the driver, always has a driver and a vehicle, and exists whether or not anyone boards.

This is the heart of the driver experience and the structural expression of the product's core principle: a passenger request matches an existing journey, it never causes one to be created.

Endpoints ​

text
POST   /api/v1/journeys
GET    /api/v1/journeys/:id
PATCH  /api/v1/journeys/:id
GET    /api/v1/journeys
POST   /api/v1/journeys/:id/cancel
POST   /api/v1/journeys/:id/start
POST   /api/v1/journeys/:id/complete
POST   /api/v1/journeys/:id/location
POST   /api/v1/journeys/:id/emergency
GET    /api/v1/journeys/:id/matches

Create ​

json
{
  "vehicleId": "veh_01...",
  "origin": { "lat": 25.312, "lng": 55.377 },
  "destination": { "lat": 25.187, "lng": 55.264 },
  "departureAt": "2026-10-01T07:30:00+04:00",
  "availableSeats": 2,
  "type": "ONE_TIME"
}

The server then performs, in order:

text
Create Journey
      ↓
Calculate Route
      ↓
Run Eligibility
      ↓
Run Compliance
      ↓
Publish

A journey that fails compliance is created in DRAFT and not published. The driver receives the reason, so a blocked journey is explainable at the point of creation rather than discovered later as a silent failure to publish.

Requires Idempotency-Key: a retried create must not produce two journeys.

Recurring ​

text
POST /api/v1/journeys/recurring
json
{
  "vehicleId": "veh_01...",
  "days": ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY"],
  "departureTime": "07:30",
  "origin": { "lat": 25.1, "lng": 55.2 },
  "destination": { "lat": 25.2, "lng": 55.3 },
  "availableSeats": 2
}

Creates a recurring_journeys template. Individual occurrences are materialised as ordinary journeys rows referencing it, so every real trip is still a concrete, auditable object.

Lifecycle ​

text
DRAFT → PUBLISHED → MATCHING → FULL
                        ↓
                  IN_PROGRESS → COMPLETED

any state → CANCELLED | EXPIRED | FLAGGED | SUSPENDED

cancel, start and complete are the driver's transitions and all require Idempotency-Key.

List ​

text
GET /api/v1/journeys?cursor=<cursor>&limit=20

Location ​

text
POST /api/v1/journeys/:id/location
json
{
  "lat": 25.2048,
  "lng": 55.2708,
  "accuracyMeters": 8,
  "timestamp": "2026-10-01T07:58:10+04:00"
}

Push-based fallback for clients that cannot hold a WebSocket. In-journey only.

Emergency ​

text
POST /api/v1/journeys/:id/emergency

Triggers the configured emergency workflow — not merely a database insert. See Emergency override.

KHAWI — same route, go together.