{
  "openapi": "3.1.0",
  "info": {
    "title": "pe-exam-env reference API",
    "version": "1.0.0",
    "description": "Exact-location lookup inside the PE Civil: Structural exam-day standards (ACI 318-14, AISC 15th, ASCE 7-16, IBC 2018, AASHTO LRFD 8th, NDS 2018, SDPWS 2015, TMS 402-16, PCI 7th, OSHA 29 CFR, NCEES Handbook) plus the practice-question bank. Built for AI tutors: resolve a citation to the chapter PDF + page, link straight into the simulator, search snippets, verify solution reference paths.",
    "x-mcp-endpoint": "https://pe-exam-env.vercel.app/mcp",
    "x-llms-txt": "https://pe-exam-env.vercel.app/llms.txt"
  },
  "externalDocs": {
    "url": "https://pe-exam-env.vercel.app/docs/",
    "description": "Human and agent documentation"
  },
  "servers": [
    {
      "url": "https://pe-exam-env.vercel.app/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Location": {
        "type": "object",
        "description": "A resolved location",
        "properties": {
          "standard": {
            "type": "object"
          },
          "chapter": {
            "type": "object"
          },
          "page": {
            "type": "object",
            "properties": {
              "pdf": {
                "type": "integer"
              },
              "printed": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "section": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "citation": {
            "type": "string"
          },
          "snippet": {
            "type": [
              "string",
              "null"
            ]
          },
          "links": {
            "type": "object",
            "properties": {
              "open": {
                "type": "string"
              },
              "pdf": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/standards": {
      "get": {
        "summary": "Catalog of standards and chapter PDFs",
        "responses": {
          "200": {
            "description": "catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                }
              }
            }
          }
        }
      }
    },
    "/standards/{id}": {
      "get": {
        "summary": "One standard",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "standard",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/standards/{id}/toc": {
      "get": {
        "summary": "Section headings with page numbers",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "chapter",
            "in": "query",
            "required": false,
            "description": "chapter index or name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "toc",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                }
              }
            }
          }
        }
      }
    },
    "/locate": {
      "get": {
        "summary": "Resolve a citation to chapter + page",
        "parameters": [
          {
            "name": "cite",
            "in": "query",
            "required": true,
            "description": "e.g. \"ASCE 7-16 Table 12.6-1\"",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "standard",
            "in": "query",
            "required": false,
            "description": "standard id/alias when the citation omits it",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "section|table|equation|figure",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "token",
            "in": "query",
            "required": false,
            "description": "number when not parsed from cite",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "max matches",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "locate result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "found": {
                      "type": "boolean"
                    },
                    "matches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "A resolved location",
                        "properties": {
                          "standard": {
                            "type": "object"
                          },
                          "chapter": {
                            "type": "object"
                          },
                          "page": {
                            "type": "object",
                            "properties": {
                              "pdf": {
                                "type": "integer"
                              },
                              "printed": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "section": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "citation": {
                            "type": "string"
                          },
                          "snippet": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "links": {
                            "type": "object",
                            "properties": {
                              "open": {
                                "type": "string"
                              },
                              "pdf": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "commentary": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "A resolved location",
                        "properties": {
                          "standard": {
                            "type": "object"
                          },
                          "chapter": {
                            "type": "object"
                          },
                          "page": {
                            "type": "object",
                            "properties": {
                              "pdf": {
                                "type": "integer"
                              },
                              "printed": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "section": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "citation": {
                            "type": "string"
                          },
                          "snippet": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "links": {
                            "type": "object",
                            "properties": {
                              "open": {
                                "type": "string"
                              },
                              "pdf": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "mentions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "A resolved location",
                        "properties": {
                          "standard": {
                            "type": "object"
                          },
                          "chapter": {
                            "type": "object"
                          },
                          "page": {
                            "type": "object",
                            "properties": {
                              "pdf": {
                                "type": "integer"
                              },
                              "printed": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "section": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "citation": {
                            "type": "string"
                          },
                          "snippet": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "links": {
                            "type": "object",
                            "properties": {
                              "open": {
                                "type": "string"
                              },
                              "pdf": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/search": {
      "get": {
        "summary": "Full-text search with snippets",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "terms and \"quoted phrases\"",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "standard",
            "in": "query",
            "required": false,
            "description": "restrict to one standard",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1-25",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "search result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "A resolved location",
                        "properties": {
                          "standard": {
                            "type": "object"
                          },
                          "chapter": {
                            "type": "object"
                          },
                          "page": {
                            "type": "object",
                            "properties": {
                              "pdf": {
                                "type": "integer"
                              },
                              "printed": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "section": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "citation": {
                            "type": "string"
                          },
                          "snippet": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "links": {
                            "type": "object",
                            "properties": {
                              "open": {
                                "type": "string"
                              },
                              "pdf": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/section": {
      "get": {
        "summary": "Text of a cited section/table/equation (key)",
        "security": [
          {
            "bearer": []
          },
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "cite",
            "in": "query",
            "required": true,
            "description": "citation",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "standard",
            "in": "query",
            "required": false,
            "description": "standard hint",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "maxChars",
            "in": "query",
            "required": false,
            "description": "cap",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "section text",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/page": {
      "get": {
        "summary": "Full page text (key)",
        "security": [
          {
            "bearer": []
          },
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "standard",
            "in": "query",
            "required": true,
            "description": "standard id/alias",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "chapter",
            "in": "query",
            "required": true,
            "description": "chapter index or name fragment",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": true,
            "description": "PDF page number (1-based)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/exams": {
      "get": {
        "summary": "Practice exams",
        "responses": {
          "200": {
            "description": "exams",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                }
              }
            }
          }
        }
      }
    },
    "/exams/{id}": {
      "get": {
        "summary": "Exam with questions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "exam",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/exams/{id}/questions/{qid}": {
      "get": {
        "summary": "One question",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "qid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "question",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/questions": {
      "get": {
        "summary": "All questions flattened",
        "responses": {
          "200": {
            "description": "questions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                }
              }
            }
          }
        }
      }
    },
    "/verify-citations": {
      "post": {
        "summary": "Verify a solution's Reference path lines",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "solution"
                ],
                "properties": {
                  "solution": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "verification",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}