{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentGeo API",
    "version": "1.0.0",
    "description": "Geocoding, weather, and timezone data via x402 micropayments. Powered by OpenStreetMap Nominatim and Open-Meteo.",
    "contact": {
      "email": "contact@memoryapi.org"
    }
  },
  "servers": [
    {
      "url": "https://geo.memoryapi.org",
      "description": "Production"
    },
    {
      "url": "http://localhost:3020",
      "description": "Local"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Health check",
        "security": [],
        "responses": {
          "200": {
            "description": "Service health status"
          }
        }
      }
    },
    "/x402/geo/geocode": {
      "get": {
        "summary": "Forward and reverse geocoding",
        "description": "Convert addresses to coordinates (forward) or coordinates to addresses (reverse). Powered by OpenStreetMap Nominatim.",
        "x-price": "$0.001 USDC",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Address or place name for forward geocoding",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lat",
            "in": "query",
            "description": "Latitude for reverse geocoding",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "lon",
            "in": "query",
            "description": "Longitude for reverse geocoding",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Max results (1-5, default 3)",
            "schema": {
              "type": "integer",
              "default": 3,
              "maximum": 5
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Force forward or reverse",
            "schema": {
              "type": "string",
              "enum": [
                "forward",
                "reverse"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Geocoding results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "type": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array"
                    },
                    "attribution": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/x402/geo/weather": {
      "get": {
        "summary": "Current weather and forecast",
        "description": "Get current conditions and multi-day forecast for any location. Powered by Open-Meteo (free, CC BY 4.0).",
        "x-price": "$0.001 USDC",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "description": "Latitude",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "lon",
            "in": "query",
            "description": "Longitude",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "location",
            "in": "query",
            "description": "City name (geocoded automatically)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "description": "Forecast days (1-7)",
            "schema": {
              "type": "integer",
              "default": 3,
              "minimum": 1,
              "maximum": 7
            }
          },
          {
            "name": "units",
            "in": "query",
            "description": "metric or imperial",
            "schema": {
              "type": "string",
              "enum": [
                "metric",
                "imperial"
              ],
              "default": "metric"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Weather data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "location": {
                      "type": "object"
                    },
                    "current": {
                      "type": "object"
                    },
                    "forecast": {
                      "type": "array"
                    },
                    "source": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/x402/geo/timezone": {
      "get": {
        "summary": "Timezone and country information",
        "description": "Get timezone by coordinates, country info by code/name, or timezone by IP address.",
        "x-price": "$0.001 USDC",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "description": "Latitude",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "lon",
            "in": "query",
            "description": "Longitude",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "country",
            "in": "query",
            "description": "ISO country code (US, DE) or country name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ip",
            "in": "query",
            "description": "IP address for timezone lookup",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Timezone and country data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "utc_offset": {
                      "type": "string"
                    },
                    "country": {
                      "type": "object"
                    },
                    "source": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/mcp": {
      "get": {
        "summary": "MCP server info",
        "security": [],
        "responses": {
          "200": {
            "description": "MCP server metadata"
          }
        }
      },
      "post": {
        "summary": "MCP JSON-RPC endpoint",
        "security": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "summary": "OpenAPI specification",
        "security": [],
        "responses": {
          "200": {
            "description": "This document"
          }
        }
      }
    }
  }
}