Articles on: APIs

Natural Language Query API


BlazeSQL Query Agent API


The Query Agent API allows you to send a message to Blaze, our AI Powered data analysis agent, and retrieve the results.


Overview


The Query Agent API enables you to:


  • Submit natural language requests to generate and execute SQL queries
  • Retrieve the generated SQL, the query results, and the chat response
  • Connect to your existing databases configured in BlazeSQL


Authentication


API requests require a valid API key from a BlazeSQL Team Advanced subscription.


Endpoint


POST https://api.blazesql.com/natural_language_query_api


Request Parameters


{
"db_id": "string", // Required: The ID of the database to query
"natural_language_request": "string", // Required: The natural language description of the query
"api_key": "string" // Required: Your BlazeSQL API key
}


To get your database ID, open the dialog by clicking the option in the following picture:


Database ID

Response Format


Successful responses have the following structure:


{
"success": true,
"message": "Query processed successfully",
"query": "SQL query that was generated and executed",
"agent_response": "Natural language explanation of the results",
"data_result": {
"column1": ["value1", "value2", "value3"],
"column2": [10, 20, 30],
"column3": ["2023-01-01", "2023-01-02", "2023-01-03"]
}
}


The data_result is a dictionary/map where:


  • Keys are the column names from your query
  • Values are lists containing all values for that column


Error responses include:


{
"success": false,
"error": "Description of the error",
"error_code": 400
}


Error Codes


400 - Missing required parameters
401 - Invalid API key
403 - Subscription requirements not met
404 - Database or user not found
500 - Database connection or processing error
504 - Processing timeout


Requirements


  • A valid BlazeSQL Team Advanced subscription
  • Database connection must be properly configured in BlazeSQL web - BlazeSQL.com/app
  • Valid API key associated with your account - check your settings page on BlazeSQL.com/app


Limitations


  • Requests will timeout after 8 minutes if processing is not complete
  • Rate limits are set at 60 requests/hour


Support


For additional assistance, please contact support

Updated on: 28/05/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!