/highlight endpoint is the core of the RAG PDF Highlighter API. You give it a publicly accessible URL to a PDF and a list of text chunks retrieved from your RAG pipeline, and it downloads the PDF, locates each chunk on its target page, applies yellow highlights, and streams the annotated file back to you as a binary PDF download.
Request
Method:POSTPath:
/highlightContent-Type:
application/json
Body Parameters
A publicly accessible URL pointing to the PDF you want to annotate. The service downloads this file at request time, so the URL must be reachable from the host running the service.
A list of document chunk objects to locate and highlight in the PDF. Each element must conform to the DocumentPayload shape.
Examples
Responses
200 OK
The highlights were applied successfully. The response body is a binary PDF file.| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="highlighted.pdf" |
.pdf file to view the result.
400 Bad Request
Returned when the request is structurally valid but the service cannot complete it. See the Errors page for specific causes includingPDFDownloadError and NoDocumentsError.
422 Unprocessable Entity
Returned by Pydantic when required fields (pdf_url or documents) are missing or have the wrong type.
500 Internal Server Error
An unexpected error occurred during processing. Check the service logs for details.If a chunk’s text cannot be found on its target page, the service silently skips that chunk and continues processing the remaining documents. No error is raised and the returned PDF will simply not contain a highlight for that chunk. See Chunks not highlighted for common causes.