Quick Start Guide
Get started with dialektai in less than 5 minutes.
Step 1: Create an Account
- Visit app.dialektai.com
- Sign up with your email or OAuth provider (Google, Microsoft)
- Verify your email address
Step 2: Set Up Your Organization
After logging in, you'll be guided through organization setup:
- Enter your organization name
- Choose your plan (Free trial available)
- Complete the onboarding wizard
Step 3: Connect Your First Database
Navigate to Settings → Databases → Add Database and fill in the required fields:
For SQL Databases (PostgreSQL, MySQL, SQL Server, SQLite):
- Database Name
- Database Type
- Host & Port
- Database Name
- Username (read-only)
- Password
For NoSQL Databases (MongoDB):
- Database Name
- Database Type (MongoDB)
- Connection String
- Database Name
read role only.Step 4: Create an API Key
Generate an organization-level API key:
- Go to Settings → API Keys
- Click Create API Key
- Choose scope: Organization-level (all databases) or Database-level (single database)
- Copy and securely store your API key
Step 5: Make Your First Query
Using cURL
curl -X POST https://api.dialektai.com/api/v1/chat/message \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Show me the top 10 customers by revenue"
}'
Using Python
import requests
response = requests.post(
'https://api.dialektai.com/api/v1/chat/message',
headers={
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'message': 'Show me the top 10 customers by revenue'
}
)
result = response.json()
print("Response:", result['message'])
print("Conversation ID:", result['conversation_id'])
print("Sources:", result['sources'])
Using JavaScript/TypeScript
const response = await fetch('https://api.dialektai.com/api/v1/chat/message', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
message: 'Show me the top 10 customers by revenue'
})
});
const result = await response.json();
console.log('Response:', result.message);
console.log('Sources:', result.sources);
MongoDB Query Examples
dialektai automatically detects your database type and generates appropriate queries:
SQL Database Query:
"Show me the top 10 customers by revenue"
→ SELECT customer_id, SUM(order_total) as revenue FROM orders GROUP BY customer_id ORDER BY revenue DESC LIMIT 10
MongoDB Database Query:
"Show me the top 10 customers by revenue"
→ db.orders.aggregate([
{ $group: { _id: "$customer_id", revenue: { $sum: "$order_total" } } },
{ $sort: { revenue: -1 } },
{ $limit: 10 }
])
The same natural language query works across all your databases!
Step 6: Integrate the Widget (Optional)
Add DialektAI chat to your web application in 3 lines:
<script src="https://cdn.dialektai.com/widget.js"></script>
<script>
DialektAI.create('#dialektai-chat', {
apiKey: 'pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
databaseId: 'your-database-id',
theme: 'light',
// Optional: Enable multi-tenant data filtering
tenantId: 82, // Organization ID (positive integer) for row-level security
scopeId: 'user-john-456' // User ID for tracking + optional additional filtering
});
</script>
The widget will appear as a chat bubble in the bottom-right corner of your page.
tenantId to ensure users only see their organization's data. See the Widget Integration Guide for complete details on tenant filtering.Example Response
{
"message": "Here are the top 10 customers by revenue...",
"conversation_id": "550e8400-e29b-41d4-a716-446655440000",
"sources": ["database"],
"query_type": "aggregation",
"execution_time_ms": 145
}
Next Steps
Now that you've made your first query, explore:
- Authentication Guide - Learn about API key scopes and security
- Widget Integration - Full widget customization guide
- Tenant Filtering - Implement customer-specific data filtering
- API Reference - Complete endpoint documentation
Troubleshooting
Common Issues
Error: "Invalid API key"
- Verify your API key is correct
- Check that you're using the
X-API-Key: YOUR_API_KEYheader format - Ensure the API key hasn't been deleted or expired
Error: "Database connection failed"
- Verify database credentials are correct
- Check that your database accepts connections from dialektai's IP addresses
- Ensure your database user has SELECT permissions
Error: "Invalid X-Tenant-Id"
- Only use X-Tenant-Id if your database has
requires_organization_scoping = true - Ensure the tenant ID is a positive integer (e.g., 82, not "customer-82")
- X-Tenant-Id provides row-level security for multi-tenant databases
- Example:
WHERE customer_id = 82is automatically applied to all queries
Understanding X-Scope-Id (optional header)
- When tenant filtering is DISABLED: Used for conversation tracking only (no SQL filtering)
- Example: Track which user is chatting for analytics
- Can be any string: "[email protected]", "session-abc123"
- When tenant filtering is ENABLED: Applies additional SQL filtering
- Example: Further restrict data by user, department, or role
- Combined with X-Tenant-Id:
WHERE customer_id = 82 AND user_id = 'john-456'
Getting Help
- Documentation: docs.dialektai.com
- Email Support: [email protected]