Hitchhiker's guide to Natrul AI
🚀 Getting Started
- Create an App in your workspace. This will generate a unique
app_idused for all context operations. - Upload Documents using the
/api/v1/apps/add-contextendpoint or the in-app "Add Context" tool. Each file becomes part of the vector index. - Add Users to your app from the workspace. Each assigned user receives a unique
user_keyfor personalized context merging. - Start Making API Calls using your
app_idand optionaluser_keyto retrieve, complete, or enhance content in context.
Add App Context
Upload files to build or update an app’s vector index. Accepts PDFs, DOCX, TXT, and more.
POST /api/v1/apps/add-context
FormData:
app_id: "ak_abc123"
owner_id: "u_xyz456"
files: [file1.pdf, file2.docx]
Returns a success message and document count if indexing completes successfully.
Query Assistant
Ask natural language questions and receive intelligent answers grounded in your indexed content.
POST /api/v1/ai/query
{
"query": "What is our refund policy?",
"instruct": "If you don't know the answer, tell the user to call 555-555-5555." // optional
"app_id": "ak_abc123",
"user_key": "uac_xyz456" // optional
}
Returns a context-aware AI response in data.response using your app and user-level index.
Get App Users
Retrieve users who have been assigned to your app for personalized context merging.
POST /api/v1/apps/users
{
"app_id": "ak_abc123",
"owner_id": "u_xyz456"
}
Returns a list of users with user_id and optional email metadata.
Retrieve Context
Search your indexed documents (app + user) for relevant content using vector similarity.
POST /api/v1/ai/retrieve-context
{
"query": "project update",
"app_id": "ak_abc123",
"user_key": "uac_xyz456" // optional
}
Returns a list of matching nodes in data.matches, each with text, score, metadata, and ref_doc_id.
Autocomplete Input
Return short text completions based on context-relevant terms, useful for form fields.
POST /api/v1/ai/complete-input
{
"query": "AutoP",
"app_id": "ak_abc123",
"user_key": "uac_xyz456", // optional
}
Returns a short string in data.completion based on the indexed content.
Enhance Text
Improve clarity and tone while preserving meaning, ideal for customer inputs or support messages.
POST /api/v1/ai/enhance-input
{
"query": "I need help signing in ASAP",
"instruct": "Generate a thorough help desk email, including a ticket number or placeholder if not provided", // optional
"app_id": "ak_abc123",
"user_key": "uac_xyz456" // optional
}
Returns a cleaned-up version in data.enhanced_text based on your document index.