{
  "name": "Piratefly Flight Price Trends API",
  "description": "Free public API for flight price trends and popular destinations. Data is served from a 7-day cache (upstream Aviasales Data API), not live prices.",
  "endpoints": {
    "GET /api/v1/price-trends": "params: origin (required, IATA), currency (optional, default usd), destination (optional, IATA). Free: 100 requests/day per IP (X-RateLimit-* headers, 429 + Retry-After past the cap). Header X-Api-Key (Pro) removes the daily cap and serves from a 10-minute cache instead of 6 hours; fair use 60 requests/minute per key.",
    "GET /api/v1/analisi": "params: origine, destinazione (CITY names). Is today's fare cheap for this route, against its own price history. Same X-Api-Key. Free tier: 30 requests/day per IP; Pro: no daily cap, fair use 120 requests/minute per key. Proxied same-origin from next.piratefly.com — one domain to integrate.",
    "POST /api/v1/alerts": "body: { route: 'ORG-DST', email, threshold? }. Subscribe to a price-drop alert for a route.",
    "POST /api/v1/pro/checkout": "body: { email } -> { url }. Stripe Checkout for the Pro plan.",
    "POST /api/v1/pro/recupera": "body: { email }. Lost your key? A fresh one is emailed and the old one stops working."
  },
  "auth": "None for the free tier. Pro sends the key in the X-Api-Key header; the response carries X-Plan: pro. An unknown or revoked key gets 401, never a silent downgrade.",
  "cache": "Free GET responses are cached at the edge for 6 hours. Underlying data is refreshed by the upstream source on a 7-day cycle, so the free tier is not a live-price feed. Pro price-trends responses are cached for 10 minutes.",
  "related": {
    "GET https://next.piratefly.com/v1/openapi.json": "OpenAPI 3.1 spec for the verdict API.",
    "GET https://next.piratefly.com/mcp": "MCP endpoint, for AI agents."
  },
  "license": "Free, no key required, 100 requests/day per IP on price-trends and 30/day on analisi; Pro removes both daily caps (fair use per minute still applies).",
  "pro": {
    "price": "12.99 USD/month",
    "price_usd": 12.99,
    "usdc": "GET https://piratefly.com/v1/pro/cripta — one USDC payment on Solana = 30 days of Pro, no auto-renewal",
    "includes": [
      "No daily cap on price lookups (the free tier stops at 100/day per IP), refreshed every 10 minutes instead of the free tier's 6-hour edge cache",
      "No daily cap on the booking-verdict API (GET /api/v1/analisi) — the free tier stops at 30/day per IP",
      "Fair use per key: 60 requests/minute on price trends, 120/minute on the verdict API (429 with Retry-After, X-RateLimit-* headers)",
      "The same key works on both APIs, and a lost key can be re-issued by email",
      "Email support, answered by a human"
    ],
    "page": "https://piratefly.com/api/",
    "checkout": "POST /api/v1/pro/checkout  body: { email }  -> { url } (Stripe Checkout)",
    "recover": "POST /api/v1/pro/recupera  body: { email }  -> lost your key? a new one is emailed to the address that pays, and the old one stops working. Same answer for any address, so this is not a way to find out who bought.",
    "subscribe": "https://piratefly.com/api/?src=api-root"
  }
}