Introduction

Zentra Documentation

Zentra lets you query your financial database using plain English — no SQL, no code, no waiting. Just ask a question and get an exact answer in milliseconds.

Sub-50ms on repeat queries

Zentra remembers answers it has given before and returns them instantly from cache — zero AI cost, zero database load.

🎯

Exact answers, not guesses

Unlike fuzzy AI search, Zentra runs real SQL queries against your database. The number you get is the number in your data.

🔒

Read-only & secure

Zentra can only read your data — never modify or delete it. All queries are validated before execution.

💬

Plain English interface

No SQL knowledge required. Ask questions the way you'd ask a colleague — Zentra handles the technical translation.


Architecture

How It Works

Every time you submit a query, Zentra follows one of two paths depending on whether it has seen your question before.

1

You type a question in plain English

Example: "What was TechCorp's revenue in Q1 2025?"
2

Zentra checks its memory (cache)

Cache HitIf Zentra has answered this exact question before, it returns the stored answer instantly — usually under 50ms. No AI call made, no cost incurred.
Cache MissIf it's a new question, Zentra moves to step 3.
3

AI converts your question to SQL

An AI model reads your question, understands your database schema, and generates the correct SQL — like SELECT revenue FROM financials WHERE quarter = 'Q1 2025'.
4

SQL runs securely against your database

The query executes in a sandboxed environment. Only SELECT statements are permitted — your data is never at risk of modification.
5

Answer is returned and stored

You receive a clean, formatted answer. Zentra saves it to cache so the next time anyone asks the same question, it returns in milliseconds.
Why this matters for finance: In financial analysis, you often ask the same questions repeatedly — quarter comparisons, KPI checks, sector summaries. Zentra's cache turns those repeated lookups into near-instant responses at zero additional cost.

Setup

Connect Your Database

Before running queries, connect Zentra to your database. Navigate to Settings → Connect Database in your dashboard.

1

Open Settings

Click the Settings icon in the left sidebar of your dashboard.
2

Enter your database credentials

Fill in your Host, Port, Database Name, Username, and Password. Zentra supports PostgreSQL databases.
3

Test the connection

Click Test Connection to verify credentials before saving. Zentra will confirm whether it can reach your database.
4

Activate

Click Connect Database. All future queries will route to your live database. The demo data is no longer used once you connect.
Note: Zentra only ever reads from your database — it cannot write, update, or delete any records. Your data is safe.

Getting Started

Your First Query

Once your database is connected, go to the Query page from the sidebar. Type your question in the input box and press Enter or click Ask.

Start simple to confirm everything is working:

What companies are in our database?Good first query
Show me all tables and what data they containSchema check

You'll see the answer below the input box, along with two key indicators: whether the result came from Cache Hit or a fresh Cache Miss, and the response latency in milliseconds.


Best Practices

Writing Good Queries

Zentra understands natural language, but the more specific your question, the more accurate and cache-friendly the answer.

Be specific with names and time periods

Show me the revenueToo vague
What was TechCorp's revenue in Q1 2025?Specific
Compare Q1 2025 vs Q1 2024 revenue for all technology companiesEven better

Use exact company names

Zentra queries your database directly, so company names must match what's stored. If a query returns no results, try the exact spelling as it appears in your data.

Specify time periods clearly

Use formats like Q1 2025, 2024, January 2025 rather than relative terms like "last quarter" — your database stores data at fixed dates, not relative ones.

Break complex questions into parts

Give me everything about all companies including trends, ratios, and forecastsToo broad
Which sector had the highest average profit margin in 2024?Focused
Cache tip: Repeated queries are free and instant. If you run reports regularly, ask questions the same way each time — Zentra will serve them from cache in under 50ms.

Reference

Query Examples

Company information

Show me all companies and their sectors
Which companies are in the healthcare sector?
Show me companies ranked by market cap
How many companies are in each sector?

Revenue & profitability

What was TechCorp's Q1 2025 revenue?
Compare Q1 2025 revenue across all companies
Which company had the highest profit margin in 2024?
Show me quarterly revenue trends for 2024

Comparative analysis

Compare TechCorp and HealthPlus financial performance in 2024
Who are the top 3 companies by revenue in each sector?
Compare 2024 vs 2023 overall revenue
Which companies have the highest year-over-year growth?

Financial KPIs

What is the average profit margin for technology companies?
Show me revenue growth rate for TechCorp
Which sector has the best financial performance?
Give me an executive summary of Q1 2025 performance

Dashboard Guide

Reading Your Results

Every query response shows four pieces of information alongside the answer:

