{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentGate",
    "version": "1.0.0",
    "description": "Pay-per-call micro-APIs for AI agents: web content extraction, airport data, route distances and DNS intelligence. No accounts, no API keys — every request is paid on the spot with USDC on Base via the x402 protocol.",
    "x-guidance": "All endpoints are GET requests with query parameters and return JSON. Pay per call with x402 (USDC on Base mainnet, eip155:8453). Use GET /api/extract?url=<page-url> to read any public web page as clean text with title, metadata, headings and links. Use GET /api/airport?code=<IATA-or-ICAO> for airport data (49,000+ airports). Use GET /api/route?from=<code>&to=<code> for great-circle distance and estimated flight time between two airports. Use GET /api/dns?domain=<domain> for DNS records and a domain-health summary. The free catalog at GET /api lists everything.",
    "contact": { "email": "streamofwork@gmail.com" }
  },
  "servers": [{ "url": "https://agentgate-x402.netlify.app" }],
  "paths": {
    "/api/extract": {
      "get": {
        "operationId": "extractWebContent",
        "summary": "Extract clean readable content from any public web page",
        "description": "Fetches the URL and returns clean readable text with HTML noise stripped, plus title, meta description, OpenGraph data, canonical URL, language, headings, outbound links and word count.",
        "tags": ["Web"],
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.005000" },
          "protocols": [{ "x402": {} }]
        },
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "http(s) URL of the page to extract",
            "schema": { "type": "string", "format": "uri", "minLength": 10 },
            "example": "https://example.com/article"
          }
        ],
        "responses": {
          "200": {
            "description": "Extracted page content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": { "type": "string", "description": "final URL after redirects" },
                    "title": { "type": ["string", "null"] },
                    "description": { "type": ["string", "null"] },
                    "canonical": { "type": ["string", "null"] },
                    "lang": { "type": ["string", "null"] },
                    "ogImage": { "type": ["string", "null"] },
                    "siteName": { "type": ["string", "null"] },
                    "headings": { "type": "array", "items": { "type": "string" } },
                    "text": { "type": "string", "description": "clean readable page text, up to 40,000 chars" },
                    "wordCount": { "type": "integer" },
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": { "text": { "type": "string" }, "href": { "type": "string" } }
                      }
                    }
                  },
                  "required": ["url", "text", "wordCount"]
                }
              }
            }
          },
          "402": { "description": "Payment Required" }
        }
      }
    },
    "/api/airport": {
      "get": {
        "operationId": "lookupAirport",
        "summary": "Airport lookup by IATA or ICAO code",
        "description": "Returns airport name, coordinates, elevation, country, region, municipality, size class and scheduled-service flag. Covers 49,000+ airports worldwide (OurAirports data).",
        "tags": ["Aviation"],
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.002000" },
          "protocols": [{ "x402": {} }]
        },
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "description": "3-letter IATA or 4-letter ICAO airport code",
            "schema": { "type": "string", "pattern": "^[A-Za-z0-9]{3,4}$" },
            "example": "DXB"
          }
        ],
        "responses": {
          "200": {
            "description": "Airport record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "icao": { "type": "string" },
                    "iata": { "type": "string" },
                    "name": { "type": "string" },
                    "lat": { "type": "number" },
                    "lon": { "type": "number" },
                    "elevationFt": { "type": ["integer", "null"] },
                    "country": { "type": "string", "description": "ISO 3166-1 alpha-2" },
                    "region": { "type": "string", "description": "ISO 3166-2" },
                    "municipality": { "type": "string" },
                    "type": { "type": "string", "enum": ["large", "medium", "small", "seaplane_base"] },
                    "scheduledService": { "type": "boolean" }
                  },
                  "required": ["icao", "name", "lat", "lon", "country"]
                }
              }
            }
          },
          "402": { "description": "Payment Required" },
          "404": { "description": "No airport found for that code" }
        }
      }
    },
    "/api/route": {
      "get": {
        "operationId": "airportRoute",
        "summary": "Distance and flight time between two airports",
        "description": "Great-circle distance in km, nautical miles and statute miles plus an estimated block flight time between any two of 49,000+ airports, identified by IATA or ICAO code.",
        "tags": ["Aviation"],
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.002000" },
          "protocols": [{ "x402": {} }]
        },
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "origin airport IATA/ICAO code",
            "schema": { "type": "string", "pattern": "^[A-Za-z0-9]{3,4}$" },
            "example": "JFK"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "destination airport IATA/ICAO code",
            "schema": { "type": "string", "pattern": "^[A-Za-z0-9]{3,4}$" },
            "example": "LHR"
          }
        ],
        "responses": {
          "200": {
            "description": "Route distance and time estimate",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "from": { "type": "object", "description": "origin airport record" },
                    "to": { "type": "object", "description": "destination airport record" },
                    "distance": {
                      "type": "object",
                      "properties": {
                        "km": { "type": "integer" },
                        "nm": { "type": "integer" },
                        "mi": { "type": "integer" }
                      },
                      "required": ["km", "nm", "mi"]
                    },
                    "estimatedFlightTime": {
                      "type": "object",
                      "properties": {
                        "hours": { "type": "number" },
                        "formatted": { "type": "string" }
                      }
                    }
                  },
                  "required": ["from", "to", "distance"]
                }
              }
            }
          },
          "402": { "description": "Payment Required" },
          "404": { "description": "One of the airport codes was not found" }
        }
      }
    },
    "/api/dns": {
      "get": {
        "operationId": "dnsIntelligence",
        "summary": "DNS records and domain-health summary",
        "description": "Returns A/AAAA/CNAME/MX/NS/TXT records with TTLs plus a summary: whether the domain resolves, has mail configured, its SPF policy and any site-verification tokens.",
        "tags": ["Domains"],
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.002000" },
          "protocols": [{ "x402": {} }]
        },
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "description": "domain name to inspect",
            "schema": { "type": "string", "minLength": 4 },
            "example": "openai.com"
          }
        ],
        "responses": {
          "200": {
            "description": "DNS records and summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": { "type": "string" },
                    "records": {
                      "type": "object",
                      "description": "keyed by record type: A, AAAA, CNAME, MX, NS, TXT",
                      "additionalProperties": true
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "resolves": { "type": "boolean" },
                        "hasMx": { "type": "boolean" },
                        "spf": { "type": ["string", "null"] },
                        "verifications": { "type": "array", "items": { "type": "string" } }
                      }
                    }
                  },
                  "required": ["domain", "records", "summary"]
                }
              }
            }
          },
          "402": { "description": "Payment Required" }
        }
      }
    }
  }
}
