API Reference
Welcome to the **Misbar Search Engine** API documentation. This guide will help you integrate search capabilities into your application using our high-performance, multi-tenant search engine.
Base URL
Your unique API endpoint can be found in the **Settings** section of your dashboard.
http://your-domain.com/api
View in Settings →
Authentication
Most endpoints require a **Bearer Token**. You must include it in your request headers:
Authorization: Bearer YOUR_API_TOKEN
*Note: All tokens provided by the system (Master and API) are Base64 encoded strings. Use the entire string as provided.*
01 Account & Authentication
/api/register
Create a new user account to start managing your indices.
{
"email": "dev@example.com",
"password": "your_secure_password"
}
/api/create-token
Login to receive your **Master Token**. This token is required for account-level operations.
{
"email": "dev@example.com",
"password": "your_secure_password"
}
/api/update-profile
Update your account details. Requires **Master Token**.
{
"current_password": "your_current_password",
"email": "new_email@example.com",
"new_password": "new_secure_password"
}
/api/tokens
Create a specific API token for indexing and searching. Requires **Master Token**.
{
"token_name": "Mobile App",
"type": "both" // read, write, or both
}
/api/tokens
Retrieve all API tokens generated by the user. Requires **Master Token**.
/api/permissions
Assign or remove index permissions for an API token. Requires **Master Token**.
{
"token": "API_TOKEN",
"index_name": ["products", "categories"]
}
/api/permissions
02 Index Management
/api/indices
Get a list of all indices owned by the current user. Requires **Master Token**.
/api/index/rename
Change the display name of an index. Requires **Master Token**.
{
"old_name": "products",
"new_name": "store_items"
}
/api/index
Add documents to an index storage. Requires **API Token**.
{
"index_name": "products",
"data": [
{ "id": "1", "title": "iPhone 15", "category": "Electronics" },
{ "id": "2", "title": "MacBook Pro", "category": "Electronics" }
]
}
/api/index/upload
Upload a JSON file directly to server storage. Requires **API Token**.
index_name: Target indexfile: The .json file
/api/index/process
Process pending documents and make them searchable. Returns **NDJSON** stream.
{
"index_name": "products",
"limit": 1000
}
/api/index/reindex
Reset all documents in an index to "pending" status. Requires **API Token**.
/api/browse/{index_name}
Retrieve all documents in an index. Requires **API Token**.
/api/fields/{index_name}
Get a list of all fields (keys) present in an index. Requires **API Token**.
/api/roots/{index_name}
Explore morphological roots and their original words. Requires **API Token**.
/api/root-words/{index_name}?root=علم
03 Searching
/api/search
Search through your indexed data with advanced linguistic support. Requires **API Token**.
| Parameter | Type | Description |
|---|---|---|
| index_name | string | Target index name (Required) |
| q | string | Search query string (Required) |
| mode | string | smart, exact, stem, root |
| boolean | bool | Enable AND, OR, NOT operators |
| ids_only | bool | Return only IDs (Bypasses storage) |
| filter[key] | string | Exact match filter |
| highlight | string | Comma-separated fields to highlight |
| snippet | string | Comma-separated fields for snippets |
{
"status": "success",
"hits": ["1", "5", "12", "45"],
"total": 4,
"execution_time": "0.0012s"
}
04 Advanced Strategy
STEMUR Strategy
Misbar uses a sophisticated **Multi-Layer Indexing Strategy** to ensure high relevance and linguistic accuracy for Arabic and Urdu.
Exact Match
Original normalized word. Weighted x3.
Stem Match
Concept/stem after removing affixes. Weighted x2.
Root Match
Morphological root (STEMUR). Weighted x1.
/api/index/export/{name}
Download a ZIP file containing the full-text index and document storage.
/api/index/import
Restore an index from a previously exported ZIP file.
/api/stats/{index_name}
Get detailed information about an index size and document count.
05 Error Handling
{
"status": "error",
"message": "Detailed error message here"
}
06 Best Practices
Tokens Security
Use Master Token only for admin tasks. Use API Tokens for daily operations.
Batch Indexing
Send documents in batches (500-1000) for optimal performance.
Unique IDs
Ensure every document has a unique `id` field to prevent overwrites.
Concurrency
The system supports searching while indexing is in progress.