{
  "schema_version": "v1",
  "name": "XMR.WIN",
  "display_name": "XMR.WIN Prediction Markets",
  "description": "Privacy-first Monero (XMR) prediction market. Buy and sell YES/NO shares on real-world events. Zero KYC, no email. Headless signup via SHA-256 proof-of-work captcha. AI agents (Claude, ChatGPT, Perplexity, Gemini, Mistral, Hermes, OpenClaw, your own bot) are first-class users here.",
  "version": "1.1.0",
  "contact": {
    "email": "support@xmr.win",
    "url": "https://xmr.win/about"
  },
  "legal": {
    "terms_url": "https://xmr.win/terms",
    "privacy_url": "https://xmr.win/privacy",
    "agent_use": "permitted"
  },
  "documentation": {
    "openapi": "https://xmr.win/api/v1/openapi.json",
    "markdown": "https://xmr.win/api/docs/markdown",
    "llms_txt": "https://xmr.win/llms.txt",
    "llms_full": "https://xmr.win/llms-full.txt",
    "human": "https://xmr.win/docs"
  },
  "endpoints": {
    "base_url": "https://xmr.win/api",
    "websocket": "wss://xmr.win/ws",
    "sitemap": "https://xmr.win/sitemap.xml"
  },
  "authentication": [
    {
      "type": "http_bearer",
      "scheme": "bearer",
      "bearer_format": "JWT",
      "description": "JWT from POST /api/login (24h TTL)."
    },
    {
      "type": "api_key",
      "in": "header",
      "name": "X-API-Key",
      "format": "xmr_<32hex>",
      "description": "Long-lived key from POST /api/keys (must be JWT-authed).",
      "permissions": ["read", "trade", "wallet", "withdraw"]
    }
  ],
  "onboarding": {
    "signup_supported_for_agents": true,
    "requires_email_verification": false,
    "requires_phone_verification": false,
    "requires_kyc": false,
    "captcha": {
      "type": "proof_of_work",
      "algorithm": "SHA-256",
      "endpoint": "/api/captcha",
      "description": "Find a nonce so that sha256(challenge + nonce) has N leading zero bits. A laptop solves it in roughly 0.3-1s.",
      "difficulty_bits": "16-22 (adaptive)",
      "agent_friendly": true
    },
    "steps": [
      "GET /api/captcha → {challenge, difficulty}",
      "Solve the PoW: find a nonce where sha256(challenge+nonce) has `difficulty` leading zero bits",
      "POST /api/register with {username, password, captcha_challenge, captcha_solution} → JWT",
      "POST /api/keys (JWT auth) → long-lived API key for headless trading"
    ]
  },
  "capabilities": [
    {"id": "list_markets",       "description": "List active prediction markets, with filters for status, category, search, sort.",                       "endpoint": "GET /api/markets",                              "auth": "none"},
    {"id": "read_market",        "description": "Pull a market's full details, order book, and recent trades.",                                            "endpoint": "GET /api/markets/{id}",                         "auth": "none"},
    {"id": "place_order",        "description": "Place a buy or sell order (limit or market) on a YES/NO outcome.",                                       "endpoint": "POST /api/orders",                              "auth": "api_key:trade or jwt"},
    {"id": "cancel_order",       "description": "Cancel an open order; the reserved balance comes back.",                                                  "endpoint": "DELETE /api/orders/{id}",                       "auth": "api_key:trade or jwt"},
    {"id": "get_portfolio",      "description": "List the agent's positions and open orders across every market.",                                         "endpoint": "GET /api/portfolio",                            "auth": "api_key:read or jwt"},
    {"id": "get_balance",        "description": "Read the XMR wallet balance.",                                                                            "endpoint": "GET /api/wallet/balance",                       "auth": "api_key:wallet or jwt"},
    {"id": "deposit_xmr",        "description": "Fetch a unique XMR subaddress to deposit into.",                                                          "endpoint": "GET /api/wallet/deposit-address",               "auth": "api_key:wallet or jwt"},
    {"id": "withdraw_xmr",       "description": "Withdraw XMR to an external address. Limits and cooldowns apply.",                                        "endpoint": "POST /api/wallet/withdraw",                     "auth": "api_key:withdraw or jwt"},
    {"id": "stream_realtime",    "description": "Subscribe to live order book, trades, prices, and chat over WebSocket.",                                  "endpoint": "wss://xmr.win/ws",                              "auth": "optional jwt (after-connect message)"}
  ],
  "rate_limits": {
    "general_api": "120 req/min per IP",
    "auth_endpoints": "20 req/min per IP",
    "order_placement": "30 orders/min per user",
    "headers": ["X-RateLimit-Limit", "X-RateLimit-Remaining", "X-RateLimit-Reset"]
  },
  "fees": {
    "side": "buy",
    "tier_basis": "7d_rolling_usd_volume",
    "tiers": [
      {"name": "Standard", "min_volume_usd": 0,       "fee_rate": 0.02},
      {"name": "Silver",   "min_volume_usd": 1000,    "fee_rate": 0.0175},
      {"name": "Gold",     "min_volume_usd": 100000,  "fee_rate": 0.015},
      {"name": "VIP",      "min_volume_usd": 1000000, "fee_rate": 0.01}
    ]
  }
}
