Search API¶
Semantic and keyword search across your document collection.
Overview¶
The Search API provides powerful document discovery capabilities:
- Semantic Search - Find documents by meaning, not just keywords
- Keyword Search - Traditional full-text search
- Hybrid Search - Combine semantic and keyword approaches
- Advanced Filters - Filter by date, folder, file type, and more
Basic Search¶
Perform semantic or keyword search across documents.
Query Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Search query |
mode | string | No | semantic, text, or auto (default: auto) |
folder_id | string | No | Filter by folder |
tag_id | string | No | Filter by tag |
file_type | string | No | Filter by file type |
date_start | string | No | Filter by start date (ISO 8601) |
date_end | string | No | Filter by end date (ISO 8601) |
limit | integer | No | Max results (default: 20, max: 100) |
min_score | float | No | Minimum relevance score (0.0-1.0) |
Example Request¶
Response¶
{
"results": [
{
"document": {
"id": "doc_abc123",
"filename": "service-agreement.pdf",
"ai_summary": "Service agreement with renewal terms...",
"folder_id": "folder_legal",
"created_at": "2026-01-15T10:00:00Z"
},
"score": 0.92,
"relevance": "high",
"highlight": "...renewal terms effective upon expiration..."
},
{
"document": {
"id": "doc_def456",
"filename": "vendor-contract.pdf",
"ai_summary": "Vendor agreement with auto-renewal clause..."
},
"score": 0.85,
"relevance": "high",
"highlight": "...automatic renewal unless terminated..."
}
],
"mode": "semantic",
"query": "contract renewal terms",
"total": 5
}
Search Modes¶
Automatic Mode (Recommended)¶
Archivus automatically chooses the best search mode:
- Short queries (< 10 characters) → Keyword search
- Long queries (≥ 10 characters) → Semantic search
curl "https://api.archivus.app/api/v1/search?q=find+all+contracts+expiring+in+Q4" \
-H "X-API-Key: ak_live_YOUR_API_KEY"
Semantic Search¶
Find documents by meaning using AI embeddings:
curl "https://api.archivus.app/api/v1/search?q=contract+renewal&mode=semantic" \
-H "X-API-Key: ak_live_YOUR_API_KEY"
Best for: - Natural language queries - Conceptual searches - Finding similar documents - Cross-language understanding
Keyword Search¶
Traditional full-text search:
curl "https://api.archivus.app/api/v1/search?q=contract+renewal&mode=text" \
-H "X-API-Key: ak_live_YOUR_API_KEY"
Best for: - Exact phrase matching - Document IDs or codes - Specific terminology - Fast lookups
Enhanced Search (Pro+)¶
AI-enhanced search with advanced filtering and context understanding.
Request Body¶
{
"query": "Find all contracts expiring in Q4 2026",
"filters": {
"date_range": {
"start": "2026-10-01",
"end": "2026-12-31"
},
"tags": ["contract"],
"ai_categories": ["legal"],
"folder_id": "folder_legal"
},
"include_similar": true,
"min_score": 0.7
}
Example Request¶
const response = await fetch('https://api.archivus.app/api/v1/search/enhanced', {
method: 'POST',
headers: {
'X-API-Key': 'ak_live_YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: 'Find all contracts expiring in Q4',
filters: {
tags: ['contract'],
date_range: {
start: '2026-10-01',
end: '2026-12-31'
}
}
})
});
Hybrid Search¶
Combine semantic and keyword search with custom weighting.
Request Body¶
{
"query": "contract renewal terms",
"semantic_weight": 0.7,
"text_weight": 0.3,
"limit": 20,
"filters": {
"folder_id": "folder_legal"
}
}
Scoring: score = (semantic_weight × semantic_score) + (text_weight × text_score)
Understanding Results¶
Relevance Scores¶
Scores range from 0.0 to 1.0:
| Score Range | Relevance | Description |
|---|---|---|
| 0.8 - 1.0 | High | Highly relevant results |
| 0.6 - 0.8 | Medium | Relevant results |
| 0.4 - 0.6 | Low | Somewhat relevant |
| < 0.4 | Very Low | Minimal relevance |
Highlights¶
Search results include text highlights showing matching context:
AI Credits Cost¶
| Operation | Credits |
|---|---|
| Semantic Search | 0.5 credits/query |
| Enhanced Search | 1 credit/query |
| Keyword Search | Free |
Error Responses¶
Invalid Query¶
Status: 400 Bad Request
No Results¶
Status: 200 OK (with empty results)
Next Steps¶
-
Upload Documents
Upload documents to search
-
Ask Questions
Use chat to ask questions about search results