Database Agent API
Ask a PostgreSQL or MySQL database questions in plain English from your own code, and get back the answer, the SQL that produced it, the rows and a chart suggestion.
Database Agent turns a question such as "How many orders were placed in each month of 2025?" into SQL, runs it read-only against your database, and answers in plain language. The web application and this API are two doors to the same agent: whatever you set up in the app — the connected database, which tables the agent may read, the model it uses — applies to API calls too.
What you can build
- Answers in your own product. Send a user's question, show the answer, and optionally the SQL and rows behind it.
- Scheduled questions. Ask the same question every morning from a job and post the answer to Slack or email.
- Agents in your editor. Give Claude Code, or any MCP client, your agent as tools with the MCP server.
- Chat on your website. The app's embeddable widget uses the same agent; this API is for everything else.
How it fits together
| Concept | What it is |
|---|---|
| Agent | One assistant connected to one or more databases. Its id looks like NL2SQL_1A2B3C4D. You create agents in the app. |
| API key | A secret issued for one agent. Every request sends it in the X-API-Key header. |
| Conversation | A session_id returned by the first question. Send follow-ups to it and the agent keeps the context. |
| Answer | response (Markdown text), plus — when you ask for them and the agent allows it — the generated SQL, the result rows and a chart suggestion. |
Base URL
https://futuresmart.ai/database-agent/apiEvery path in these docs is relative to it, for example POST /v1/agents/{agent_id}/chat. Requests and responses are JSON over HTTPS. The older address https://app.futuresmart.ai/nl2sql/api serves the same routes and keeps working.
A self-hosted installation of the open-source project serves the same routes from its own root, http://127.0.0.1:18000/nl2sql/api by default.
Start here
- Quickstart — create an agent, get a key, and ask your first question in about five minutes.
- API keys and permissions — what a key can and cannot do, and how to keep it safe.
- Ask questions — every request option and every field in the answer.
- API reference — all endpoints, generated from the deployed OpenAPI contract.