Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/MuhammadSalmanAhmad/rag-pdf-highlighter/llms.txt

Use this file to discover all available pages before exploring further.

RAG PDF Highlighter exposes a minimal REST API with two endpoints — a health check and the highlight endpoint. All requests are JSON; the highlight response is a binary PDF.

Base URL

http://localhost:8000
Adjust the host and port as needed when deploying behind a reverse proxy or in a container environment.

Endpoints

GET /

Health check. Returns {"status": "ok the app is running"} with HTTP 200.

POST /highlight

Accepts a PDF URL and a list of document chunks. Downloads the PDF, applies highlights using 3-tier text matching, and returns the annotated PDF as a binary file.

Request format

All requests to POST /highlight must set Content-Type: application/json. The request body must be a JSON object conforming to the following schema:
{
  "pdf_url": "https://example.com/report.pdf",
  "documents": [
    {
      "page_content": "Text chunk to highlight",
      "metadata": {
        "page": 0
      }
    }
  ]
}
pdf_url must be a publicly accessible URL from which the service can download the PDF. Each entry in documents represents one text chunk to locate and annotate. The metadata.page value is zero-indexed — page 0 is the first page of the document.
Both pdf_url and documents are required. Omitting either field returns HTTP 422 Unprocessable Entity.

Response format

Success

A successful POST /highlight request returns HTTP 200 with the following headers:
HeaderValue
Content-Typeapplication/pdf
Content-Dispositionattachment; filename="highlighted.pdf"
The response body is the raw binary content of the annotated PDF.

Errors

All error responses return a JSON body with a single detail field describing the failure:
{"detail": "error message here"}
Status codeCause
400 Bad RequestPDF download failed, or an empty document list was passed
422 Unprocessable EntityMissing required fields in the request body
500 Internal Server ErrorUnexpected failure during highlighting
Temp files created during a request are deleted automatically after the response is sent, regardless of whether the request succeeded or failed.

Build docs developers (and LLMs) love