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

ConceptWhat it is
AgentOne assistant connected to one or more databases. Its id looks like NL2SQL_1A2B3C4D. You create agents in the app.
API keyA secret issued for one agent. Every request sends it in the X-API-Key header.
ConversationA session_id returned by the first question. Send follow-ups to it and the agent keeps the context.
Answerresponse (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/api

Every 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

  1. Quickstart — create an agent, get a key, and ask your first question in about five minutes.
  2. API keys and permissions — what a key can and cannot do, and how to keep it safe.
  3. Ask questions — every request option and every field in the answer.
  4. API reference — all endpoints, generated from the deployed OpenAPI contract.