15. AI2sql API Integration
Method: POST
Endpoint: https://web.ai2sql.io/api/1.1/wf/<BUSINESS_IDENTIFIER>
Authentication: Token <ACCESS_TOKEN>
Parameters:
prompt: A brief explanation of the data query you need.
model_version: Choose from sg-v1, sg-v2, sg-v3, sg-v4, or sg-v5. Default is sg-v1.
database_type: Supports one of these databases - MSSQL, MariaDB, Aurora, DynamoDB, or SQLite.
tables: An array of objects detailing your database schema.
tool: The tool parameter specifies the operation to perform: text2sql, optimizesql,
explainsqlcurl -X POST 'https://web.ai2sql.io/api/1.1/wf/<BUSINESS_IDENTIFIER>' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer YOUR_BEARER_TOKEN' \
-d 'user=YOUR_EMAIL_ADDRESS' \
-d 'prompt=Get all customers who joined in the last month' \
-d 'tables=customers(id, name, join_date)' \
-d 'tool=text2sql'
Utilizing AI2sql API After Adding Tables
Schema Mapping
Last updated