Skip to main content
POST
/
api
/
ai
/
v1
/
text
/
sql
Text-to-SQL
curl --request POST \
  --url https://example.com/v1/api/ai/v1/text/sql \
  --header 'Content-Type: application/json' \
  --header 'X-DOMO-Developer-Token: <api-key>' \
  --data '
{
  "input": "What are my total sales by region?",
  "dataSourceSchemas": [
    {
      "dataSourceName": "Store Sales",
      "description": "",
      "columns": [
        {
          "type": "STRING",
          "name": "product",
          "description": ""
        },
        {
          "type": "LONG",
          "name": "store",
          "description": ""
        },
        {
          "type": "LONG",
          "name": "amount",
          "description": ""
        },
        {
          "type": "DATETIME",
          "name": "timestamp",
          "description": ""
        },
        {
          "type": "STRING",
          "name": "region",
          "description": ""
        }
      ]
    }
  ]
}
'
{
  "output": "SELECT region, SUM(amount) AS total_sales FROM `Store Sales` GROUP BY region",
  "modelId": "domo.domo_ai.domogpt-sql-v1:anthropic"
}

Authorizations

X-DOMO-Developer-Token
string
header
required

Domo Developer Token for authentication.

Body

application/json
input
string
required

The input text to send to the model.

dataSourceSchemas
object[]
required
model
string

The ID of the model to use.

modelConfiguration
object

Additional model-specific configuration key-value pairs (e.g., temperature).

Example:
{ "temperature": 0.7, "max_tokens": 1024 }
promptTemplate
object

A prompt template object. The 'template' string should contain placeholders.

parameters
object

Custom parameters to inject into the prompt template.

Example:
{ "language": "Japanese" }
system
string

The system message to use.

Response

The generated SQL query.

Standard successful AI response.

output
string
modelId
string