Conversations

Read, rename, delete and export saved conversations.

Base URL https://futuresmart.ai/database-agent/api · every request sends X-API-Key. Samples read the key from DATABASE_AGENT_API_KEY. All endpoints

Export an answer's rows as CSV

GET/v1/sessions/{session_id}/export

Return a fresh S3 pre-signed CSV download URL.

  • chat_id provided → that exact query turn's CSV (works forever).
  • No chat_id → most recent SQL result in the session.

UI only needs session_id + chat_id (both already in the orchestration response). No NL2SQL agent_id required.

Credential Database Agent API key for this agent (X-API-Key)

Path parameters

NameTypeDescription
session_idrequiredstringSession ID

Query parameters

NameTypeDescription
chat_idstring | nullSpecific chat turn to export. Omit to get the most recent.

Other responses

  • 422 Validation Error
import os
import requests

API_ROOT = "https://futuresmart.ai/database-agent/api"
API_KEY = os.environ["DATABASE_AGENT_API_KEY"]

r = requests.get(
    f"{API_ROOT}/v1/sessions/YOUR_SESSION_ID/export",
    headers={"X-API-Key": API_KEY},
    timeout=120,
)
r.raise_for_status()
print(r.json())

List conversations

GET/v1/agents/{agent_id}/sessions

Get all sessions for a specific agent

Returns a list of chat sessions associated with the agent.

  • If authenticated, returns sessions for the authenticated user
  • If show_guests_session=true and user is owner, includes guest sessions

Credential Database Agent API key for this agent (X-API-Key)

Path parameters

NameTypeDescription
agent_idrequiredstringAgent ID

Query parameters

NameTypeDescription
show_guests_sessionbooleanInclude guest sessions (owner only)Default: false
emailstring | nullFilter by email

Other responses

  • 422 Validation Error
import os
import requests

API_ROOT = "https://futuresmart.ai/database-agent/api"
API_KEY = os.environ["DATABASE_AGENT_API_KEY"]

r = requests.get(
    f"{API_ROOT}/v1/agents/YOUR_AGENT_ID/sessions",
    headers={"X-API-Key": API_KEY},
    timeout=120,
)
r.raise_for_status()
print(r.json())

Get a conversation

GET/v1/agents/{agent_id}/sessions/{session_id}

Get a specific session by ID with conversation data

Returns session details including:

  • Session metadata (title, created time)
  • Full conversation history

Credential Database Agent API key for this agent (X-API-Key)

Path parameters

NameTypeDescription
agent_idrequiredstringAgent ID
session_idrequiredstringSession ID

Other responses

  • 422 Validation Error
import os
import requests

API_ROOT = "https://futuresmart.ai/database-agent/api"
API_KEY = os.environ["DATABASE_AGENT_API_KEY"]

r = requests.get(
    f"{API_ROOT}/v1/agents/YOUR_AGENT_ID/sessions/YOUR_SESSION_ID",
    headers={"X-API-Key": API_KEY},
    timeout=120,
)
r.raise_for_status()
print(r.json())

Rename a conversation

PATCH/v1/agents/{agent_id}/sessions/{session_id}

Update a session (partial update)

Currently supports updating:

  • session_title: Update the session title

Credential Database Agent API key for this agent (X-API-Key)

Path parameters

NameTypeDescription
agent_idrequiredstringAgent ID
session_idrequiredstringSession ID

Request body · application/json (optional)

NameTypeDescription
session_titlestring | nullNew session title
user_idstring | nullUser ID (optional)

Other responses

  • 422 Validation Error
import os
import requests

API_ROOT = "https://futuresmart.ai/database-agent/api"
API_KEY = os.environ["DATABASE_AGENT_API_KEY"]

r = requests.patch(
    f"{API_ROOT}/v1/agents/YOUR_AGENT_ID/sessions/YOUR_SESSION_ID",
    headers={"X-API-Key": API_KEY},
    json={},
    timeout=120,
)
r.raise_for_status()
print(r.json())

Example request body

JSON
{}

Delete a conversation

DELETE/v1/agents/{agent_id}/sessions/{session_id}

Delete a session (soft delete)

Marks the session as deleted in the database. The session data is not physically removed.

Credential Database Agent API key for this agent (X-API-Key)

Path parameters

NameTypeDescription
agent_idrequiredstringAgent ID
session_idrequiredstringSession ID

Other responses

  • 422 Validation Error
import os
import requests

API_ROOT = "https://futuresmart.ai/database-agent/api"
API_KEY = os.environ["DATABASE_AGENT_API_KEY"]

r = requests.delete(
    f"{API_ROOT}/v1/agents/YOUR_AGENT_ID/sessions/YOUR_SESSION_ID",
    headers={"X-API-Key": API_KEY},
    timeout=120,
)
r.raise_for_status()
print(r.json())