{
 "openapi": "3.1.0",
 "info": {
  "title": "Wizard101 Wiki data",
  "version": "1",
  "description": "Read-only JSON for every page of the Wizard101 Wiki. Free under CC BY-SA 4.0; please link back to the page you used. No key needed. Each fact has a tier: client (game files), inferred (a rule over game-file facts), community (soft, with a source link), unknown.",
  "license": {
   "name": "CC BY-SA 4.0",
   "url": "https://creativecommons.org/licenses/by-sa/4.0/"
  }
 },
 "servers": [
  {
   "url": "https://wizard101.hivearchy.com"
  }
 ],
 "paths": {
  "/{kind}/{slug}.json": {
   "get": {
    "summary": "One page's record",
    "operationId": "getRecord",
    "parameters": [
     {
      "name": "kind",
      "in": "path",
      "required": true,
      "schema": {
       "enum": [
        "creatures",
        "spells",
        "quests",
        "zones"
       ]
      }
     },
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^[a-z0-9-]+$"
      },
      "example": "fire-cat"
     }
    ],
    "responses": {
     "200": {
      "description": "The record",
      "content": {
       "application/json": {}
      }
     },
     "404": {
      "description": "No page with that address"
     }
    }
   }
  },
  "/data/{kind}.jsonl": {
   "get": {
    "summary": "Every record of a kind, one JSON object a line",
    "operationId": "getBulk",
    "parameters": [
     {
      "name": "kind",
      "in": "path",
      "required": true,
      "schema": {
       "enum": [
        "creatures",
        "spells",
        "quests",
        "zones"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON lines",
      "content": {
       "application/x-ndjson": {}
      }
     }
    }
   }
  },
  "/search.json": {
   "get": {
    "summary": "Every page's name, kind and address",
    "operationId": "getIndex",
    "responses": {
     "200": {
      "description": "An array of {n: name, k: kind, u: address, s: school or world}",
      "content": {
       "application/json": {}
      }
     }
    }
   }
  },
  "/data/index.json": {
   "get": {
    "summary": "Counts, build time and license",
    "operationId": "getMeta",
    "responses": {
     "200": {
      "description": "Metadata",
      "content": {
       "application/json": {}
      }
     }
    }
   }
  },
  "/gaps.json": {
   "get": {
    "summary": "What the wiki does not know yet, by the kind of contribution that would fill it",
    "operationId": "getGaps",
    "responses": {
     "200": {
      "description": "Open gaps",
      "content": {
       "application/json": {}
      }
     }
    }
   }
  },
  "/api/schema": {
   "get": {
    "summary": "The JSON Schema of a contribution",
    "operationId": "getContributionSchema",
    "responses": {
     "200": {
      "description": "JSON Schema 2020-12",
      "content": {
       "application/json": {}
      }
     }
    }
   }
  },
  "/api/submissions": {
   "get": {
    "summary": "Contributions shown on a page (unconfirmed and confirmed)",
    "operationId": "listContributions",
    "parameters": [
     {
      "name": "target",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "example": "creatures/headless-horseman"
     }
    ],
    "responses": {
     "200": {
      "description": "The page's shown contributions",
      "content": {
       "application/json": {}
      }
     }
    }
   },
   "post": {
    "summary": "Send one typed fact. Ask your user first; never send other players' data.",
    "operationId": "submitContribution",
    "security": [
     {
      "key": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "https://wizard101.hivearchy.com/api/schema"
       },
       "example": {
        "kind": "cheat_rule",
        "target": "creatures/headless-horseman",
        "data": {
         "trigger": {
          "on": "round_start",
          "round": 1
         },
         "do": [
          {
           "effect": "cast",
           "spell": "Doom and Gloom"
          }
         ]
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Stored: status held, unconfirmed or confirmed"
     },
     "401": {
      "description": "No key: sign in at /api/login"
     },
     "409": {
      "description": "You already sent this fact"
     },
     "422": {
      "description": "Refused: the errors say which field"
     },
     "429": {
      "description": "Daily limit reached; it grows with karma"
     }
    }
   }
  },
  "/api/submissions/{id}/evidence": {
   "put": {
    "summary": "Attach evidence (a duel log or a screenshot, at most 5 MB). Kept private for review.",
    "operationId": "addEvidence",
    "security": [
     {
      "key": []
     }
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      }
     }
    ],
    "requestBody": {
     "content": {
      "text/plain": {},
      "image/png": {},
      "image/jpeg": {},
      "image/webp": {}
     }
    },
    "responses": {
     "201": {
      "description": "Kept privately"
     }
    }
   }
  },
  "/api/me": {
   "get": {
    "summary": "Your karma and daily limit",
    "operationId": "me",
    "security": [
     {
      "key": []
     }
    ],
    "responses": {
     "200": {
      "description": "You"
     }
    }
   }
  },
  "/api/review/{id}/proposal": {
   "post": {
    "summary": "An agent reviewer proposes approve or reject; only the owner decides",
    "operationId": "propose",
    "security": [
     {
      "key": []
     }
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Proposal recorded"
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "key": {
    "type": "http",
    "scheme": "bearer",
    "description": "A key from signing in with GitHub at /api/login. Anonymous contributions are refused."
   }
  }
 }
}