Examples

Working code patterns you can adapt for your own project. Each example covers a different use case and can be run standalone.

Flight price tracker in Python

Poll a route on a schedule, store the lowest fare, and send an alert when the price drops below a threshold.

import requests, time

API_KEY = "YOUR_API_KEY"
ROUTE = {"origin": "SFO", "destination": "JFK", "departure_date": "2026-05-15"}
THRESHOLD = 250

def check_price():
    resp = requests.post(
        "https://ignav.com/api/fares/one-way",
        headers={"X-Api-Key": API_KEY},
        json=ROUTE,
    )
    resp.raise_for_status()
    itineraries = resp.json()["itineraries"]
    if not itineraries:
        return None
    return min(it["price"]["amount"] for it in itineraries)

while True:
    lowest = check_price()
    if lowest and lowest < THRESHOLD:
        print(f"Price drop! {lowest} USD on SFO-JFK")
        # send_alert(lowest)
    time.sleep(4 * 3600)  # poll every 4 hours

Flight search app in Next.js

A server-side API route that searches fares and returns results to the frontend.

// app/api/search/route.ts
import { NextResponse } from "next/server";

export async function POST(req: Request) {
  const body = await req.json();
  const res = await fetch("https://ignav.com/api/fares/one-way", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Api-Key": process.env.IGNAV_API_KEY!,
    },
    body: JSON.stringify({
      origin: body.origin,
      destination: body.destination,
      departure_date: body.date,
      adults: body.adults ?? 1,
    }),
  });
  if (!res.ok) {
    return NextResponse.json({ error: "Search failed" }, { status: res.status });
  }
  const data = await res.json();
  return NextResponse.json(data);
}

AI travel tool (MCP / function calling)

Define Ignav endpoints as tool functions for an LLM agent. The agent can look up airports, search fares, and fetch booking links.

import requests

API_KEY = "YOUR_API_KEY"
BASE = "https://ignav.com/api"

def search_airports(query: str) -> list[dict]:
    """Look up airport IATA codes by name or city."""
    resp = requests.get(
        f"{BASE}/airports", params={"q": query},
        headers={"X-Api-Key": API_KEY},
    )
    return resp.json()

def search_fares(origin: str, destination: str, date: str) -> list[dict]:
    """Search one-way fares for a route and date."""
    resp = requests.post(
        f"{BASE}/fares/one-way",
        headers={"X-Api-Key": API_KEY},
        json={"origin": origin, "destination": destination, "departure_date": date},
    )
    data = resp.json()
    return [
        {"price": it["price"]["amount"], "carrier": it["outbound"]["carrier"],
         "ignav_id": it["ignav_id"]}
        for it in data["itineraries"][:5]
    ]

def get_booking_links(ignav_id: str) -> list[dict]:
    """Get booking URLs for a specific itinerary."""
    resp = requests.post(
        f"{BASE}/fares/booking-links",
        headers={"X-Api-Key": API_KEY},
        json={"ignav_id": ignav_id},
    )
    return resp.json()["booking_links"]

# Register these as tools in your LLM framework of choice

Ready to get started?

Create a free account to get your API key, or try the playground — no signup required.