Problem
The Node SDK issue Ontos-AI/knowhere-node-sdk#110 plans SDK-side page-memory citation assets: render source PDF pages into images, store them through pluggable SDK storage, and attach those assets to page chunks by metadata.page_nums.
The SDK cannot reliably do that later from only a document_id unless the Knowhere API exposes the original or normalized source file. Current staging behavior for doc_c5f9927aa1a5 shows:
documents.listChunks(... include_asset_urls=true) returns page chunks with asset_url: null.
- page chunk metadata has no original/normalized file URL.
- the job
result_url points to a parsed result ZIP only.
- that result ZIP does not include the original file or rendered page assets.
So SDK consumers can only render page images when they still have the source file from parse-time or when the app has its own source storage. Server-side clients like Notebook need an authenticated API path to fetch the source/normalized PDF by document.
Goal
Add a v2 API endpoint that lets authorized clients retrieve the original file or normalized PDF for a document, so SDKs can generate page-memory citation assets after parsing.
Proposed API Shape
Prefer a documents resource because page assets are linked to persisted documents/chunks.
Possible endpoints:
GET /v2/documents/{document_id}/files/original
GET /v2/documents/{document_id}/files/normalized-pdf
or a single endpoint with a variant:
GET /v2/documents/{document_id}/file?variant=original|normalized_pdf
Response options:
- JSON metadata + signed URL:
{
"document_id": "doc_...",
"variant": "normalized_pdf",
"file_name": "...pdf",
"content_type": "application/pdf",
"size_bytes": 12345,
"url": "https://...signed...",
"expires_at": "2026-07-02T12:00:00Z"
}
- Direct streaming response with
Content-Type and Content-Disposition.
For SDK usage, signed URL JSON is probably simpler and avoids streaming large files through SDK model parsing, but direct streaming can be more secure if we want the API to enforce auth on every byte.
Variant Semantics
original: the uploaded/source file when it is safe and available.
normalized_pdf: the PDF representation used for page-memory page numbering and rendering.
For page-memory citations, normalized_pdf is the important variant because page numbers must match metadata.page_nums. For PDF inputs, original and normalized PDF may be the same object.
For non-PDF inputs, if no normalized PDF is persisted today, page-memory ingestion should persist it or add a durable artifact path so this endpoint can return it.
Authorization / Security
- Require the same document ownership/API key checks as
GET /v2/documents/{document_id} and listChunks.
- Respect archived/deleted document state.
- Use short-lived signed URLs if returning URL JSON.
- Avoid exposing raw storage keys or permanent bucket URLs.
- Consider rate limits because SDK page rendering may fetch large PDFs.
SDK Consumer Contract
After this exists, Node SDK can expose:
const file = await client.documents.getFile(documentId, {
variant: "normalized_pdf",
responseType: "arrayBuffer",
});
const chunksWithAssets = await attachPageAssetsToChunks({
chunks,
sourceFile: file,
storage,
});
or:
const { url } = await client.documents.getFileUrl(documentId, {
variant: "normalized_pdf",
});
Acceptance Criteria
- API exposes an authenticated way to fetch or sign the original/normalized PDF for a document.
- For page-memory documents,
normalized_pdf page numbering matches metadata.page_nums on page chunks.
- PDF source documents return a PDF successfully.
- Non-PDF page-memory documents either return a persisted normalized PDF or a clear unsupported/not_available error.
- Responses include content type, file name, variant, and expiry when returning signed URLs.
- Access is denied for documents outside the caller's namespace/account.
- Tests cover PDF document success, missing artifact, unauthorized access, archived/deleted document behavior, and signed URL expiry/shape.
- Node SDK issue Ontos-AI/knowhere-node-sdk#110 can depend on this endpoint for post-parse server-side clients.
Open Questions
- Should the endpoint default to
normalized_pdf for page-memory documents?
- Should we return signed URL JSON, stream bytes directly, or support both?
- Where should normalized PDFs be stored for non-PDF inputs if they are not currently persisted?
- Should result ZIPs also include normalized source file references, or should source retrieval remain a document API concern only?
Problem
The Node SDK issue Ontos-AI/knowhere-node-sdk#110 plans SDK-side page-memory citation assets: render source PDF pages into images, store them through pluggable SDK storage, and attach those assets to page chunks by
metadata.page_nums.The SDK cannot reliably do that later from only a
document_idunless the Knowhere API exposes the original or normalized source file. Current staging behavior fordoc_c5f9927aa1a5shows:documents.listChunks(... include_asset_urls=true)returns page chunks withasset_url: null.result_urlpoints to a parsed result ZIP only.So SDK consumers can only render page images when they still have the source file from parse-time or when the app has its own source storage. Server-side clients like Notebook need an authenticated API path to fetch the source/normalized PDF by document.
Goal
Add a v2 API endpoint that lets authorized clients retrieve the original file or normalized PDF for a document, so SDKs can generate page-memory citation assets after parsing.
Proposed API Shape
Prefer a documents resource because page assets are linked to persisted documents/chunks.
Possible endpoints:
or a single endpoint with a variant:
Response options:
{ "document_id": "doc_...", "variant": "normalized_pdf", "file_name": "...pdf", "content_type": "application/pdf", "size_bytes": 12345, "url": "https://...signed...", "expires_at": "2026-07-02T12:00:00Z" }Content-TypeandContent-Disposition.For SDK usage, signed URL JSON is probably simpler and avoids streaming large files through SDK model parsing, but direct streaming can be more secure if we want the API to enforce auth on every byte.
Variant Semantics
original: the uploaded/source file when it is safe and available.normalized_pdf: the PDF representation used for page-memory page numbering and rendering.For page-memory citations,
normalized_pdfis the important variant because page numbers must matchmetadata.page_nums. For PDF inputs, original and normalized PDF may be the same object.For non-PDF inputs, if no normalized PDF is persisted today, page-memory ingestion should persist it or add a durable artifact path so this endpoint can return it.
Authorization / Security
GET /v2/documents/{document_id}andlistChunks.SDK Consumer Contract
After this exists, Node SDK can expose:
or:
Acceptance Criteria
normalized_pdfpage numbering matchesmetadata.page_numson page chunks.Open Questions
normalized_pdffor page-memory documents?