Method
PUT /v1/products/:id/transport/departures/:departureId/segments
Path Parameters
uuid
Product ID that owns the departure.
uuid
Departure ID whose segments should be replaced.
Body Parameters
Show Segment object
Show Segment object
Headers
string
Bearer token (requires
products:write).string
application/jsonRequest Example
curl -X PUT "https://api.voyantcloud.com/v1/products/prod_123/transport/departures/dep_456/segments" \
-H "Authorization: Bearer $VOYANT_API_KEY" \
-H "content-type: application/json" \
-d '{
"segments": [
{
"mode_id": "mode_flight",
"operator_org_id": "org_airline",
"from_place_id": "ChIJ8UNwppk4j4ARzWPaN9xq_9o",
"to_place_id": "ChIJGaK-SZcYtUYR0Y1DSXB6QrM",
"depart_offset_minutes": 0,
"duration_minutes": 160,
"airline_code": "RO",
"flight_number": "381",
"cabin_class": "economy",
"seats_total": 40,
"seats_available": 18,
"luggage": { "checked_bag": 1 }
}
]
}'
await fetch("https://api.voyantcloud.com/v1/products/prod_123/transport/departures/dep_456/segments", {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({ segments: [] }),
})
import os, requests
payload = {
"segments": [
{
"mode_id": "mode_coach",
"operator_org_id": "org_transport",
"from_place_id": "ChIJ8UNwppk4j4ARzWPaN9xq_9o",
"to_place_id": "ChIJGaK-SZcYtUYR0Y1DSXB6QrM",
"duration_minutes": 45
}
]
}
resp = requests.put(
"https://api.voyantcloud.com/v1/products/prod_123/transport/departures/dep_456/segments",
headers={
"Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}",
"content-type": "application/json",
},
json=payload,
)
segments = resp.json()["segments"]
Response
{
"segments": [
{
"id": "seg_001",
"departure_id": "dep_456",
"seq": 1,
"mode_id": "mode_flight",
"operator_org_id": "org_airline",
"resource_id": "res_aircraft",
"from_place_id": "ChIJ8UNwppk4j4ARzWPaN9xq_9o",
"to_place_id": "ChIJGaK-SZcYtUYR0Y1DSXB6QrM",
"depart_offset_minutes": 0,
"duration_minutes": 160,
"attributes": {},
"notes": "Direct flight",
"is_charter": false,
"airline_code": "RO",
"flight_number": "381",
"cabin_class": "economy",
"fare_class_code": "Y",
"seats_total": 40,
"seats_available": 18,
"luggage": { "checked_bag": 1 }
}
]
}
This endpoint replaces all existing segments for the departure. Send the complete list you want to persist each time you call it.