This is the primary endpoint of RAG PDF Highlighter. It downloads the PDF from the provided URL, highlights all matching text chunks using a 3-tier search strategy (exact match → sentence match → collapsed-whitespace match), and returns the annotated document as a binary PDF.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.
Request
Method and path:POST /highlight
Content-Type: application/json
Publicly accessible URL of the PDF to download and annotate. The service fetches this URL at request time using an async HTTP client with a 60-second timeout.
List of document objects identifying the text chunks to highlight. At least one entry is required.
The 3-tier matching strategy tries exact search first, then sentence-level search, then a collapsed-whitespace search that handles PDFs with individually spaced characters (e.g.
"W H A T" stored as "WHAT" in the text layer). If none of the three strategies find a match for a given chunk, that chunk is silently skipped and no highlight is added.Response
A successful request returns HTTP 200 with the annotated PDF as binary content.| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="highlighted.pdf" |
The raw binary content of the highlighted PDF. Save it directly to a
.pdf file — do not attempt to parse it as JSON.Error responses
All errors return a JSON body with a singledetail key:
| Status | Cause | Example detail |
|---|---|---|
400 Bad Request | PDF could not be downloaded from the provided URL | "Failed to download PDF: connection refused" |
400 Bad Request | Empty document list passed to the highlighter | "No documents provided" |
422 Unprocessable Entity | Missing pdf_url or documents in the request body | (FastAPI validation error) |
500 Internal Server Error | Unexpected failure during the highlighting process | "Highlighting failed: <reason>" |