---
title: "Update a segment"
method: PATCH
path: "/api/segments/{id}"
tags: ["Transport"]
---

# Update a segment

`PATCH /api/segments/{id}`

## Request

- Base URL: `https://trvlrr.app`
- URL: `https://trvlrr.app/api/segments/{id}`
- Auth: HTTP bearer

Only the fields given change. trip_id re-files it on another trip in the same account. Correcting the places or date of an inferred drive makes it a real leg.

## Path parameters

- `id` string, required: The id.

## Request body

- SegmentPatch
  - `mode` 'flight' | 'train' | 'bus' | 'ferry' | 'car_rental' | 'drive' | 'other': How: flight, train, bus, ferry, car_rental, drive or other.
  - `provider` string, nullable: Airline, rail operator, bus or rental company, e.g. Qantas.
  - `service` string, nullable: Flight or service number, e.g. QF1.
  - `from_place` string, nullable: Where it leaves from, e.g. Sydney or Sydney Airport.
  - `from_country` string, nullable: Country it leaves from (name or ISO code).
  - `from_code` string, nullable: Departure airport or station code, e.g. SYD.
  - `to_place` string, nullable: Where it arrives.
  - `to_country` string, nullable: Country it arrives in.
  - `to_code` string, nullable: Arrival airport or station code, e.g. LHR.
  - `depart_date` string, nullable: Departure date. Date, YYYY-MM-DD.
  - `depart_time` string, nullable: Local departure time "HH:MM".
  - `arrive_time` string, nullable: Local arrival time "HH:MM", with " +N" if it lands N days after departure, e.g. "05:20 +1".
  - `depart_tz` string, nullable: IANA time zone at departure, e.g. Australia/Sydney.
  - `arrive_tz` string, nullable: IANA time zone at arrival.
  - `depart_utc` string, nullable: Derived from the local time and zone; only set to override.
  - `arrive_utc` string, nullable: Derived from the local time and zone; only set to override.
  - `booking_ref` string, nullable: Booking or confirmation reference.
  - `price_raw` string, nullable: Price with currency, e.g. "AUD 420.00".
  - `status` string, nullable: Free text, e.g. "Confirmed".
  - `notes` string, nullable: Anything else worth keeping.
  - `category` string, nullable: Free text category.
  - `operating_carrier` string, nullable: Operating carrier if different from the provider.
  - `aircraft` string, nullable: Aircraft type.
  - `cabin` string, nullable: Cabin or class.
  - `seats` string, nullable: Seat numbers.
  - `depart_terminal` string, nullable: Departure terminal.
  - `arrive_terminal` string, nullable: Arrival terminal.
  - `ticket_numbers` string, nullable: Ticket numbers.
  - `agency` string, nullable: Booked through (travel agency or site).
  - `distance_km` number, nullable: Distance in km, if known.
  - `payment_status` 'paid' | 'due' | 'on_arrival' | 'null', nullable: paid, due (to pay before the trip) or on_arrival (pay there or on the day).
  - `payment_method` 'card' | 'cash' | 'null', nullable: card or cash.
  - `traveler_ids` string[]: Who travelled; defaults to the trip's travellers.
  - `trip_id` string: Move the segment to this trip (same account, both writable).

## Response `200`

Updated.

- Ok
  - `ok` boolean, required

## Other responses

- `400`: The request is malformed or fails validation.
- `401`: No usable credential: a Clerk session token, a device token or an OAuth access token is required.
- `403`: The caller may not do this to this account or trip.
- `404`: No such thing, or not one the caller can see.

---

[API](https://skmtc.dev/trvlrr/apis/trvlrr-api.md) · [All operations](https://skmtc.dev/trvlrr/apis/trvlrr-api/llms.txt) · [OpenAPI document](https://skmtc.dev/trvlrr/apis/trvlrr-api/revisions/ea024946b293?raw)
