{
 "openapi": "3.1.0",
 "info": {
  "title": "WikiVectors API",
  "version": "1.0.0",
  "description": "Hybrid (keyword + meaning) search over English Wikipedia. Returns short, citable paragraphs. Text is from Wikipedia under CC BY-SA 4.0: show the attribution line with any text you display. /v1/answer writes a short cited answer from those paragraphs."
 },
 "servers": [
  {
   "url": "https://wikivectors.com"
  }
 ],
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/v1/search": {
   "post": {
    "operationId": "search",
    "summary": "Search Wikipedia passages",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "query"
        ],
        "additionalProperties": false,
        "properties": {
         "query": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "example": "what causes the northern lights"
         },
         "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 20,
          "default": 5
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Ranked passages",
      "headers": {
       "X-RateLimit-Limit": {
        "description": "Searches allowed this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Remaining": {
        "description": "Searches left this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Reset": {
        "description": "Unix time when the monthly count resets (start of next month, UTC)",
        "schema": {
         "type": "integer"
        }
       },
       "X-Credits-Remaining": {
        "description": "Prepaid searches left on your account. They are only used after this month's free searches run out, so 0 is normal if you never bought any.",
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SearchResponse"
        },
        "example": {
         "results": [
          {
           "passage_id": 25634047,
           "page_id": 66151,
           "title": "Northern Lights",
           "section": "",
           "text": "Northern lights most commonly refers to the aurora borealis, a natural light display in Earth's sky.",
           "url": "https://en.wikipedia.org/wiki/Northern_Lights",
           "permalink": "https://en.wikipedia.org/w/index.php?oldid=1373201432",
           "revision_id": 1373201432,
           "license": "CC BY-SA 4.0",
           "attribution": "\"Northern Lights\" by Wikipedia contributors, CC BY-SA 4.0, https://en.wikipedia.org/w/index.php?oldid=1373201432",
           "score": 0.912,
           "exact_title_match": true,
           "description": null,
           "wikidata_id": null
          }
         ],
         "mode": "hybrid",
         "index_synced_at": "2026-11-25T15:48:48Z",
         "request_id": "req_5a5ca739bad3b91e"
        }
       }
      }
     },
     "400": {
      "description": "The body is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid API key",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited (over 10 requests a second; see Retry-After) or quota_exceeded (monthly searches used up)",
      "headers": {
       "X-RateLimit-Limit": {
        "description": "Searches allowed this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Remaining": {
        "description": "Searches left this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Reset": {
        "description": "Unix time when the monthly count resets (start of next month, UTC)",
        "schema": {
         "type": "integer"
        }
       },
       "X-Credits-Remaining": {
        "description": "Prepaid searches left on your account. They are only used after this month's free searches run out, so 0 is normal if you never bought any.",
        "schema": {
         "type": "integer"
        }
       },
       "Retry-After": {
        "$ref": "#/components/headers/Retry-After"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "503": {
      "description": "Search is briefly unavailable; retry",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/pages": {
   "post": {
    "operationId": "getPages",
    "summary": "Get pages by exact title",
    "description": "Look up 1 to 20 pages by exact title in one call. Case is ignored, underscores count as spaces, and redirects are followed (\"JFK\" gives \"John F. Kennedy\"). When two pages differ only by case, the one matching your case wins. Each title counts as one search, found or not. If your key doesn't have enough searches left for every title, nothing is used and you get quota_exceeded.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "titles"
        ],
        "additionalProperties": false,
        "properties": {
         "titles": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
           "type": "string",
           "minLength": 1,
           "maxLength": 300
          },
          "example": [
           "Ada Lovelace",
           "JFK",
           "Not A Real Page"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "One entry per title, in order",
      "headers": {
       "X-RateLimit-Limit": {
        "description": "Searches allowed this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Remaining": {
        "description": "Searches left this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Reset": {
        "description": "Unix time when the monthly count resets (start of next month, UTC)",
        "schema": {
         "type": "integer"
        }
       },
       "X-Credits-Remaining": {
        "description": "Prepaid searches left on your account. They are only used after this month's free searches run out, so 0 is normal if you never bought any.",
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PagesResponse"
        },
        "example": {
         "pages": [
          {
           "query": "JFK",
           "found": true,
           "page_id": 5119376,
           "title": "John F. Kennedy",
           "redirected_from": "JFK",
           "description": "President of the United States from 1961 to 1963",
           "wikidata_id": "Q9696",
           "disambiguation": false,
           "is_person": true,
           "section": "",
           "text": "John Fitzgerald Kennedy (May 29, 1917 – November 22, 1963), also known as JFK, was the 35th president of the United States...",
           "url": "https://en.wikipedia.org/wiki/John_F._Kennedy",
           "permalink": "https://en.wikipedia.org/w/index.php?oldid=1324000000",
           "revision_id": 1324000000,
           "license": "CC BY-SA 4.0",
           "attribution": "\"John F. Kennedy\" by Wikipedia contributors, CC BY-SA 4.0, https://en.wikipedia.org/w/index.php?oldid=1324000000"
          },
          {
           "query": "Not A Real Page",
           "found": false
          }
         ],
         "index_synced_at": "2026-11-25T18:00:00Z",
         "request_id": "req_5a5ca739bad3b91e"
        }
       }
      }
     },
     "400": {
      "description": "The body is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid API key",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited (over 10 requests a second; see Retry-After) or quota_exceeded (monthly searches used up)",
      "headers": {
       "X-RateLimit-Limit": {
        "description": "Searches allowed this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Remaining": {
        "description": "Searches left this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Reset": {
        "description": "Unix time when the monthly count resets (start of next month, UTC)",
        "schema": {
         "type": "integer"
        }
       },
       "X-Credits-Remaining": {
        "description": "Prepaid searches left on your account. They are only used after this month's free searches run out, so 0 is normal if you never bought any.",
        "schema": {
         "type": "integer"
        }
       },
       "Retry-After": {
        "$ref": "#/components/headers/Retry-After"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "503": {
      "description": "Search is briefly unavailable; retry",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/answer": {
   "post": {
    "operationId": "answer",
    "summary": "Answer a question, with cited sources",
    "description": "Ask a question in plain words. It runs a search, gives the top 5 passages to an AI model, and returns the shortest accurate answer (answer, like \"Ada Lovelace\", or \"Yes\"/\"No\") and 1 to 3 sentences (detail) written only from those passages. In detail, each fact is followed by citation numbers like [1]; sources lists the passages cited, with ref matching those numbers. When the passages don't answer it, answered is false and answer and detail are null. Each answer counts as 5 searches (free ones first, then credits), answered or not. If the AI model fails, nothing is charged and you get answer_unavailable (503). Answers can also be paused for a while (answer_unavailable); /v1/search keeps working.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "query"
        ],
        "additionalProperties": false,
        "properties": {
         "query": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "example": "What causes the northern lights?"
         },
         "options": {
          "type": "array",
          "minItems": 2,
          "maxItems": 10,
          "items": {
           "type": "string",
           "minLength": 1,
           "maxLength": 200
          },
          "description": "Optional choices to pick from. The answer is then one of them, exactly as sent (also in choice), or \"None of these\". A pick that isn't one of them gives answered false.",
          "example": [
           "over 30,000 ft",
           "under 30,000 ft"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "A short answer and the passages it cites",
      "headers": {
       "X-RateLimit-Limit": {
        "description": "Searches allowed this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Remaining": {
        "description": "Searches left this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Reset": {
        "description": "Unix time when the monthly count resets (start of next month, UTC)",
        "schema": {
         "type": "integer"
        }
       },
       "X-Credits-Remaining": {
        "description": "Prepaid searches left on your account. They are only used after this month's free searches run out, so 0 is normal if you never bought any.",
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AnswerResponse"
        },
        "example": {
         "answer": "Charged particles from the solar wind",
         "detail": "The northern lights happen when charged particles from the solar wind hit gases high in Earth's atmosphere [1]. They are seen mostly near the poles [1][2].",
         "answered": true,
         "sources": [
          {
           "ref": 1,
           "passage_id": 81233001,
           "page_id": 1980,
           "title": "Aurora",
           "section": "",
           "text": "An aurora is a natural light display in Earth's sky, predominantly seen in high-latitude regions...",
           "url": "https://en.wikipedia.org/wiki/Aurora",
           "permalink": "https://en.wikipedia.org/w/index.php?oldid=1323000000",
           "revision_id": 1323000000,
           "license": "CC BY-SA 4.0",
           "attribution": "\"Aurora\" by Wikipedia contributors, CC BY-SA 4.0, https://en.wikipedia.org/w/index.php?oldid=1323000000",
           "score": 0.91,
           "exact_title_match": false,
           "description": "Natural light display in Earth's sky",
           "wikidata_id": "Q42651"
          },
          {
           "ref": 2,
           "passage_id": 81233004,
           "page_id": 1980,
           "title": "Aurora",
           "section": "Occurrence",
           "text": "Auroras are most often seen within the auroral zones, bands about 2,500 km from the magnetic poles...",
           "url": "https://en.wikipedia.org/wiki/Aurora#Occurrence",
           "permalink": "https://en.wikipedia.org/w/index.php?oldid=1323000000",
           "revision_id": 1323000000,
           "license": "CC BY-SA 4.0",
           "attribution": "\"Aurora\" by Wikipedia contributors, CC BY-SA 4.0, https://en.wikipedia.org/w/index.php?oldid=1323000000",
           "score": 0.84,
           "exact_title_match": false,
           "description": "Natural light display in Earth's sky",
           "wikidata_id": "Q42651"
          }
         ],
         "model": "deepseek/deepseek-v4.1-flash",
         "searches_charged": 5,
         "mode": "hybrid",
         "index_synced_at": "2026-11-25T18:00:00Z",
         "request_id": "req_5a5ca739bad3b91e"
        }
       }
      }
     },
     "400": {
      "description": "The body is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid API key",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited (over 10 requests a second; see Retry-After) or quota_exceeded (fewer than 5 searches left this month)",
      "headers": {
       "X-RateLimit-Limit": {
        "description": "Searches allowed this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Remaining": {
        "description": "Searches left this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Reset": {
        "description": "Unix time when the monthly count resets (start of next month, UTC)",
        "schema": {
         "type": "integer"
        }
       },
       "X-Credits-Remaining": {
        "description": "Prepaid searches left on your account. They are only used after this month's free searches run out, so 0 is normal if you never bought any.",
        "schema": {
         "type": "integer"
        }
       },
       "Retry-After": {
        "$ref": "#/components/headers/Retry-After"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "503": {
      "description": "answer_unavailable (answers are paused, or the AI model failed: nothing was charged; retry later or use /v1/search) or search_unavailable (retry)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/changes": {
   "get": {
    "operationId": "listChanges",
    "summary": "List recent Wikipedia page changes",
    "description": "Pages created, edited, moved or removed on English Wikipedia, as the WikiVectors index applied them (usually within the hour). Kept for 30 days. Each call counts as one search against your quota. Poll it with `after` to watch pages.",
    "parameters": [
     {
      "name": "pages",
      "in": "query",
      "description": "Up to 50 page titles separated by |. Underscores or spaces both work. Leave out for every page.",
      "schema": {
       "type": "string"
      },
      "example": "Ada_Lovelace|Telephone"
     },
     {
      "name": "since",
      "in": "query",
      "description": "Only changes recorded at or after this time (RFC 3339). Default: 24 hours ago.",
      "schema": {
       "type": "string",
       "format": "date-time"
      }
     },
     {
      "name": "after",
      "in": "query",
      "description": "Only changes with a change_id above this. Pass back next_after to page on.",
      "schema": {
       "type": "integer",
       "minimum": 0
      }
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 500,
       "default": 100
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Changes, oldest first",
      "headers": {
       "X-RateLimit-Limit": {
        "description": "Searches allowed this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Remaining": {
        "description": "Searches left this month",
        "schema": {
         "type": "integer"
        }
       },
       "X-RateLimit-Reset": {
        "description": "Unix time when the monthly count resets (start of next month, UTC)",
        "schema": {
         "type": "integer"
        }
       },
       "X-Credits-Remaining": {
        "description": "Prepaid searches left on your account. They are only used after this month's free searches run out, so 0 is normal if you never bought any.",
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ChangesResponse"
        }
       }
      }
     },
     "400": {
      "description": "A parameter is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid API key",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited or quota_exceeded",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Retry-After": {
        "$ref": "#/components/headers/Retry-After"
       }
      }
     },
     "503": {
      "description": "The change feed is briefly unavailable; retry",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/watches": {
   "post": {
    "operationId": "createWatch",
    "summary": "Watch a Wikipedia page",
    "description": "We POST a signed JSON callback to callback_url each time the page is edited, moved or removed (as our index applies it, usually within the hour). Costs no searches; at most 100 watches per key. The secret is shown only in this answer. Each callback has headers X-WikiVectors-Signature (t=<unix>,v1=<hex HMAC-SHA256 of \"<unix>.<raw body>\" with the secret>), X-WikiVectors-Delivery and X-WikiVectors-Watch. Answer 2xx within 10 s. Failed callbacks are retried with backoff (1 min doubling to 1 h) for 24 hours; then the watch is marked failing and gets no new callbacks until you make it again. Redirects are not followed.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "page",
         "callback_url"
        ],
        "properties": {
         "page": {
          "type": "string",
          "description": "The article's title, or its https://en.wikipedia.org/wiki/... link.",
          "example": "Ada Lovelace"
         },
         "callback_url": {
          "type": "string",
          "format": "uri",
          "description": "A public https:// URL. Private, loopback and link-local addresses are refused.",
          "example": "https://example.com/hooks/wikivectors"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Watch made",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "watch": {
           "$ref": "#/components/schemas/Watch"
          },
          "request_id": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "invalid_request or invalid_callback_url",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid API key",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "too_many_watches",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "page_not_found: no article has that title",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "409": {
      "description": "watch_exists: this key already watches this page with this callback_url",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Retry-After": {
        "$ref": "#/components/headers/Retry-After"
       }
      }
     }
    }
   },
   "get": {
    "operationId": "listWatches",
    "summary": "List your watches",
    "responses": {
     "200": {
      "description": "This key's watches, oldest first (no secrets)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "watches": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Watch"
           }
          },
          "request_id": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid API key",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Retry-After": {
        "$ref": "#/components/headers/Retry-After"
       }
      }
     }
    }
   }
  },
  "/v1/watches/{id}": {
   "delete": {
    "operationId": "deleteWatch",
    "summary": "Stop watching",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      }
     }
    ],
    "responses": {
     "204": {
      "description": "Removed"
     },
     "401": {
      "description": "Missing or invalid API key",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "watch_not_found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer",
    "description": "Your key, wv_live_…"
   }
  },
  "schemas": {
   "Error": {
    "type": "object",
    "required": [
     "error"
    ],
    "properties": {
     "error": {
      "type": "object",
      "required": [
       "code",
       "message",
       "request_id"
      ],
      "properties": {
       "code": {
        "type": "string",
        "enum": [
         "missing_api_key",
         "invalid_api_key",
         "invalid_request",
         "rate_limited",
         "quota_exceeded",
         "search_unavailable",
         "not_found",
         "method_not_allowed",
         "invalid_callback_url",
         "page_not_found",
         "watch_exists",
         "too_many_watches",
         "watch_not_found",
         "answer_unavailable"
        ],
        "description": "missing_api_key, invalid_api_key (401); invalid_request, invalid_callback_url (400); rate_limited (429, over 10 requests a second: wait Retry-After seconds); quota_exceeded (429, monthly searches used up); page_not_found, watch_not_found, not_found (404); watch_exists (409); too_many_watches (403); method_not_allowed (405); search_unavailable (503, retry); answer_unavailable (503: answers paused or the AI model failed, nothing charged)."
       },
       "message": {
        "type": "string"
       },
       "request_id": {
        "type": "string",
        "example": "req_3f9c0a1b2c3d4e5f"
       }
      }
     }
    }
   },
   "Result": {
    "type": "object",
    "properties": {
     "passage_id": {
      "type": "integer"
     },
     "page_id": {
      "type": "integer",
      "description": "Wikipedia page id"
     },
     "title": {
      "type": "string"
     },
     "section": {
      "type": "string",
      "description": "Section heading; empty for the lead"
     },
     "text": {
      "type": "string",
      "description": "The paragraph"
     },
     "url": {
      "type": "string",
      "format": "uri"
     },
     "permalink": {
      "type": "string",
      "format": "uri",
      "description": "Link to the exact revision searched"
     },
     "revision_id": {
      "type": "integer"
     },
     "license": {
      "type": "string",
      "example": "CC BY-SA 4.0"
     },
     "attribution": {
      "type": "string",
      "description": "Ready-to-paste credit line"
     },
     "score": {
      "type": "number",
      "description": "First-pass search score (meaning and word match, plus title and popularity bonuses). Results are already in best-first order, set by a reranker, so do not re-sort by score"
     },
     "exact_title_match": {
      "type": "boolean",
      "description": "true when the page title is the query (any case; spaces and underscores alike). Easier to act on than score. For names that are redirects (JFK), use /v1/pages."
     },
     "description": {
      "type": [
       "string",
       "null"
      ],
      "description": "The page's short description, e.g. \"American financier\". Helps tell apart pages that share a name. null when the page has none."
     },
     "wikidata_id": {
      "type": [
       "string",
       "null"
      ],
      "description": "The page's Wikidata item, e.g. \"Q193156\". A stable id for the person, place or thing. null when it has none."
     }
    }
   },
   "SearchResponse": {
    "type": "object",
    "properties": {
     "results": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Result"
      }
     },
     "mode": {
      "type": "string",
      "enum": [
       "hybrid",
       "keyword"
      ],
      "description": "keyword when meaning search was briefly unavailable"
     },
     "index_synced_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "When the index last caught up with Wikipedia"
     },
     "request_id": {
      "type": "string"
     }
    }
   },
   "Change": {
    "type": "object",
    "required": [
     "change_id",
     "page_id",
     "title",
     "kind",
     "url",
     "recorded_at"
    ],
    "properties": {
     "change_id": {
      "type": "integer"
     },
     "page_id": {
      "type": "integer"
     },
     "title": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "created",
       "edited",
       "moved",
       "removed"
      ]
     },
     "old_revision_id": {
      "type": [
       "integer",
       "null"
      ]
     },
     "new_revision_id": {
      "type": [
       "integer",
       "null"
      ]
     },
     "old_title": {
      "type": "string",
      "description": "The title before a move"
     },
     "changed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "When Wikipedia made the change"
     },
     "recorded_at": {
      "type": "string",
      "format": "date-time",
      "description": "When our index applied it"
     },
     "url": {
      "type": "string"
     },
     "diff_url": {
      "type": "string",
      "description": "Wikipedia's diff page, for edits"
     }
    }
   },
   "ChangesResponse": {
    "type": "object",
    "required": [
     "changes",
     "next_after",
     "request_id"
    ],
    "properties": {
     "changes": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Change"
      }
     },
     "next_after": {
      "type": "integer",
      "description": "Pass as after= to get the next page"
     },
     "request_id": {
      "type": "string"
     }
    }
   },
   "Watch": {
    "type": "object",
    "properties": {
     "id": {
      "type": "integer"
     },
     "page_id": {
      "type": "integer"
     },
     "title": {
      "type": "string"
     },
     "url": {
      "type": "string"
     },
     "callback_url": {
      "type": "string"
     },
     "secret": {
      "type": "string",
      "description": "whsec_…, only when the watch is made"
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "failing"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "last_sent_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "failing_since": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "WatchCallback": {
    "type": "object",
    "description": "The JSON body we POST to callback_url.",
    "properties": {
     "type": {
      "type": "string",
      "const": "page.changed"
     },
     "watch_id": {
      "type": "integer"
     },
     "page": {
      "type": "object",
      "properties": {
       "page_id": {
        "type": "integer"
       },
       "title": {
        "type": "string"
       },
       "url": {
        "type": "string"
       }
      }
     },
     "change": {
      "type": "object",
      "properties": {
       "change_id": {
        "type": "integer"
       },
       "kind": {
        "type": "string",
        "enum": [
         "created",
         "edited",
         "moved",
         "removed"
        ]
       },
       "old_revision_id": {
        "type": [
         "integer",
         "null"
        ]
       },
       "new_revision_id": {
        "type": [
         "integer",
         "null"
        ]
       },
       "old_title": {
        "type": [
         "string",
         "null"
        ]
       },
       "changed_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       },
       "recorded_at": {
        "type": "string",
        "format": "date-time"
       },
       "diff_url": {
        "type": [
         "string",
         "null"
        ]
       }
      }
     }
    }
   },
   "Page": {
    "type": "object",
    "required": [
     "query",
     "found"
    ],
    "properties": {
     "query": {
      "type": "string",
      "description": "The title you sent, as sent"
     },
     "found": {
      "type": "boolean",
      "description": "false when no page or redirect has this title; the other fields are then left out"
     },
     "page_id": {
      "type": "integer"
     },
     "title": {
      "type": "string",
      "description": "The page's real title"
     },
     "redirected_from": {
      "type": "string",
      "description": "Set when the title you sent is a redirect, e.g. JFK"
     },
     "description": {
      "type": "string",
      "description": "Short description, e.g. \"President of the United States from 1961 to 1963\". Left out when the page has none."
     },
     "wikidata_id": {
      "type": "string",
      "description": "Wikidata item, e.g. \"Q9696\". Left out when the page has none."
     },
     "disambiguation": {
      "type": "boolean",
      "description": "true when the page is a list of namesakes (\"Brookfield may refer to: ...\"), not one topic. Try a more exact title or search. Set on every found page."
     },
     "is_person": {
      "type": "boolean",
      "description": "true when the page is about one person (Wikipedia files it under a birth or death year, or \"Living people\"). A person's name can redirect to an event page (\"Erin Patterson\" gives \"Leongatha mushroom murders\", is_person false). Set on every found page."
     },
     "section": {
      "type": "string",
      "description": "Usually empty: the opening passage has no section"
     },
     "text": {
      "type": "string",
      "description": "The page's opening passage (its first paragraph or two)"
     },
     "url": {
      "type": "string"
     },
     "permalink": {
      "type": "string",
      "description": "Link to this exact revision"
     },
     "revision_id": {
      "type": "integer"
     },
     "license": {
      "type": "string"
     },
     "attribution": {
      "type": "string"
     }
    }
   },
   "PagesResponse": {
    "type": "object",
    "required": [
     "pages",
     "request_id"
    ],
    "properties": {
     "pages": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Page"
      },
      "description": "One per title sent, in the same order"
     },
     "index_synced_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "request_id": {
      "type": "string"
     }
    }
   },
   "AnswerResponse": {
    "type": "object",
    "required": [
     "answer",
     "detail",
     "answered",
     "sources",
     "searches_charged",
     "mode",
     "index_synced_at",
     "request_id"
    ],
    "properties": {
     "answer": {
      "type": [
       "string",
       "null"
      ],
      "description": "The shortest accurate answer: a name, number, date or a few words (e.g. \"Ada Lovelace\"); \"Yes\" or \"No\" for a yes/no question. No citations. null when answered is false."
     },
     "detail": {
      "type": [
       "string",
       "null"
      ],
      "description": "1 to 3 sentences with citation numbers like [1] that back up the answer. null when answered is false."
     },
     "answered": {
      "type": "boolean",
      "description": "false when Wikipedia's passages don't answer the question"
     },
     "choice": {
      "type": "string",
      "description": "Only when options were sent: the option picked, exactly as sent. Left out when none fits (answer is \"None of these\") or when not answered."
     },
     "sources": {
      "type": "array",
      "description": "The passages the answer cites, by ref. Empty when answered is false.",
      "items": {
       "allOf": [
        {
         "type": "object",
         "required": [
          "ref"
         ],
         "properties": {
          "ref": {
           "type": "integer",
           "description": "The number used in the answer, e.g. 1 for [1]"
          }
         }
        },
        {
         "$ref": "#/components/schemas/Result"
        }
       ]
      }
     },
     "model": {
      "type": "string",
      "description": "The AI model that wrote the answer"
     },
     "searches_charged": {
      "type": "integer",
      "description": "Searches this call used (5)"
     },
     "mode": {
      "type": "string",
      "enum": [
       "hybrid",
       "keyword"
      ]
     },
     "index_synced_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "request_id": {
      "type": "string"
     }
    }
   }
  },
  "headers": {
   "Retry-After": {
    "description": "Seconds to wait before retrying. Sent with rate_limited.",
    "schema": {
     "type": "integer",
     "example": 1
    }
   }
  }
 }
}
