{
  "openapi": "3.1.0",
  "info": {
    "title": "PVPWire Game Data API",
    "version": "0.2.0",
    "description": "Structured game-mechanics data for agents and developers: independently compiled facts served free, plus machine-payable premium intelligence computed over PVPWire's own daily-captured economy corpus. PVPWire is not affiliated with or endorsed by the publishers of the games it covers; game names and marks belong to their owners (for example, Diablo is a trademark of Blizzard Entertainment; Path of Exile is a trademark of Grinding Gear Games). PVPWire serves independently compiled game-mechanics facts.",
    "contact": { "url": "https://pvpwire.com/developers/" }
  },
  "servers": [{ "url": "https://pvpwire.com" }],
  "x-payment": {
    "protocol": "x402",
    "manifest": "https://pvpwire.com/.well-known/x402.json",
    "description": "Endpoints under /api/premium/ are machine-payable via x402. Buy a bearer credit token once and decrement per call, or pay per call: request without auth to receive a 402 with the price, pay-to wallet, network, asset, and a quote nonce, then retry with the on-chain tx hash. Full terms in the manifest."
  },
  "paths": {
    "/api/d2/runewords": {
      "get": {
        "summary": "All Diablo 2 runewords",
        "operationId": "getD2Runewords",
        "tags": ["free"],
        "responses": {
          "200": {
            "description": "Envelope with runeword entries",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          }
        }
      }
    },
    "/api/d2/cube-recipes": {
      "get": {
        "summary": "All Horadric Cube recipes",
        "operationId": "getD2CubeRecipes",
        "tags": ["free"],
        "responses": {
          "200": {
            "description": "Envelope with recipe entries",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          }
        }
      }
    },
    "/api/d2/breakpoints": {
      "get": {
        "summary": "Breakpoint tables (FCR, FHR, FBR)",
        "operationId": "getD2Breakpoints",
        "tags": ["free"],
        "parameters": [
          {
            "name": "class",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["amazon", "assassin", "barbarian", "druid", "necromancer", "paladin", "sorceress"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope with breakpoint tables",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          },
          "400": { "description": "Unknown class" }
        }
      }
    },
    "/api/d2/uniques": {
      "get": {
        "summary": "All Diablo 2 unique items",
        "operationId": "getD2Uniques",
        "tags": ["free"],
        "responses": {
          "200": {
            "description": "Envelope with unique item entries",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          }
        }
      }
    },
    "/api/d2/set-items": {
      "get": {
        "summary": "All Diablo 2 set items",
        "operationId": "getD2SetItems",
        "tags": ["free"],
        "responses": {
          "200": {
            "description": "Envelope with set item entries",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          }
        }
      }
    },
    "/api/d2/sets": {
      "get": {
        "summary": "All Diablo 2 item sets",
        "operationId": "getD2Sets",
        "tags": ["free"],
        "responses": {
          "200": {
            "description": "Envelope with item set entries",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          }
        }
      }
    },
    "/api/poe/uniques": {
      "get": {
        "summary": "All Path of Exile unique items",
        "operationId": "getPoeUniques",
        "tags": ["free"],
        "responses": {
          "200": {
            "description": "Envelope with unique item entries",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          }
        }
      }
    },
    "/api/poe/keystones": {
      "get": {
        "summary": "All Path of Exile keystone passives",
        "operationId": "getPoeKeystones",
        "tags": ["free"],
        "responses": {
          "200": {
            "description": "Envelope with keystone entries",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          }
        }
      }
    },
    "/api/economy/{game}": {
      "get": {
        "summary": "Latest daily economy snapshot for one game",
        "operationId": "getEconomySnapshot",
        "tags": ["free"],
        "description": "The most recent daily-captured economy snapshot. The historical time series and computed verdict are the premium product.",
        "parameters": [
          {
            "name": "game",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "enum": ["osrs", "gw2", "ffxiv"] }
          }
        ],
        "responses": {
          "200": { "description": "Latest snapshot for the game" },
          "404": { "description": "Unknown game" }
        }
      }
    },
    "/api/preview/economy-arbitrage-verdict": {
      "get": {
        "summary": "Free preview: top arbitrage pick per game",
        "operationId": "getEconomyArbitrageVerdictPreview",
        "tags": ["free"],
        "description": "No-auth, rate-limited preview of the single top arbitrage pick per tracked game. Use it to evaluate shape and quality before paying for the full ranked verdict.",
        "parameters": [
          {
            "name": "game",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["osrs", "gw2", "ffxiv"] }
          }
        ],
        "responses": {
          "200": { "description": "Top arbitrage pick preview" }
        }
      }
    },
    "/api/premium/economy-arbitrage-verdict": {
      "get": {
        "summary": "Premium: signed cross-market arbitrage verdict (paid)",
        "operationId": "getEconomyArbitrageVerdict",
        "tags": ["premium"],
        "description": "Paid. Signed verdict on the best cross-market arbitrage in a tracked game economy (OSRS, GW2, FFXIV), computed over PVPWire's own daily corpus: the widest sustained spread, the ranked table, volume evidence, and a risk flag. Returns an AFTA Ed25519-signed receipt. Pay via x402: bearer credits or the per-call 402 flow. Free preview of the single top pick at /api/preview/economy-arbitrage-verdict.",
        "security": [{ "x402Credits": [] }, {}],
        "x-402": {
          "manifest": "https://pvpwire.com/.well-known/x402.json",
          "network": "eip155:8453",
          "networkName": "Base mainnet",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "assetSymbol": "USDC",
          "payTo": "0x4daf1d841228ba5d563c4c9f05bc4d57874bf660"
        },
        "parameters": [
          {
            "name": "game",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["osrs", "gw2", "ffxiv"] }
          }
        ],
        "responses": {
          "200": {
            "description": "Signed arbitrage verdict with an AFTA Ed25519 receipt",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } }
          },
          "402": {
            "description": "Payment required. Body carries the price, pay-to wallet, network, asset, and a quote nonce for the per-call flow.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentRequired" } } }
          }
        }
      }
    },
    "/api/stats": {
      "get": {
        "summary": "Public daily agent-traffic stats",
        "operationId": "getStats",
        "tags": ["free"],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": { "type": "integer", "default": 14, "maximum": 90 }
          }
        ],
        "responses": {
          "200": { "description": "Daily hit counts by user-agent class" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "x402Credits": {
        "type": "http",
        "scheme": "bearer",
        "description": "Prepaid credit token from /api/payment/buy-credits, decremented per call. The alternative to the per-call 402 flow. See /.well-known/x402.json."
      }
    },
    "schemas": {
      "Envelope": {
        "type": "object",
        "properties": {
          "data": { "type": "array", "items": { "type": "object" } },
          "meta": {
            "type": "object",
            "properties": {
              "source": { "type": "string" },
              "disclaimer": { "type": "string" },
              "data_version": { "type": "string" },
              "game_patch": { "type": "string" },
              "generated_at": { "type": "string" },
              "license": { "type": "string" },
              "docs": { "type": "string" }
            }
          }
        }
      },
      "PaymentRequired": {
        "type": "object",
        "description": "402 body for a per-call x402 payment.",
        "properties": {
          "price": { "type": "string" },
          "asset": { "type": "string" },
          "assetSymbol": { "type": "string" },
          "network": { "type": "string" },
          "payTo": { "type": "string" },
          "quoteNonce": { "type": "string" },
          "info": { "type": "string" }
        }
      }
    }
  }
}