IndicatorWhat it means
Cache HitAnswer was retrieved from memory — no AI cost, returned in under 50ms.
Cache MissNew question — AI was called, SQL was run, answer is now cached for future use.
Latency (ms)Total time from your question to the displayed answer. Cache hits typically show 20–50ms. First-time queries show 500–7000ms depending on complexity.
Query IDUnique identifier for this specific query — useful if you need to report an issue.

Your query history is available in the sidebar so you can revisit past answers without re-running them.


Performance

Cache & Speed

Zentra's cache is what makes it dramatically faster and cheaper than running AI queries every time.

Why your first query is slower

The first time you ask a question, Zentra calls the AI and queries your database. This typically takes 1–7 seconds. Every subsequent time you ask the same question, it returns in under 50ms from cache.

Why slightly different wording causes a miss

"List all companies" and "Show me all companies" are treated as different questions. For reports you run regularly, use the same wording each time to guarantee a cache hit.

Why cached answers don't last forever

Your database data changes — new companies get added, financial records get updated. Zentra's cache has a limited lifetime to ensure you always see fresh data rather than stale results.

Pro tip: Run your standard report queries at the start of each session. After the first run they'll be cached, and every subsequent query returns instantly.

Developers

API Reference

If you're integrating Zentra into your own tools or scripts, use the REST API directly.

Base URL

https://your-domain.com/api/v1

Authentication

All requests require a Firebase Bearer token:

Authorization: Bearer <your-firebase-token>

POST /query

Submit a natural language question and receive an answer.

POST/api/v1/query

Request body:

FieldTypeRequiredDescription
querystringYesYour natural language question

Response:

FieldDescription
answerThe formatted answer to your question
cache_hittrue if served from cache, false if fresh AI call
latency_msTotal response time in milliseconds
query_idUnique ID for this query

GET /health

Check if the Zentra system is online.

GET/api/v1/health

GET /metrics

Returns total query count, cache hit rate, and average latency.

GET/api/v1/metrics

GET /cache/status

Returns cache health, hit count, and hit rate.

GET/api/v1/cache/status

Rate limits

LimitValue
Requests per user per minute60
Response when exceededHTTP 429

Support

Troubleshooting

Query returns no results

This usually means the data doesn't exist in your database for the specified parameters. Try asking Zentra what data is available:

What time periods do we have financial data for?
What companies are in the database?

Query returns an error about a column not existing

Zentra occasionally generates SQL using a column name that doesn't exactly match your schema. It will automatically retry with the correct schema. If errors persist, try rephrasing your question more specifically.

Response is slow

First-time queries (Cache Miss) can take 1–7 seconds while the AI generates and runs the SQL. This is normal. The same query will be near-instant on all future runs. If every query is slow, check your database connection under Settings.

"Service unavailable" or error 503

The system may be temporarily overloaded. Wait 30 seconds and try again. If the issue persists, contact support via email with your Query ID.

Database won't connect

Double-check that your host, port, database name, username, and password are all correct. Ensure your database server allows inbound connections from Zentra's IP. Use the Test Connection button in Settings to diagnose.

Getting a 429 rate limit error

You've sent more than 60 queries in a minute. Wait a moment and resume. If you need higher limits, contact us to discuss your plan.


FAQ

Frequently Asked Questions

Do I need to know SQL to use Zentra?

No. Zentra converts your plain English questions into SQL automatically. You never write or see any SQL unless you specifically ask for it.

Can Zentra modify or delete my data?

No. Zentra is strictly read-only. Only SELECT queries are permitted — it cannot insert, update, or delete any records in your database.

Why does the same question sometimes get a Cache Miss?

Zentra caches by exact question text. Minor wording differences — "List all companies" vs "Show me all companies" — are treated as separate questions. Use consistent phrasing for queries you run regularly to always hit the cache.

How long does Zentra keep cached answers?

Cache entries expire automatically to prevent stale data. Since financial databases update regularly, Zentra refreshes its cache on a short cycle to ensure you always see accurate results.

What databases does Zentra support?

Zentra currently supports PostgreSQL. If you're on the demo, it uses a built-in database with sample financial data. Connect your own PostgreSQL database under Settings.

What's a good cache hit rate?

Target 80% or higher. You can check your current cache hit rate on the Metrics page. A low hit rate typically means queries are being phrased differently each time — try standardizing your question wording.

Can I use Zentra programmatically via API?

Yes. Zentra exposes a REST API at POST /api/v1/query. See the API Reference section above for full details. Useful for building custom dashboards or automating report generation.

What if Zentra gives a wrong answer?

Zentra retrieves exact values from your database — it doesn't guess or estimate. If an answer looks wrong, verify the underlying data in your database first. If the data is correct but the answer is still wrong, contact support with the Query ID shown in the response.

How do I get support on the Free plan?

Free plan users can access all documentation pages. For additional help, use the email support link in the dashboard footer. Pro and Enterprise plans include priority email and live support.