{
  "openapi": "3.1.0",
  "info": {
    "title": "werner.ddns.net x402 services",
    "version": "1.0.0",
    "summary": "Pay-per-request data APIs settled with x402 (USDC on Solana mainnet).",
    "description": "Three small HTTP APIs that sell live data per request using the x402 protocol. Every endpoint is a plain GET that answers HTTP 402 with a base64 `payment-required` header until a valid x402 payment is presented in the `X-PAYMENT` header. Payment terms: scheme `exact`, network `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`, asset USDC, verified and settled by the facilitator at https://facilitator.payai.network. Machine-readable overview: https://werner.ddns.net/.well-known/x402",
    "contact": { "url": "https://werner.ddns.net/" },
    "license": { "name": "Proprietary" }
  },
  "servers": [
    { "url": "https://werner.ddns.net", "description": "Production (Solana mainnet, real USDC)" }
  ],
  "x-x402": {
    "version": 2,
    "scheme": "exact",
    "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "assetSymbol": "USDC",
    "facilitator": "https://facilitator.payai.network"
  },
  "tags": [
    { "name": "crypto", "description": "Live crypto market prices ($0.001 USDC per request)." },
    { "name": "weather", "description": "Weather and alerts for Germany and Austria ($0.001 USDC per request)." },
    { "name": "solana", "description": "Solana staking and epoch data ($0.01 USDC per request)." }
  ],
  "paths": {
    "/price": {
      "get": {
        "tags": ["crypto"],
        "summary": "Live crypto prices (Crypto Preise)",
        "description": "Real-time bid/ask/last price from Coinbase for BTC, ETH, XRP, SOL, ZEC, HYPE, DOGE, LINK, ADA, XLM and SHIB, quoted in USDC. Costs 0.001 USDC (1000 micro-USDC) per request.",
        "operationId": "getCryptoPrices",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Crypto pair, e.g. BTC-USDC, ETH-USDC, XRP-USDC, SOL-USDC (optional, returns all if omitted).",
            "schema": { "type": "string", "default": "BTC-USDC" }
          }
        ],
        "responses": {
          "200": {
            "description": "Price data (returned after the x402 payment has been verified and settled).",
            "headers": { "payment-response": { "$ref": "#/components/headers/PaymentResponse" } },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PriceResponse" }
              }
            }
          },
          "402": { "$ref": "#/components/responses/PaymentRequired" }
        }
      }
    },
    "/weather": {
      "get": {
        "tags": ["weather"],
        "summary": "Weather & alerts for Germany and Austria",
        "description": "Current weather and active weather warnings for Germany and Austria, by German (5-digit) or Austrian (4-digit) postal code, or by coordinates. Sources: Deutscher Wetterdienst (DWD) and GeoSphere Austria (CC BY 4.0). Costs 0.001 USDC (1000 micro-USDC) per request.",
        "operationId": "getWeather",
        "parameters": [
          {
            "name": "plz",
            "in": "query",
            "required": false,
            "description": "Postal code: German 5-digit (e.g. 50667) or Austrian 4-digit (e.g. 1010).",
            "schema": { "type": "string" }
          },
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "description": "Latitude (alternative to plz).",
            "schema": { "type": "number" }
          },
          {
            "name": "lon",
            "in": "query",
            "required": false,
            "description": "Longitude (alternative to plz).",
            "schema": { "type": "number" }
          }
        ],
        "responses": {
          "200": {
            "description": "Location, current weather and active alerts.",
            "headers": { "payment-response": { "$ref": "#/components/headers/PaymentResponse" } },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/WeatherResponse" }
              }
            }
          },
          "402": { "$ref": "#/components/responses/PaymentRequired" }
        }
      }
    },
    "/staking": {
      "get": {
        "tags": ["solana"],
        "summary": "Solana staking & epoch data",
        "description": "Live Solana staking and epoch data: current epoch progress and estimated epoch end (from live slot pace), inflation rate, and a ranking of the top validators by staked amount with commission and estimated net APY. Optional lookups: one validator, a stake reward forecast, or historical rewards of a wallet. Costs 0.01 USDC (10000 micro-USDC) per request.",
        "operationId": "getSolanaStaking",
        "parameters": [
          {
            "name": "validator",
            "in": "query",
            "required": false,
            "description": "Validator vote account (base58) for a single-validator detail lookup.",
            "schema": { "type": "string" }
          },
          {
            "name": "wallet",
            "in": "query",
            "required": false,
            "description": "Pubkey for a historical staking-rewards lookup.",
            "schema": { "type": "string" }
          },
          {
            "name": "staked",
            "in": "query",
            "required": false,
            "description": "Staked amount in SOL for a stake reward forecast.",
            "schema": { "type": "number" }
          },
          {
            "name": "commission",
            "in": "query",
            "required": false,
            "description": "Validator commission in percent for the reward forecast (default 10).",
            "schema": { "type": "number", "default": 10 }
          }
        ],
        "responses": {
          "200": {
            "description": "Epoch status, inflation and validator data.",
            "headers": { "payment-response": { "$ref": "#/components/headers/PaymentResponse" } },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/StakingResponse" }
              }
            }
          },
          "402": { "$ref": "#/components/responses/PaymentRequired" }
        }
      }
    }
  },
  "components": {
    "headers": {
      "PaymentRequired": {
        "description": "base64-encoded x402 v2 JSON with the accepted payment terms (scheme, network, asset, amount, payTo, maxTimeoutSeconds, facilitator feePayer).",
        "schema": { "type": "string" }
      },
      "PaymentResponse": {
        "description": "base64-encoded x402 settlement receipt for the accepted payment.",
        "schema": { "type": "string" }
      }
    },
    "responses": {
      "PaymentRequired": {
        "description": "Payment Required (x402). Decode the base64 `payment-required` header to obtain the payment terms, sign the payment, then retry the request with the signed proof in the `X-PAYMENT` request header.",
        "headers": { "payment-required": { "$ref": "#/components/headers/PaymentRequired" } },
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/PaymentRequiredBody" }
          }
        }
      }
    },
    "schemas": {
      "PaymentRequiredBody": {
        "type": "object",
        "description": "x402 v2 payment-required payload (also returned base64-encoded in the `payment-required` header).",
        "properties": {
          "x402Version": { "type": "integer", "const": 2 },
          "error": { "type": "string" },
          "resource": {
            "type": "object",
            "properties": {
              "url": { "type": "string" },
              "description": { "type": "string" },
              "mimeType": { "type": "string" },
              "serviceName": { "type": "string" },
              "tags": { "type": "array", "items": { "type": "string" } }
            }
          },
          "accepts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme": { "type": "string", "const": "exact" },
                "network": { "type": "string" },
                "asset": { "type": "string" },
                "amount": { "type": "string", "description": "Amount in micro-USDC (1000 = $0.001)." },
                "payTo": { "type": "string" },
                "maxTimeoutSeconds": { "type": "integer" },
                "extra": { "type": "object" }
              }
            }
          }
        }
      },
      "PriceResponse": {
        "type": "object",
        "properties": {
          "prices": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "ask": { "type": "string" },
                "bid": { "type": "string" },
                "price": { "type": ["string", "null"] },
                "time": { "type": ["string", "null"] }
              }
            }
          },
          "attribution": { "type": "array", "items": { "type": "string" } }
        }
      },
      "WeatherResponse": {
        "type": "object",
        "properties": {
          "location": { "type": "object" },
          "weather": { "type": "object" },
          "alerts": { "type": "object" },
          "attribution": { "type": "array", "items": { "type": "string" } }
        }
      },
      "StakingResponse": {
        "type": "object",
        "properties": {
          "epoch": { "type": "object" },
          "inflation_apy_pct": { "type": "number" },
          "top_validators": { "type": "array", "items": { "type": "object" } },
          "validator": { "type": "object" },
          "reward_forecast": { "type": "object" },
          "wallet_rewards": { "type": "object" },
          "attribution": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }
}
