Trip FetchOne API

Retrieve a single trip with detailed sector, itinerary and auxiliary information

Endpoint

GET/api/trip/fetchOne/{id}

Retrieves detailed information for a single trip including sectors, air itineraries and auxiliary (hotel/ground) itineraries.

Authentication

Provide your API token in the request headers:

X-Api-Token: your_token_prefix.your_token_secret

Parameters

Parameter Type Required Description
id integer Required Trip ID to retrieve
include_sectors boolean Optional Include sector details (default: true)

Usage Examples

Get trip with all details
GET /api/trip/fetchOne?id=3763
Get trip without sectors
GET /api/trip/fetchOne?id=3763&include_sectors=false

Response Format

{
  "success": true,
  "data": {
    "id": 3763,
    "client_id": 4455,
    "travel_profile_id": null,
    "consultant_id": 3885,
    "branch_id": 349,
    "passenger_id": 11962,
    "department_id": null,
    "group_id": null,
    "booking_fee_id": null,
    "date_opened": "2025-11-06 04:05:24",
    "date_quoted": "2025-11-06",
    "date_activated": null,
    "trip_reloc": null,
    "trip_type": "Unknown",
    "purchase_order": "",
    "booked_by": "MEGAN",
    "destination": "ZQN",
    "charge_to": "KNIGHT Ruth Ms",
    "source": "12",
    "is_active": false,
    "is_archived": false,
    "is_corporate": false,
    "agency_iata_no": null,
    "trip_status": "quote",
    "bpay_crn": "20037636",
    "code_version": 1,
    "category": {
      "id": null,
      "name": null,
      "description": null,
      "icon": null
    },
    "sectors": [
      {
        "id": 26334,
        "product_id": 113,
        "supplier_id": 107,
        "consultant_id": 3885,
        "trip_sector_status_id": 4,
        "status_name": "Confirmed.",
        "details": "OOL-ZQN\\r\\nGold Coast Airport - Gold Coast - Queenstown Airport - Queenstown\\r\\nJQ193 2025-12-01 06:15 2025-12-01 12:35\\r\\n\\r\\nQueenstown Airport - Queenstown - Gold Coast Airport - Gold Coast\\r\\nJQ194 2025-12-09 13:35 2025-12-09 14:05",
        "travel_date": "2025-12-01",
        "return_date": "2025-12-09",
        "qty": 1,
        "financial": {
          "net": 59900,
          "unit_price": 59900,
          "fees": 0,
          "gst": 0,
          "commission": 0,
          "total": 59900
        },
        "flags": {
          "is_active": true,
          "is_claimed": false
        },
        "reloc_code": "JZXGHG",
        "pax_tattoo": "7.1",
        "sector_tattoo": "766056264e7a73c852f90b2b16e76021",
        "created_date": "2025-11-06 14:05:35",
        "date_activated": "2025-11-06",
        "order": 1
      }
    ],
    "air_itineraries": [
      {
        "id": 58793,
        "trip_sector_id": 26334,
        "flight_no": "193",
        "carrier": "JQ",
        "departure": {
          "date": "2025-12-01",
          "time": "06:15:00",
          "location_code": "OOL",
          "location": "Gold Coast Airport - Gold Coast"
        },
        "arrival": {
          "date": "2025-12-01",
          "time": "12:35:00",
          "location_code": "ZQN",
          "location": "Queenstown Airport - Queenstown"
        },
        "flight_details": {
          "duration": "03:20",
          "distance": "1433 Miles",
          "num_stops": "0",
          "equipment": "Airbus A320"
        },
        "booking_details": {
          "class_type": "Economy"
        },
        "is_active": true
      }
    ],
    "aux_itineraries": [
      {
        "id": 11518,
        "trip_sector_id": 26336,
        "seg_name": "Holiday Inn Express & Suites Queenstown",
        "start": {
          "date": "2025-12-01",
          "time": "15:00:00",
          "location_code": "ZQN",
          "location": "Queenstown, New Zealand",
          "phone_number": "6432227177"
        },
        "end": {
          "date": "2025-12-09",
          "time": "10:00:00",
          "location_code": "ZQN",
          "location": "Queenstown, New Zealand"
        },
        "class_type": "Standard room - 2 queen beds",
        "inclusions": "Breakfast",
        "is_active": true
      }
    ]
  },
  "timestamp": "2025-11-06T14:44:56+10:00"
}

