{
 "openapi": "3.1.0",
 "info": {
  "title": "mhub-api — magalia.wiki research API",
  "description": "Public read-only JSON API behind https://magalia.wiki/api/.\nFull-text search (websearch syntax: quoted phrases, -negation,\nprefix*), facet aggregations, authority resolution, named-entity\nmentions, dictionary gloss, source-attributed retrieval, and\nsemantic similarity over the magalia epigraphic + literary +\npapyrological corpora. Counts are snapshot-pinned; see\n/data-status.html for provenance classes.",
  "version": "0.6.0"
 },
 "paths": {
  "/api/health": {
   "get": {
    "summary": "Health",
    "operationId": "health_api_health_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Health Api Health Get"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/retrieve": {
   "get": {
    "tags": [
     "rag"
    ],
    "summary": "Retrieve",
    "description": "Cited, source-attributed passages for a query (the grounding tool).\n\nReturns  { q, scoped, passages: [ {kind, ns, id, display_id, title,\ncitation, text, license, source}, … ] }  — the exact shape\njs/magalia-rag.js renders into numbered SOURCES and [n] chips.",
    "operationId": "retrieve_api_retrieve_get",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 2,
       "maxLength": 200,
       "title": "Q"
      }
     },
     {
      "name": "k",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 20,
       "minimum": 1,
       "default": 8,
       "title": "K"
      }
     },
     {
      "name": "ns",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "restrict the corpus leg: single ns or comma list, e.g. edh-derived,papyri",
       "title": "Ns"
      },
      "description": "restrict the corpus leg: single ns or comma list, e.g. edh-derived,papyri"
     },
     {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "maxLength": 800
        },
        {
         "type": "null"
        }
       ],
       "description": "page-priority items read FIRST, comma list of ns/id, e.g. edh-derived/HD000001,latinLit/phi0474.phi024:1",
       "title": "Ids"
      },
      "description": "page-priority items read FIRST, comma list of ns/id, e.g. edh-derived/HD000001,latinLit/phi0474.phi024:1"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Retrieve Api Retrieve Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "staged"
  },
  "/api/gloss": {
   "get": {
    "tags": [
     "gloss_authority"
    ],
    "summary": "Gloss",
    "description": "Resolve a clicked word to a compact, source-attributed bundle:\ndictionary sense (lemma), name/mythology gloss (Smith), place card (Pleiades).",
    "operationId": "gloss_api_gloss_get",
    "parameters": [
     {
      "name": "word",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "title": "Word"
      }
     },
     {
      "name": "lang",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "",
       "title": "Lang"
      }
     },
     {
      "name": "ns",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "",
       "title": "Ns"
      }
     },
     {
      "name": "id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "",
       "title": "Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/search": {
   "get": {
    "summary": "Search",
    "description": "Full-text search over inscriptions.\n\nReturns paged rows with ts_headline-snippet on the matched portion.",
    "operationId": "search_api_search_get",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 200,
       "title": "Q"
      }
     },
     {
      "name": "ns",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ns"
      }
     },
     {
      "name": "page",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Page"
      }
     },
     {
      "name": "size",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 200,
       "minimum": 1,
       "default": 50,
       "title": "Size"
      }
     },
     {
      "name": "fidelity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Fidelity"
      }
     },
     {
      "name": "material",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "canonical material label, e.g. Marble",
       "title": "Material"
      },
      "description": "canonical material label, e.g. Marble"
     },
     {
      "name": "object_type",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "canonical object type, e.g. Altar",
       "title": "Object Type"
      },
      "description": "canonical object type, e.g. Altar"
     },
     {
      "name": "place",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "canonical findspot place, e.g. Catina",
       "title": "Place"
      },
      "description": "canonical findspot place, e.g. Catina"
     },
     {
      "name": "period",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Period"
      }
     },
     {
      "name": "language",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Language"
      }
     },
     {
      "name": "text_type",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Text Type"
      }
     },
     {
      "name": "date_from",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "earliest year, BC negative",
       "title": "Date From"
      },
      "description": "earliest year, BC negative"
     },
     {
      "name": "date_to",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "latest year, BC negative",
       "title": "Date To"
      },
      "description": "latest year, BC negative"
     },
     {
      "name": "bilingual",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Bilingual"
      }
     },
     {
      "name": "has_supplied",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Supplied"
      }
     },
     {
      "name": "has_unclear",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Unclear"
      }
     },
     {
      "name": "has_gap",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Gap"
      }
     },
     {
      "name": "has_rasura",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Rasura"
      }
     },
     {
      "name": "has_geo",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "only rows with coordinates",
       "default": false,
       "title": "Has Geo"
      },
      "description": "only rows with coordinates"
     },
     {
      "name": "id_like",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "catalogue id substring",
       "title": "Id Like"
      },
      "description": "catalogue id substring"
     },
     {
      "name": "ref",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "canonical-edition citation keyword search, e.g. 'CIL VI 1234'",
       "title": "Ref"
      },
      "description": "canonical-edition citation keyword search, e.g. 'CIL VI 1234'"
     },
     {
      "name": "person",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "person named in the text (keyword)",
       "title": "Person"
      },
      "description": "person named in the text (keyword)"
     },
     {
      "name": "role",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "office / role named in the text (keyword)",
       "title": "Role"
      },
      "description": "office / role named in the text (keyword)"
     },
     {
      "name": "deity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "deity named in the text (keyword)",
       "title": "Deity"
      },
      "description": "deity named in the text (keyword)"
     },
     {
      "name": "ruler",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "emperor authority_id — see /api/mentions/rulers",
       "title": "Ruler"
      },
      "description": "emperor authority_id — see /api/mentions/rulers"
     },
     {
      "name": "sort",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "relevance | corpus | date_asc | date_desc",
       "title": "Sort"
      },
      "description": "relevance | corpus | date_asc | date_desc"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/lookup": {
   "get": {
    "summary": "Lookup",
    "description": "Reverse-lookup: given an external identifier (CIL, EDCS, TM, …),\nreturn all inscriptions in our catalogue that reference it.\n\nExample:  /api/lookup?CIL=X.7296    → the canonical CIL X 7296 stone\n                                      could appear in iaph, isic,\n                                      edcs-derived, … etc. — returns\n                                      ALL the matching rows.",
    "operationId": "lookup_api_lookup_get",
    "parameters": [
     {
      "name": "CIL",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Cil"
      }
     },
     {
      "name": "EDCS",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Edcs"
      }
     },
     {
      "name": "EDR",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Edr"
      }
     },
     {
      "name": "EDH",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Edh"
      }
     },
     {
      "name": "PHI",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Phi"
      }
     },
     {
      "name": "TM",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Tm"
      }
     },
     {
      "name": "IG",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ig"
      }
     },
     {
      "name": "IAph",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Iaph"
      }
     },
     {
      "name": "ILS",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ils"
      }
     },
     {
      "name": "ILLRP",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Illrp"
      }
     },
     {
      "name": "AE",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ae"
      }
     },
     {
      "name": "EAGLE",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Eagle"
      }
     },
     {
      "name": "ZENODO_DOI",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Zenodo Doi"
      }
     },
     {
      "name": "URI",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Uri"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Lookup Api Lookup Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/facets": {
   "get": {
    "summary": "Facets",
    "description": "Return top-N counts for each requested facet, narrowed by filters.",
    "operationId": "facets_api_facets_get",
    "parameters": [
     {
      "name": "ns",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ns"
      }
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "maxLength": 200
        },
        {
         "type": "null"
        }
       ],
       "title": "Q"
      }
     },
     {
      "name": "fidelity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Fidelity"
      }
     },
     {
      "name": "material",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Material"
      }
     },
     {
      "name": "period",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Period"
      }
     },
     {
      "name": "object_type",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Object Type"
      }
     },
     {
      "name": "place",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Place"
      }
     },
     {
      "name": "text_type",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Text Type"
      }
     },
     {
      "name": "language",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Language"
      }
     },
     {
      "name": "date_from",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Date From"
      }
     },
     {
      "name": "date_to",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Date To"
      }
     },
     {
      "name": "bilingual",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Bilingual"
      }
     },
     {
      "name": "has_supplied",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Supplied"
      }
     },
     {
      "name": "has_unclear",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Unclear"
      }
     },
     {
      "name": "has_gap",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Gap"
      }
     },
     {
      "name": "has_rasura",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Rasura"
      }
     },
     {
      "name": "has_geo",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Geo"
      }
     },
     {
      "name": "id_like",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Id Like"
      }
     },
     {
      "name": "ref",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ref"
      }
     },
     {
      "name": "person",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Person"
      }
     },
     {
      "name": "role",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Role"
      }
     },
     {
      "name": "deity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Deity"
      }
     },
     {
      "name": "ruler",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ruler"
      }
     },
     {
      "name": "collapsed",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "collapse material / object_type onto authority canonical labels",
       "default": true,
       "title": "Collapsed"
      },
      "description": "collapse material / object_type onto authority canonical labels"
     },
     {
      "name": "facets",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "description": "comma-separated subset of facet names",
       "default": "",
       "title": "Facets"
      },
      "description": "comma-separated subset of facet names"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/catalogue.json": {
   "get": {
    "summary": "Catalogue Small",
    "description": "Drop-in replacement for the static catalogue.json — capped at 50k rows.\n\nAbove the cap, returns HTTP 410 with a pointer to /api/catalogue (paged).",
    "operationId": "catalogue_small_api_catalogue_json_get",
    "parameters": [
     {
      "name": "ns",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "namespace filter, e.g. 'iaph'",
       "title": "Ns"
      },
      "description": "namespace filter, e.g. 'iaph'"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "retired"
  },
  "/api/catalogue": {
   "get": {
    "summary": "Catalogue Paged",
    "description": "Paged, filterable catalogue listing — the advanced-search backend.\n\nWraps the row shape in {total, page, size, rows}. `total` is the count\nof the filtered set, so a UI footer can report \"N matches\" honestly.",
    "operationId": "catalogue_paged_api_catalogue_get",
    "parameters": [
     {
      "name": "page",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Page"
      }
     },
     {
      "name": "size",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 1000,
       "minimum": 1,
       "default": 200,
       "title": "Size"
      }
     },
     {
      "name": "ns",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Ns"
      }
     },
     {
      "name": "material",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Material"
      }
     },
     {
      "name": "period",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Period"
      }
     },
     {
      "name": "object_type",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Object Type"
      }
     },
     {
      "name": "language",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Language"
      }
     },
     {
      "name": "fidelity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Fidelity"
      }
     },
     {
      "name": "text_type",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Text Type"
      }
     },
     {
      "name": "place",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Place"
      }
     },
     {
      "name": "date_from",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "earliest year, BC negative",
       "title": "Date From"
      },
      "description": "earliest year, BC negative"
     },
     {
      "name": "date_to",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "latest year, BC negative",
       "title": "Date To"
      },
      "description": "latest year, BC negative"
     },
     {
      "name": "bilingual",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Bilingual"
      }
     },
     {
      "name": "has_supplied",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Supplied"
      }
     },
     {
      "name": "has_unclear",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Unclear"
      }
     },
     {
      "name": "has_gap",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Gap"
      }
     },
     {
      "name": "has_rasura",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "default": false,
       "title": "Has Rasura"
      }
     },
     {
      "name": "has_geo",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean",
       "description": "only rows with coordinates",
       "default": false,
       "title": "Has Geo"
      },
      "description": "only rows with coordinates"
     },
     {
      "name": "id_like",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "catalogue id substring",
       "title": "Id Like"
      },
      "description": "catalogue id substring"
     },
     {
      "name": "ref",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "canonical-edition citation keyword search, e.g. 'CIL VI 1234'",
       "title": "Ref"
      },
      "description": "canonical-edition citation keyword search, e.g. 'CIL VI 1234'"
     },
     {
      "name": "person",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "person named in the text (keyword)",
       "title": "Person"
      },
      "description": "person named in the text (keyword)"
     },
     {
      "name": "role",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "office / role named in the text (keyword)",
       "title": "Role"
      },
      "description": "office / role named in the text (keyword)"
     },
     {
      "name": "deity",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "deity named in the text (keyword)",
       "title": "Deity"
      },
      "description": "deity named in the text (keyword)"
     },
     {
      "name": "ruler",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "integer"
        },
        {
         "type": "null"
        }
       ],
       "description": "emperor authority_id — see /api/mentions/rulers",
       "title": "Ruler"
      },
      "description": "emperor authority_id — see /api/mentions/rulers"
     },
     {
      "name": "sort",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "corpus | date_asc | date_desc",
       "title": "Sort"
      },
      "description": "corpus | date_asc | date_desc"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Catalogue Paged Api Catalogue Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/text": {
   "get": {
    "summary": "Get Text",
    "description": "Return the full transcription of one item as plain text + TEI + attribution.\n\n`lang` (optional, literary only — 'grc'/'lat'/'eng'): serve the matching-edition\npassage in that language instead of whichever edition the bare id resolves to.\nEditions of one work cite at different depths (English '6.28.0' vs Greek '6.28'),\nso the requested passage is matched by progressive prefix against the work's rows\nof that edition language. Lets a client pair the original Greek/Latin beside a\nserved translation straight from the API (no external Perseus/GitHub fetch).\nDefault (no lang) → unchanged exact-id behaviour.",
    "operationId": "get_text_api_text_get",
    "parameters": [
     {
      "name": "ns",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 64,
       "title": "Ns"
      }
     },
     {
      "name": "id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 128,
       "title": "Id"
      }
     },
     {
      "name": "lang",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "maxLength": 8
        },
        {
         "type": "null"
        }
       ],
       "title": "Lang"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Get Text Api Text Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/gloss_authority/{kind}": {
   "get": {
    "tags": [
     "gloss_authority"
    ],
    "summary": "Authority List",
    "operationId": "authority_list_api_gloss_authority__kind__get",
    "parameters": [
     {
      "name": "kind",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Kind"
      }
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "minLength": 0,
       "default": "",
       "title": "Q"
      }
     },
     {
      "name": "size",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "default": 20,
       "title": "Size"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/gloss_authority/{kind}/{id}": {
   "get": {
    "tags": [
     "gloss_authority"
    ],
    "summary": "Authority Get",
    "operationId": "authority_get_api_gloss_authority__kind___id__get",
    "parameters": [
     {
      "name": "kind",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Kind"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/lexicon/{lemma}": {
   "get": {
    "tags": [
     "gloss_authority"
    ],
    "summary": "Lexicon",
    "operationId": "lexicon_api_lexicon__lemma__get",
    "parameters": [
     {
      "name": "lemma",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Lemma"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/gloss-retrieve": {
   "get": {
    "tags": [
     "gloss_authority"
    ],
    "summary": "Retrieve",
    "description": "RAG retrieval for the assistant: cited, source-attributed passages from\nthe encyclopedia (snippet-gated), gloss_authority (persons/places/names), the\ndictionary, and the corpus — grounded material to answer from.",
    "operationId": "retrieve_api_gloss_retrieve_get",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 2,
       "title": "Q"
      }
     },
     {
      "name": "k",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "default": 8,
       "title": "K"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/encyclopedia/{lemma}": {
   "get": {
    "tags": [
     "gloss_authority"
    ],
    "summary": "Encyclopedia",
    "operationId": "encyclopedia_api_encyclopedia__lemma__get",
    "parameters": [
     {
      "name": "lemma",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Lemma"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "staged"
  },
  "/api/similar": {
   "get": {
    "tags": [
     "semantic"
    ],
    "summary": "Similar",
    "description": "Semantic neighbors (pilot) by indexed item or caller-supplied embedding.",
    "operationId": "similar_api_similar_get",
    "parameters": [
     {
      "name": "item",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "maxLength": 160
        },
        {
         "type": "null"
        }
       ],
       "description": "index id (HD058529 / iphi138330 / p.oxf.7) or ns/id (edh-derived/HD058529)",
       "title": "Item"
      },
      "description": "index id (HD058529 / iphi138330 / p.oxf.7) or ns/id (edh-derived/HD058529)"
     },
     {
      "name": "emb",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "maxLength": 2000
        },
        {
         "type": "null"
        }
       ],
       "description": "base64 of 256 little-endian float32 (the query embedding, computed client-side with the joint model)",
       "title": "Emb"
      },
      "description": "base64 of 256 little-endian float32 (the query embedding, computed client-side with the joint model)"
     },
     {
      "name": "k",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 20,
       "minimum": 1,
       "default": 8,
       "title": "K"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Similar Api Similar Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "staged"
  },
  "/api/authority/types": {
   "get": {
    "summary": "Types",
    "description": "Available authority types with entry counts.",
    "operationId": "types_api_authority_types_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Types Api Authority Types Get"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/authority/lookup": {
   "get": {
    "summary": "Lookup",
    "description": "Resolve a single reference to its authority entry/entries.",
    "operationId": "lookup_api_authority_lookup_get",
    "parameters": [
     {
      "name": "ref",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 300,
       "description": "an xml:id, URI or raw label",
       "title": "Ref"
      },
      "description": "an xml:id, URI or raw label"
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Lookup Api Authority Lookup Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/authority/{type}": {
   "get": {
    "summary": "List Type",
    "description": "List authority entries of one type.",
    "operationId": "list_type_api_authority__type__get",
    "parameters": [
     {
      "name": "type",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Type"
      }
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string",
         "maxLength": 120
        },
        {
         "type": "null"
        }
       ],
       "description": "label substring filter",
       "title": "Q"
      },
      "description": "label substring filter"
     },
     {
      "name": "page",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0,
       "title": "Page"
      }
     },
     {
      "name": "size",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 500,
       "minimum": 1,
       "default": 100,
       "title": "Size"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response List Type Api Authority  Type  Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/authority/{type}/{authority_id}": {
   "get": {
    "summary": "Get Entry",
    "description": "One authority entry: full labels, aliases, cross-refs, usage.",
    "operationId": "get_entry_api_authority__type___authority_id__get",
    "parameters": [
     {
      "name": "type",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Type"
      }
     },
     {
      "name": "authority_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer",
       "title": "Authority Id"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Get Entry Api Authority  Type   Authority Id  Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/mentions/rulers": {
   "get": {
    "summary": "Rulers",
    "description": "The curated emperor authority, chronological, with attestation\ncounts — the data behind the advanced-search emperor picker.",
    "operationId": "rulers_api_mentions_rulers_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Rulers Api Mentions Rulers Get"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/mentions/values": {
   "get": {
    "summary": "Values",
    "description": "Distinct attested surfaces for one kind — the v1 controlled\nvocabulary for the person / deity / office pickers. Grouped on the\naccent-folded form so spelling variants collapse.",
    "operationId": "values_api_mentions_values_get",
    "parameters": [
     {
      "name": "kind",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "description": "person | deity | role | org | place",
       "title": "Kind"
      },
      "description": "person | deity | role | org | place"
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "description": "filter surfaces (folded substring)",
       "title": "Q"
      },
      "description": "filter surfaces (folded substring)"
     },
     {
      "name": "size",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "maximum": 500,
       "minimum": 1,
       "default": 200,
       "title": "Size"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Values Api Mentions Values Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/mentions/stats": {
   "get": {
    "summary": "Stats",
    "description": "Row counts per kind — quick introspection of the harvest.",
    "operationId": "stats_api_mentions_stats_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Stats Api Mentions Stats Get"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  },
  "/api/version": {
   "get": {
    "tags": [
     "meta"
    ],
    "summary": "Version",
    "description": "Service name and deployed version.",
    "operationId": "version_api_version_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Version Api Version Get"
        }
       }
      }
     }
    }
   },
   "x-magalia-status": "live"
  }
 },
 "components": {
  "schemas": {
   "HTTPValidationError": {
    "properties": {
     "detail": {
      "items": {
       "$ref": "#/components/schemas/ValidationError"
      },
      "type": "array",
      "title": "Detail"
     }
    },
    "type": "object",
    "title": "HTTPValidationError"
   },
   "ValidationError": {
    "properties": {
     "loc": {
      "items": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "integer"
        }
       ]
      },
      "type": "array",
      "title": "Location"
     },
     "msg": {
      "type": "string",
      "title": "Message"
     },
     "type": {
      "type": "string",
      "title": "Error Type"
     },
     "input": {
      "title": "Input"
     },
     "ctx": {
      "type": "object",
      "title": "Context"
     }
    },
    "type": "object",
    "required": [
     "loc",
     "msg",
     "type"
    ],
    "title": "ValidationError"
   }
  }
 },
 "servers": [
  {
   "url": "https://magalia.wiki"
  }
 ]
}
