Quick Start Guide

Get started with dialektai in less than 5 minutes.

Step 1: Create an Account

  1. Visit app.dialektai.com
  2. Sign up with your email or OAuth provider (Google, Microsoft)
  3. Verify your email address

Step 2: Set Up Your Organization

After logging in, you'll be guided through organization setup:

  1. Enter your organization name
  2. Choose your plan (Free trial available)
  3. 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):

For NoSQL Databases (MongoDB):

💡 Best Practice
Always use read-only credentials for database connections to ensure data security. For MongoDB, use a user with read role only.

Step 4: Create an API Key

Generate an organization-level API key:

  1. Go to Settings → API Keys
  2. Click Create API Key
  3. Choose scope: Organization-level (all databases) or Database-level (single database)
  4. 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.

💡 Multi-Tenant Security
For multi-tenant applications, use 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:

Troubleshooting

Common Issues

Error: "Invalid API key"

Error: "Database connection failed"

Error: "Invalid X-Tenant-Id"

Understanding X-Scope-Id (optional header)

Getting Help