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

See the runnable price-tracking guide for SQLite history, scheduling, price-drop logic, request costs, and a booking-link handoff.

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 grouped booking options 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_options"]

# 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.