for companies with their own database

Ask your data anything.
Get answers in plain language.

4ibot is a multi-tenant AI chatbot. Your team asks questions the way they talk - "How many employees do we have?" - and 4ibot writes the SQL, while your data stays in your database.

اسأل بيانات شركتك بالعربية أو الإنجليزية، واحصل على إجابة مباشرة — بياناتك لا تفارق قاعدة بياناتك أبدًا.

Works with PostgreSQL, MySQL, SQL Server and SQLite - English and Arabic supported.

Conversation preview
User Good morning! How many employees do we have?
AI assistant You have 30 employees in total.
SELECT COUNT(*) as total FROM employees

Real output from the demo company: the API returns the SQL, the SDK runs it on the company database and fills the answer.

How 4ibot works

Four steps, no magic. The API never connects to your database - it only writes the query for you.

1

Register your company

Tell us your database type and list the tables (views) you want questions about, with their columns.

2

The model learns your schema

Each view gets a description and an embedding, so questions are matched to the right table.

3

Your users ask questions

Plain English or Arabic. The API returns a friendly answer plus a SQL query, validated against your columns.

4

You run the query, locally

Your backend (or our SDK) executes the SQL on your database and fills the placeholders in the answer.

Your data never leaves your servers

This is the core design decision of 4ibot, not a feature bullet.

Only the question travels

The API receives the natural-language question. Table contents, names and salary figures never reach our servers.

SQL is schema-checked

Generated queries are validated against the columns you registered before they are returned to you.

You execute it yourself

Your app or the SDK runs the query against your connection, so your credentials stay with you.

What the API returns json
// POST {API_BASE}/api/v1/query   header: X-API-Key: comp_...
{
  "status": "success",
  "sql": "SELECT COUNT(*) as total FROM employees",
  "view_name": "employees",
  "confidence": 74.5,
  "has_data_query": true,
  "friendly_response": "You have {{total}} employees in total.",
  "placeholders": ["total"],
  "result_type": "count",
  "sql_validation": "passed"
}

Replace {{total}} with the value your database returns - or let the SDK do it for you.

Registering your company

Registration is a one-time setup. It takes one API call (or a few clicks in the admin panel).

What to prepare

  • Company name and contact email - how we reach you and label your data.
  • Database type - PostgreSQL, MySQL / MariaDB, SQL Server or SQLite.
  • Your views and columns - each table you want answerable, and each column with a short description.
  • Nothing else - no database credentials, no data exports, no firewall openings.

Column descriptions are what make answers accurate: "salary - annual salary in USD" beats "salary".

Register with one call curl
curl -X POST {API_BASE}/api/v1/onboard \
  -H "Content-Type: application/json" \
  -H "X-Onboard-Secret: your-onboard-secret" \
  -d '{
    "company_name": "Acme Corp",
    "contact_email": "admin@acmecorp.com",
    "database_type": "postgresql",
    "views": [
      {
        "view_name": "employees",
        "columns": [
          { "name": "employee_id", "type": "integer",
            "description": "Unique employee identifier" },
          { "name": "department", "type": "varchar",
            "description": "Department (IT, Sales, HR...)" }
        ]
      }
    ]
  }'

The response contains your api_key (format comp_...) and a jwt_secret - save both immediately, they are shown once.

Then answer questions in five lines

The SDK does the boring part: it calls the API, runs the SQL on your database and fills the answer.

Python pip install 4ibot-sdk
from fourbot import FouribotClient

client = FouribotClient(
    api_key="comp_your_api_key",
    db_type="postgresql",
    db_config={
        "host": "db.yourcompany.com",
        "port": 5432,
        "database": "company_db",
        "user": "readonly_user",
        "password": "your_password",
    },
)

result = client.ask("How many employees do we have?")
print(result.friendly_response)  # "You have 30 employees in total."
JavaScript npm install 4ibot-sdk
const { FouribotClient } = require("4ibot-sdk");

const client = new FouribotClient({
  apiKey: "comp_your_api_key",
  dbType: "postgresql",
  dbConfig: {
    host: "db.yourcompany.com",
    port: 5432,
    database: "company_db",
    user: "readonly_user",
    password: "your_password",
  },
});

const result = await client.ask("How many employees do we have?");
console.log(result.friendlyResponse); // "You have 30 employees in total."
View 4ibot SDK on GitHub

Prefer no SDK? Any language can call POST {API_BASE}/api/v1/query and run the returned SQL itself. Full guides: FAQ below, or the README files shipped with each SDK.

Supported databases

Both SDKs ship with an adapter for each of these - install only the driver you use.

PostgreSQL psycopg2 / pg MySQL & MariaDB PyMySQL / mysql2 SQL Server pyodbc / mssql SQLite sqlite3 / better-sqlite3

MongoDB, Firestore and Firebase RTDB adapters are included for the upcoming NoSQL release.

If something goes wrong

Every error carries a machine-readable error and a human friendly_error you can show your users.

CodeMeaningWhat to do
401Missing or invalid API keySend X-API-Key: comp_... from your backend, never from the browser.
404No dataset matched the questionRephrase using table or column names, or ask us to register that view.
400Empty question or bad JSONSend {"question": "..."} as a JSON body.
409Company already registeredUse the API key you received, or contact support to re-issue credentials.
500Server-side errorRetry once; if it persists, email support@4ibot.tech.

Questions companies ask us

Does 4ibot see my company's data?

No. The API only receives the natural-language question. It answers with SQL and a text template; your application runs that SQL against your own database. Row data never travels to 4ibot.

Do I need to expose my database to the internet?

No. There is no inbound connection from 4ibot to your database. Your backend (or the SDK running inside it) is the only thing that talks to your database, using credentials you already trust.

What do I need before registering?

Your company name and contact email, your database type, and the list of tables (views) you want answerable with their columns and short descriptions. The registration call on this page shows the exact format.

Which languages can my users ask in?

English and Arabic. Greetings and small talk are recognised too, and answered conversationally without touching your database.

What happens to questions that match no table?

The API returns 404 No matching dataset with a friendly message, and the question is logged so you can see what your users ask for. If a whole area of your business is missing, contact us and we will register those views.

Can I add more tables later?

Yes. Re-run the onboarding call with the full view list (or ask support). Training is automatic and takes under a minute per view.

Is my API key safe?

Keep it in your backend environment variables only - never in frontend code, never in a public repository. It identifies your company on every request, so treat it like a password.

هل تُرسل بيانات قاعدة بياناتي إلى 4ibot؟

لا. يستقبل 4ibot سؤالك بالنص الطبيعي فقط، ويُعيد استعلام SQL وإجابة جاهزة. بياناتك الفعلية تبقى في قاعدة بياناتك ولا تُرسل إلى خوادم 4ibot أبدًا.

Ready to register your company?

Send us your company name and the tables you want answerable - we will register them and send back your API key, usually within one working day.