{
  "openapi": "3.1.0",
  "info": {
    "title": "EconSignalPulse API",
    "description": "Alternative economic intelligence API covering 190+ countries. Combines World Bank Open Data, IMF Datamapper forecasts, satellite nighttime lights research, and AIS shipping signals to produce institutional-grade sovereign intelligence. All endpoints require x402 payment (USDC on Base mainnet) via the PAYMENT-SIGNATURE header.",
    "version": "1.0.0",
    "contact": {
      "url": "https://econsignalpulse.vercel.app"
    }
  },
  "servers": [
    {
      "url": "https://econsignalpulse.vercel.app"
    }
  ],
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "description": "x402 payment signature. Send a GET request without this header to receive a 402 with payment requirements. Sign the payment and retry with the PAYMENT-SIGNATURE header.",
        "required": true
      }
    },
    "parameters": {
      "country": {
        "name": "country",
        "in": "query",
        "required": false,
        "schema": { "type": "string" },
        "description": "Country name — e.g. 'India' | 'Brazil' | 'Germany' | 'Nigeria'"
      },
      "iso2": {
        "name": "iso2",
        "in": "query",
        "required": false,
        "schema": { "type": "string" },
        "description": "ISO2 country code for World Bank data — e.g. IN | BR | DE | NG"
      },
      "iso3": {
        "name": "iso3",
        "in": "query",
        "required": false,
        "schema": { "type": "string" },
        "description": "ISO3 country code for IMF data — e.g. IND | BRA | DEU | NGA"
      },
      "lang": {
        "name": "lang",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": ["en", "es", "fr", "de", "ja", "zh", "ko", "pt", "ar", "hi"],
          "default": "en"
        },
        "description": "Response language"
      }
    }
  },
  "security": [{ "x402": [] }],
  "paths": {
    "/api/econsignal/nightlights": {
      "get": {
        "summary": "Satellite nighttime lights vs official GDP",
        "description": "Compares government-reported GDP growth against satellite nighttime lights evidence (VIIRS/DMSP) to detect divergences. Covers China, Russia, Venezuela, Iran, and 100+ countries. Used by hedge funds and intelligence analysts to verify economic claims. Data: World Bank GDP + electricity access + Tavily satellite research synthesis.",
        "operationId": "nightlights",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["1y", "3y", "5y", "10y"], "default": "5y" },
            "description": "Analysis period"
          },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Satellite divergence analysis" },
          "402": {
            "description": "Payment required. See PAYMENT-REQUIRED header for x402 payment details.",
            "headers": {
              "PAYMENT-REQUIRED": { "schema": { "type": "string" }, "description": "Base64-encoded x402 payment requirements" }
            }
          }
        },
        "x-price-usd": 0.15,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/gdp-tracker": {
      "get": {
        "summary": "GDP tracker — history + IMF forecasts",
        "description": "Real GDP growth history from World Bank plus IMF World Economic Outlook forward projections. Covers 190+ countries. Returns historical series, peer ranking, structural drivers, income classification, and investment relevance. Data: World Bank Open Data + IMF WEO Datamapper.",
        "operationId": "gdpTracker",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "GDP tracker report" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.10,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/inflation-signals": {
      "get": {
        "summary": "Multi-source inflation signals",
        "description": "Official CPI history (World Bank), IMF inflation forecasts, and alternative signals (food prices, FX depreciation, parallel market rates, scrape-based estimates). Flags countries with known CPI manipulation. Includes monetary policy stance and central bank credibility rating. Data: World Bank + IMF + web synthesis.",
        "operationId": "inflationSignals",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Inflation signals report" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/country-brief": {
      "get": {
        "summary": "Full sovereign intelligence brief",
        "description": "Comprehensive sovereign economic intelligence brief covering macro fundamentals, fiscal position, external accounts, political risk, currency outlook, investment thesis, and opportunity score. Replaces $2,000+ investment bank EM research reports. Data: World Bank + IMF + Tavily synthesis.",
        "operationId": "countryBrief",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          {
            "name": "focus",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["investment", "trade", "risk", "macro", "all"], "default": "all" },
            "description": "Analysis focus area"
          },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Sovereign intelligence brief" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.25,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/divergence": {
      "get": {
        "summary": "Official stats vs alternative data divergence",
        "description": "Gap analysis between official government statistics and alternative data signals (satellite nighttime lights, shipping AIS, electricity consumption, mobility data). Returns credibility score, key distortions, and investor implications. Critical for sovereign debt analysis. Data: World Bank + IMF + satellite/AIS synthesis.",
        "operationId": "divergence",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Divergence analysis" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.20,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/recession-signals": {
      "get": {
        "summary": "Recession probability signals",
        "description": "Multi-indicator recession probability for any country. Combines GDP trajectory, IMF forecasts, PMI, yield curve, consumer confidence, unemployment trends, and credit conditions. Returns probability percentage, indicator dashboard, historical analog, and monitoring triggers. Covers developed and emerging markets. Data: World Bank + IMF + web synthesis.",
        "operationId": "recessionSignals",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Recession signals report" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.15,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/frontier-intel": {
      "get": {
        "summary": "Frontier and emerging market intelligence",
        "description": "Economic intelligence for frontier and emerging markets where official data is sparse or unreliable. Covers Sub-Saharan Africa, Central Asia, South/Southeast Asia, MENA frontier, Pacific Islands, and Caribbean. Returns macro snapshot, growth drivers, structural challenges, data quality assessment, development finance context, and risk ratings. Data: World Bank + IMF + Tavily synthesis.",
        "operationId": "frontierIntel",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          {
            "name": "lens",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["investment", "aid", "supply-chain", "demographics", "all"], "default": "all" },
            "description": "Intelligence lens"
          },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Frontier market intelligence" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.15,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/trade-flows": {
      "get": {
        "summary": "Global trade flow analysis",
        "description": "Trade flow intelligence combining World Bank trade data, current account analysis, and shipping AIS signals. Returns bilateral trade profiles, export/import composition, shipping route activity, sanctions-driven rerouting, nearshoring signals, and supply chain risk. Optional partner country for bilateral analysis. Data: World Bank + IMF + Tavily AIS synthesis.",
        "operationId": "tradeFlows",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          {
            "name": "partner",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Optional trade partner country for bilateral analysis — e.g. 'United States' | 'China' | 'Germany'"
          },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Trade flow analysis" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.15,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/credit-stress": {
      "get": {
        "summary": "Sovereign credit and banking stress",
        "description": "Sovereign credit quality and banking system stress assessment. Combines World Bank debt data, IMF fiscal projections, credit ratings, CDS spreads, IMF program status, and banking sector indicators. Returns stress score (0-100), vulnerability assessment (liquidity/solvency/rollover/contagion), and investor guidance. Data: World Bank + IMF + Tavily credit synthesis.",
        "operationId": "creditStress",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          { "$ref": "#/components/parameters/iso3" },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Sovereign credit stress report" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.15,
        "x-agent-use-case": "on-demand"
      }
    },
    "/api/econsignal/sanctions-impact": {
      "get": {
        "summary": "Sanctions impact measurement",
        "description": "Economic impact of sanctions regimes measured via satellite evidence, shipping AIS data, and alternative signals. Covers Russia, Iran, Venezuela, North Korea, Belarus, Myanmar, and all OFAC/EU/UN sanctioned jurisdictions. Returns economic impact assessment, satellite evidence, evasion analysis, compliance implications, and effectiveness score. Data: World Bank + OFAC/EU/UN + satellite/AIS synthesis.",
        "operationId": "sanctionsImpact",
        "parameters": [
          { "$ref": "#/components/parameters/country" },
          { "$ref": "#/components/parameters/iso2" },
          {
            "name": "regime",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["OFAC", "EU", "UN", "all"], "default": "all" },
            "description": "Sanctions regime to analyze"
          },
          { "$ref": "#/components/parameters/lang" }
        ],
        "responses": {
          "200": { "description": "Sanctions impact report" },
          "402": { "description": "Payment required" }
        },
        "x-price-usd": 0.20,
        "x-agent-use-case": "on-demand"
      }
    }
  }
}
