Welcome to the Lodexi API! This guide will help you connect your external applications (like Telegram Bots, WhatsApp, or Google Apps Script) to your isolated Lodexi Projects (Bots).
Lodexi operates on a Multi-Project architecture. This means API Keys are scoped per Project, not per user account.
To get your Project's API Key:
- Log in to the Lodexi Dashboard.
- Select your Project, and navigate to Project Settings -> API Keys.
- Click Create new secret key.
- Copy the generated key. (Keep it safe; you won't be able to see it again!)
Include this key in the Authorization header of your HTTP requests as a Bearer token.
Authorization: Bearer YOUR_API_KEY_HERE
Accept: application/jsonThis is the primary endpoint for conversational Q&A. It takes a user's question, searches the specific Project's uploaded PDF/TXT documents, and returns a grounded answer.
Endpoint: POST https://lodexi.yourdomain.com/api/v1/ask
{
"question": "What is the company policy on remote work?",
"limit": 3
}question(string, required): The question you want to ask your documents.limit(integer, optional): The maximum number of document chunks to retrieve (default is 4).
curl -X POST "https://lodexi.yourdomain.com/api/v1/ask" \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"question": "What is the company policy on remote work?"
}'Before integrating your bot, you can instruct it on how to behave by configuring its AI Persona (System Prompt).
- Go to Project Settings -> AI Persona.
- Write a custom instruction. For example:
"You are a friendly HR assistant. Always reply in Indonesian and refer to the employee as 'Kak'. If you don't know the answer, politely ask them to contact hr@company.com."
- Save the settings. Every request sent to the
/v1/askendpoint (or via Webhooks) will automatically enforce this persona.
Lodexi provides native Webhook URLs for instant integration into enterprise platforms, without writing any code.
- Go to Project Settings -> Trigger.
- Copy the generated Webhook URL (e.g.,
https://lodexi.com/api/v1/projects/{uuid}/chat/google). - Open Google Cloud Console -> Google Chat API -> Configuration.
- Set the Connection Settings to App URL and paste your Lodexi Webhook URL.
- Save. Your bot is now live in Google Chat and will answer questions using your Project's Knowledge Base and AI Persona.
Want to create custom workflows or process Google Sheets rows? Use this AppScript snippet:
function askLodexi(questionText) {
var url = "https://lodexi.yourdomain.com/api/v1/ask";
var apiKey = "YOUR_API_KEY_HERE";
var payload = {
"question": questionText,
"limit": 3
};
var options = {
"method": "post",
"headers": {
"Authorization": "Bearer " + apiKey,
"Content-Type": "application/json",
"Accept": "application/json"
},
"payload": JSON.stringify(payload)
};
try {
var response = UrlFetchApp.fetch(url, options);
var json = JSON.parse(response.getContentText());
return json.answer;
} catch (e) {
return "Error contacting Lodexi AI: " + e.message;
}
}