alRetrieval
Ingest documents and query them with natural-language semantic retrieval. Supports PDF, DOCX, PPTX, TXT, and Markdown files.
- Path
- /v1/alRetrieval
- Key scope
- alretrieval
Supported file formats
PDF, DOCX, PPTX, TXT, MD
PDFs are processed via OCR; DOCX, PPTX, TXT, and MD have text extracted directly — no OCR cost
Scope Required: All alRetrieval endpoints require an API key with the alretrieval scope. Pass it as a Bearer token in the Authorization header.
GET / HEADGet the original file
Returns the original uploaded file, or the file downloaded from url, unchanged. Send the same API key in the Authorization header. You can open it before the document is ready; the link stays valid until deletion. HEAD returns the status and headers without a body.
GET /v1/alRetrieval/collections/{collection_id}/documents/{document_id}/file
HEAD /v1/alRetrieval/collections/{collection_id}/documents/{document_id}/file
| File | Content-Type | Content-Disposition |
|---|---|---|
application/pdf | inline | |
| TXT | text/plain; charset=utf-8 | inline |
| MD | text/markdown; charset=utf-8 | inline |
| DOCX | application/vnd.openxmlformats-officedocument.wordprocessingml.document | attachment |
| PPTX | application/vnd.openxmlformats-officedocument.presentationml.presentation | attachment |
The response includes Content-Length and both filename and UTF-8 filename* for Arabic names. A single byte range is supported per request; multiple ranges return 416 invalid_range. In your app, fetch the file from your server and serve it to the signed-in user.
Code Examples:
import requests
headers = {"Authorization": "Bearer YOUR_API_KEY"}
# doc is the document object from an upload, get or list response.
with requests.get(doc["view_url"], headers=headers, stream=True) as r:
r.raise_for_status()
with open("original.pdf", "wb") as f:
for chunk in r.iter_content(65536):
f.write(chunk)
Range header.Ready to Get Started?
Generate an API key from your dashboard and start building