{
  "openapi": "3.1.0",
  "info": {
    "title": "HouseMath",
    "version": "1.0.0",
    "x-guidance": "Analytics API for on-chain degen games (x402, USDC on Base eip155:8453 or Solana). FREE and unpaid: GET /v1/games (tracked-protocol directory), GET /v1/games/{key} (live EV / house-edge headline), GET /v1/games/{key}/audit (published risk audit + findings). All three are rate-limited 30/min and free — no payment required. A paid historical metric time-series tier (x402, USDC on Base/Solana) is coming. Analytics only — never buy/sell advice; analysis is not an endorsement; gambling involves risk of total loss.",
    "summary": "Blockchain gambling intelligence for AI agents — tracked degen-game directory, on-chain risk audits, and live EV / house-edge math. Per-call, no signup. Analytics only — never buy/sell advice; analysis is not an endorsement; gambling involves risk of total loss.",
    "description": "HouseMath (housemath.dev) — multi-protocol degen-game analytics. Free routes serve the tracked-protocol directory, each protocol's live EV / house-edge headline computed from on-chain state, and the full published risk audit (overall risk, methodology, findings). All routes are free in v1; a paid historical metric time-series tier is coming. Analytics only — never buy/sell advice; analysis is not an endorsement; gambling involves risk of total loss.",
    "termsOfService": "https://api.housemath.dev/terms.txt",
    "contact": {
      "name": "HouseMath",
      "url": "https://api.housemath.dev"
    }
  },
  "servers": [
    {
      "url": "https://api.housemath.dev",
      "description": "HouseMath public edge"
    }
  ],
  "externalDocs": {
    "description": "Agent-facing reference (llms.txt)",
    "url": "https://api.housemath.dev/llms.txt"
  },
  "tags": [
    {
      "name": "free",
      "description": "No auth, no payment."
    },
    {
      "name": "paid",
      "description": "x402 V2 per-call pricing (USDC on eip155:8453 or solana)."
    }
  ],
  "paths": {
    "/v1/games": {
      "get": {
        "tags": [
          "free"
        ],
        "operationId": "games",
        "summary": "FREE tracked-protocol directory",
        "description": "Free, no payment. Lists every tracked degen-game protocol (identity + category + chain + status + published risk grade). Use a protocol's `key` in the per-protocol routes.",
        "security": [],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "example": [
                    {
                      "key": "fwa",
                      "name": "FWA (Fake World Assets)",
                      "category": "nft_gacha",
                      "chainId": 1,
                      "status": "tracked",
                      "website": "https://fwa.example",
                      "twitter": null,
                      "riskGrade": "C",
                      "description": "On-chain NFT gacha with backing-weighted draws."
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/games/:key": {
      "get": {
        "tags": [
          "free"
        ],
        "operationId": "game",
        "summary": "FREE protocol headline (live EV / house-edge)",
        "description": "Free, no payment. One protocol's headline: identity + risk grade + LIVE analytics (EV per pull, house edge, pull price) computed from on-chain state, plus freshness. If a live read is temporarily unavailable, `analytics` is null with a note (never a 500).",
        "security": [],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "example": {
                    "key": "fwa",
                    "name": "FWA (Fake World Assets)",
                    "category": "nft_gacha",
                    "chainId": 1,
                    "status": "tracked",
                    "riskGrade": "C",
                    "analytics": {
                      "evPerPullEth": -0.0091,
                      "evPerPullWei": "-9100000000000000",
                      "houseEdgePct": 0.12,
                      "pullPriceWei": "75000000000000000"
                    },
                    "source": {
                      "kind": "live",
                      "chainId": 1,
                      "at": "2026-08-15T00:00:00.000Z"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/games/:key/audit": {
      "get": {
        "tags": [
          "free"
        ],
        "operationId": "audit",
        "summary": "FREE published risk audit",
        "description": "Free, no payment. The published contract risk audit for a protocol: overall risk, summary, methodology, scope, and the findings list (code / severity / category / title / summary / status). Full finding `detail` is omitted from the list; add ?full=1 to include it. 404 if no audit is published for that protocol.",
        "parameters": [
          {
            "name": "full",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Set ?full=1 to include each finding's full markdown detail."
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "example": {
                    "key": "fwa",
                    "version": 1,
                    "status": "published",
                    "overallRisk": "elevated",
                    "summary": "Backing-weighted gacha with elevated economic + admin risk.",
                    "publishedAt": "2026-08-15T00:00:00.000Z",
                    "findings": [
                      {
                        "code": "FWA-01",
                        "severity": "high",
                        "category": "economic",
                        "title": "Negative expected value per pull",
                        "summary": "House edge structurally favours the contract.",
                        "status": "open"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "PaymentRequired": {
        "description": "x402 V2 payment challenge. Sign an `exact` USDC authorization for one accepts[] rail, then retry with the PAYMENT-SIGNATURE (V2) or X-PAYMENT (legacy) header. You are not charged for errors or below-threshold answers.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PaymentRequired"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "x402": {
        "type": "http",
        "scheme": "x402",
        "description": "Custom HTTP 402 payment flow (x402 V2). The server answers an unpaid paid-route request with a 402 whose body is a PaymentRequired envelope (x402Version + accepts[] + terms). Each accepts[] entry is an `exact`-scheme USDC rail. Sign ONE rail and retry the same request with the `PAYMENT-SIGNATURE` header (x402 V2 clients) or the legacy `X-PAYMENT` header. Per-call pricing."
      }
    },
    "schemas": {
      "PaymentRequired": {
        "type": "object",
        "description": "x402 V2 PaymentRequired envelope. accepts[] lists one exact USDC rail per network.",
        "properties": {
          "x402Version": {
            "type": "integer",
            "const": 2
          },
          "accepts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme": {
                  "type": "string",
                  "const": "exact"
                },
                "network": {
                  "type": "string",
                  "enum": [
                    "eip155:8453",
                    "solana"
                  ]
                },
                "asset": {
                  "type": "string",
                  "const": "USDC"
                },
                "price": {
                  "type": "string",
                  "description": "USD price string."
                },
                "payTo": {
                  "type": "string",
                  "description": "Settlement address for this rail."
                },
                "mimeType": {
                  "type": "string",
                  "const": "application/json"
                }
              }
            }
          },
          "terms": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  }
}
