API Reference
Search Documents
POST
/api/v1/searchPerform semantic search across your document library with optional project filtering.
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | Yes | - | Search query text (natural language) |
limit | integer | No | 5 | Number of results (max: 20) |
projectIds | array | No | - | Filter by specific project IDs |
enable_multi_concept | boolean | No | false | Enable AI-powered multi-concept extraction for improved search accuracy (see Advanced Features below) |
Example Request
bash
curl -X POST https://awrag.io/api/v1/search \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "cognitive load theory in education",
"limit": 10,
"projectIds": ["abc-123", "def-456"]
}'Response (200 OK)
json
{
"success": true,
"data": {
"results": [
{
"chunk_id": "uuid",
"document_id": "uuid",
"document_name": "research_paper.pdf",
"project_id": "uuid",
"project_name": "Machine Learning Research",
"content": "Relevant text chunk about machine learning...",
"chunk_index": 5,
"similarity_score": 0.87
}
],
"query": "machine learning",
"result_count": 5
}
}Search Process:
- Query Analysis: Natural language query processed (with optional multi-concept extraction)
- Embedding: Query embedded using advanced AI embedding technology (1024-dimensional vectors)
- Vector Search: Similarity search using pgvector (cosine similarity)
- Reranking: Results reranked using intelligent semantic reranking
- Results: Top results returned with rich metadata
Response Fields Explained:
chunk_id: Unique identifier for the text chunkdocument_id: Source document UUIDdocument_name: Original filenameproject_id: Parent project UUIDproject_name: Project name for contextcontent: Extracted text chunk (~200 tokens)chunk_index: Position in document (0-based)similarity_score: Relevance score (0-1, higher is better)concepts: (Optional) Array of extracted concepts when multi-concept search is enabledconcept_count: (Optional) Number of concepts extracted (appears with concepts field)