Response Fields

Trip Information

Field Type Description
id integer Unique trip identifier
client_id integer Associated client ID
travel_profile_id integer Optional travel profile id (nullable)
consultant_id integer Assigned consultant ID
branch_id integer Branch identifier
passenger_id integer Primary passenger ID
booked_by string Name of person who made the booking
destination string Trip destination (short code or description)
trip_status string Current trip workflow status (e.g. quote, active)
bpay_crn string BPAY reference if present
category object Category object (nullable fields: id/name/description/icon)

Sectors

Array of sector objects. Each sector contains product, supplier, travel dates and a nested financial object.

Field Type Description
id integer Unique sector identifier
product_id integer Product/service id for the sector
supplier_id integer Supplier identifier
status_name string Human readable sector status
travel_date / return_date date Outbound and return dates
financial object Nested financial fields (net, unit_price, fees, gst, commission, total)
flags object Boolean flags for sector state (is_active, is_claimed, etc.)

Air Itineraries

Array of flight segments associated with sectors.

Field Type Description
id integer Itinerary record id
trip_sector_id integer Associated sector id
carrier / flight_no string Carrier code and flight number
departure / arrival object Departure/arrival objects with date, time, location_code and location
flight_details object Duration, distance, equipment and number of stops

Auxiliary Itineraries

Hotel, transfers or other non-air itineraries.

Field Type Description
id integer Aux record id
seg_name string Name of the hotel / service
start / end object Start and end objects with date, time and location
class_type string Room or service class/type

Key Features

  • Complete Trip Data: All trip information including dates, status, and references
  • Detailed Sectors: Full sector information with nested financial and flag structures
  • Itineraries: Air segments under air_itineraries and hotels/transfers under aux_itineraries
  • Nullable Fields: Many fields (travel_profile_id, department_id, category fields) may be null
  • Financials: Per-sector financial object with net/unit_price/total values stored in cents

Error Responses

Trip not found
{
  "success": false,
  "error": "Not Found",
  "message": "Trip with ID 99999 not found",
  "timestamp": "2025-11-06T14:44:56+10:00"
}
Missing required parameter
{
  "success": false,
  "error": "Bad Request",
  "message": "Missing required parameter: id",
  "timestamp": "2025-11-06T14:44:56+10:00"
}

Code Examples

JavaScript (Fetch)

const tripId = 12345;
const response = await fetch(`/api/trip/fetchOne?id=${tripId}`, {
  headers: {
    'X-Api-Key': 'your_api_key_here'
  }
});

const data = await response.json();
if (data.success) {
  const trip = data.data;
  console.log(`Trip ${trip.id}: ${trip.destination}`);
  console.log(`Total sectors: ${trip.sectors.length}`);
  console.log(`Total amount: $${trip.sector_summary.total_amount_formatted}`);
  
  // Process each sector
  trip.sectors.forEach(sector => {
    console.log(`Sector ${sector.sequence}: ${sector.from_city} to ${sector.to_city}`);
  });
}

PHP (cURL)

$tripId = 12345;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "/api/trip/fetchOne?id={$tripId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-Api-Key: your_api_key_here'
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

if ($data['success']) {
    $trip = $data['data'];
    echo "Trip {$trip['id']}: {$trip['destination']}\n";
    echo "Total sectors: " . count($trip['sectors']) . "\n";
    echo "Total amount: \${$trip['sector_summary']['total_amount_formatted']}\n";
    
    foreach ($trip['sectors'] as $sector) {
        echo "Sector {$sector['sequence']}: {$sector['from_city']} to {$sector['to_city']}\n";
    }
}

Python (requests)

import requests

trip_id = 12345
headers = {'X-Api-Key': 'your_api_key_here'}

response = requests.get(f'/api/trip/fetchOne?id={trip_id}', headers=headers)
data = response.json()

if data['success']:
    trip = data['data']
    print(f"Trip {trip['id']}: {trip['destination']}")
    print(f"Total sectors: {len(trip['sectors'])}")
    print(f"Total amount: ${trip['sector_summary']['total_amount_formatted']}")
    
    for sector in trip['sectors']:
        print(f"Sector {sector['sequence']}: {sector['from_city']} to {sector['to_city']}")