{
  "openapi": "3.1.0",
  "info": {
    "title": "TuMalla — Curriculum Query Interface",
    "description": "Read-only interface for querying Chilean university curricula hosted on TuMalla. All endpoints serve pre-generated static resources; there is no dynamic backend. Fetch Markdown exports for complete human-readable curriculum data, or use the structured JSON catalogue for programmatic access. Data is sourced from public institutional catalogues and should be confirmed with the official university source before making academic decisions.",
    "version": "1.0.0",
    "contact": {
      "name": "DIMEX SpA",
      "email": "legal@venturas.cl",
      "url": "https://tumalla.venturas.cl/contacto/"
    },
    "license": {
      "name": "AGPL-3.0-or-later",
      "url": "https://www.gnu.org/licenses/agpl-3.0.html"
    }
  },
  "servers": [
    {
      "url": "https://tumalla.venturas.cl",
      "description": "TuMalla production static site."
    }
  ],
  "paths": {
    "/exports/uchile/{programmeId}.md": {
      "get": {
        "operationId": "get_programme_curriculum_markdown",
        "summary": "Retrieve the full curriculum for a programme as Markdown.",
        "description": "Returns a structured Markdown document containing every course in the programme organised by semester, with prerequisite chains annotated using arrow notation (A ← B; C), credit counts, alternative course options, institutional notes, and degree closure requirements. This is the richest and most complete representation of a curriculum available on TuMalla.",
        "parameters": [
          {
            "name": "programmeId",
            "in": "path",
            "required": true,
            "description": "The programme identifier within the Universidad de Chile. Must match one of the available programme slugs exactly.",
            "schema": {
              "type": "string",
              "enum": [
                "astronomia",
                "bachillerato",
                "ciencia-politica",
                "derecho",
                "licenciatura-ciencias-fisica",
                "geofisica-atmosfera",
                "geologia",
                "ingenieria-civil-electrica",
                "ingenieria-civil-en-biotecnologia",
                "ingenieria-civil-en-computacion",
                "ingenieria-civil-de-minas",
                "ingenieria-civil-en-transporte",
                "ingenieria-civil-estructural",
                "ingenieria-civil-hidraulica",
                "ingenieria-civil-industrial",
                "ingenieria-civil-matematica",
                "ingenieria-civil-quimica",
                "medicina"
              ],
              "examples": [
                "ingenieria-civil-en-computacion",
                "derecho",
                "medicina"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The complete curriculum document in Markdown format. Contains headings for each semester, bulleted course lists with prerequisite annotations, a conventions table, and a closure/degree section.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string",
                  "description": "A full Markdown document representing the curriculum grid."
                }
              }
            }
          },
          "404": {
            "description": "The requested programme identifier does not exist. Verify the programmeId against the enum list."
          }
        }
      }
    },
    "/api/catalogue.json": {
      "get": {
        "operationId": "get_catalogue",
        "summary": "Retrieve the complete curriculum catalogue as structured JSON.",
        "description": "Returns every university, programme, semester and course in one parseable document, generated from the same sources the pages render from. Prefer this over scraping the HTML or the Markdown exports whenever the task is computational rather than presentational.\n\nEach course carries a stable `id`, `credits`, `minimumCredits` for courses gated on an accumulated credit threshold, `prerequisiteIds` and `prerequisiteSelector` for direct requirements including alternatives expressed as a choice, `dependentIds` for the reverse edges, `semesterKey`, and both Spanish and English display names. The prerequisite and dependent identifier lists form a directed graph directly, with no parsing of prose required.\n\n`generatedAt` records the build date. The data mirrors public institutional catalogues and remains referential: confirm with the official university source before making academic decisions.",
        "tags": ["catalogue"],
        "responses": {
          "200": {
            "description": "The complete catalogue.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["generatedAt", "universities", "programmes", "programmesByKey"],
                  "properties": {
                    "generatedAt": {
                      "type": "string",
                      "description": "Build date of this document, in ISO 8601 date form."
                    },
                    "universities": {
                      "type": "array",
                      "description": "Institutions present in the catalogue."
                    },
                    "programmes": {
                      "type": "array",
                      "description": "Programmes in catalogue order."
                    },
                    "programmesByKey": {
                      "type": "object",
                      "description": "The same programmes indexed by their stable key, each holding its semesters and courses."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "get_llms_txt",
        "summary": "Retrieve the LLM navigation index for TuMalla.",
        "description": "Returns a curated Markdown index of the site's key pages and resources, following the llms.txt convention. Use this as the starting point to discover what data is available on TuMalla.",
        "responses": {
          "200": {
            "description": "The llms.txt navigation index in Markdown format.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "operationId": "get_llms_full_txt",
        "summary": "Retrieve the complete LLM context document with all curricula.",
        "description": "Returns a single monolithic Markdown document that concatenates every available curriculum export. Designed for direct injection into an LLM context window or RAG pipeline. Warning: this document is large (typically over 100 KB).",
        "responses": {
          "200": {
            "description": "The full concatenated curriculum context in Markdown format.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/mallas/": {
      "get": {
        "operationId": "get_programme_catalogue_page",
        "summary": "Retrieve the HTML catalogue page listing all available programmes.",
        "description": "Returns the human-readable HTML page showing all universities and their available programmes with links to each interactive curriculum view. For programmatic access, prefer the Markdown exports or llms.txt instead.",
        "responses": {
          "200": {
            "description": "The programme catalogue HTML page.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/mallas/uchile/{programmeId}/": {
      "get": {
        "operationId": "get_programme_interactive_page",
        "summary": "Retrieve the interactive curriculum page for a specific programme.",
        "description": "Returns the full interactive HTML page for a specific programme at the Universidad de Chile. The page includes a semester-by-semester grid with hover-based prerequisite highlighting, HTMX navigation between programmes, and export controls. For machine-readable data, prefer the Markdown export at /exports/uchile/{programmeId}.md instead.",
        "parameters": [
          {
            "name": "programmeId",
            "in": "path",
            "required": true,
            "description": "The programme slug within the Universidad de Chile.",
            "schema": {
              "type": "string",
              "enum": [
                "astronomia",
                "bachillerato",
                "ciencia-politica",
                "derecho",
                "licenciatura-ciencias-fisica",
                "geofisica-atmosfera",
                "geologia",
                "ingenieria-civil-electrica",
                "ingenieria-civil-en-biotecnologia",
                "ingenieria-civil-en-computacion",
                "ingenieria-civil-de-minas",
                "ingenieria-civil-en-transporte",
                "ingenieria-civil-estructural",
                "ingenieria-civil-hidraulica",
                "ingenieria-civil-industrial",
                "ingenieria-civil-matematica",
                "ingenieria-civil-quimica",
                "medicina"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The interactive curriculum HTML page.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "The requested programme does not exist."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ProgrammeSummary": {
        "type": "object",
        "description": "Abbreviated programme metadata used in catalogue listings.",
        "required": ["id", "key", "name", "nameEn", "pageUrl"],
        "properties": {
          "id": {
            "type": "string",
            "description": "The programme slug within its university (e.g. 'derecho').",
            "examples": ["derecho", "astronomia"]
          },
          "key": {
            "type": "string",
            "description": "The globally unique programme key combining university and programme identifiers.",
            "examples": ["uchile-derecho", "uchile-astronomia"]
          },
          "name": {
            "type": "string",
            "description": "The official programme name in Spanish.",
            "examples": ["Derecho", "Ingeniería Civil en Computación"]
          },
          "nameEn": {
            "type": "string",
            "description": "The programme name translated to English.",
            "examples": ["Law", "Civil Engineering in Computer Science"]
          },
          "pageUrl": {
            "type": "string",
            "description": "The relative URL path to the interactive curriculum page.",
            "examples": ["/mallas/uchile/derecho/"]
          },
          "disabled": {
            "type": "boolean",
            "description": "Whether the programme is currently disabled in the catalogue."
          }
        }
      },
      "UniversitySummary": {
        "type": "object",
        "description": "Abbreviated university metadata.",
        "required": ["id", "name", "nameEn"],
        "properties": {
          "id": {
            "type": "string",
            "description": "The university identifier slug.",
            "examples": ["uchile"]
          },
          "name": {
            "type": "string",
            "description": "The full university name in Spanish.",
            "examples": ["Universidad de Chile"]
          },
          "nameEn": {
            "type": "string",
            "description": "The university name in English.",
            "examples": ["University of Chile"]
          },
          "shortName": {
            "type": "string",
            "description": "Abbreviated university name in Spanish.",
            "examples": ["U. de Chile"]
          },
          "disabled": {
            "type": "boolean",
            "description": "Whether the university is currently disabled in the catalogue."
          }
        }
      }
    }
  }
}
