search_flights

Search live live flight inventory by route, date, cabin, and passenger count.

Category: External API Price: $0.002 Backed by: supplier inventory layer

Input

{
  origin: string;        // IATA code, e.g. "MEX"
  destination: string;   // IATA code, e.g. "SCL"
  departureDate: string; // YYYY-MM-DD
  returnDate?: string;   // YYYY-MM-DD
  passengers?: number;   // 1-9, default 1
  cabinClass?: 'economy' | 'premium_economy' | 'business' | 'first';
}

Output

The tool returns the top three flight offers:

{
  offers: Array<{
    id: string;       // pass to book_flight as offerId
    totalAmount: string;
    totalCurrency: string;
    // plus provider itinerary fields
  }>;
}

When called through direct HTTP, Sendero wraps the result in the paid tool envelope:

{
  tool: 'search_flights',
  paid: true,
  priceUsdc: '0.002',
  payment: { payer: string, amountUsdc: string, settlementTx: string },
  result: { offers: [] }
}

HTTP example

curl -X POST $SENDERO_EDGE_URL/tools/search_flights \
  -H "content-type: application/json" \
  -H "Payment-Signature: $BASE64_X402_PAYMENT" \
  -d '{
    "origin": "MEX",
    "destination": "SCL",
    "departureDate": "2026-05-15",
    "passengers": 2,
    "cabinClass": "economy"
  }'

MCP example

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "search_flights",
    "arguments": {
      "origin": "MEX",
      "destination": "SCL",
      "departureDate": "2026-05-15",
      "passengers": 2,
      "cabinClass": "economy"
    }
  }
}

Payment flow

  1. POST to /tools/search_flights without Payment-Signature.
  2. Sendero returns 402 Payment Required with a PAYMENT-REQUIRED header.
  3. Sign the EIP-3009 authorization for 2,000 atomic USDC.
  4. Retry with Payment-Signature.
  5. Sendero executes the flight search and returns offers plus the payment receipt.

Most production clients hide this flow behind a small payment helper. See x402 nanopayments for the raw protocol.

Errors

CodeMeaning
payment_requiredThe direct HTTP endpoint needs an x402 signature.
invalid_inputOrigin, destination, date, passenger count, or cabin class failed validation.
no_offersthe supplier returned no flights for the route.
provider_timeoutthe supplier did not respond within the configured timeout.

On this page

search_flights