Text-to-SQL
curl --request POST \
--url https://{instance}.domo.com/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": ""
}
]
}
]
}
'import requests
url = "https://{instance}.domo.com/api/ai/v1/text/sql"
payload = {
"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": ""
}
]
}
]
}
headers = {
"X-DOMO-Developer-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-DOMO-Developer-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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: ''}
]
}
]
})
};
fetch('https://{instance}.domo.com/api/ai/v1/text/sql', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.domo.com/api/ai/v1/text/sql",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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' => ''
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DOMO-Developer-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{instance}.domo.com/api/ai/v1/text/sql"
payload := strings.NewReader("{\n \"input\": \"What are my total sales by region?\",\n \"dataSourceSchemas\": [\n {\n \"dataSourceName\": \"Store Sales\",\n \"description\": \"\",\n \"columns\": [\n {\n \"type\": \"STRING\",\n \"name\": \"product\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"store\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"amount\",\n \"description\": \"\"\n },\n {\n \"type\": \"DATETIME\",\n \"name\": \"timestamp\",\n \"description\": \"\"\n },\n {\n \"type\": \"STRING\",\n \"name\": \"region\",\n \"description\": \"\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DOMO-Developer-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{instance}.domo.com/api/ai/v1/text/sql")
.header("X-DOMO-Developer-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"What are my total sales by region?\",\n \"dataSourceSchemas\": [\n {\n \"dataSourceName\": \"Store Sales\",\n \"description\": \"\",\n \"columns\": [\n {\n \"type\": \"STRING\",\n \"name\": \"product\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"store\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"amount\",\n \"description\": \"\"\n },\n {\n \"type\": \"DATETIME\",\n \"name\": \"timestamp\",\n \"description\": \"\"\n },\n {\n \"type\": \"STRING\",\n \"name\": \"region\",\n \"description\": \"\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.domo.com/api/ai/v1/text/sql")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DOMO-Developer-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"What are my total sales by region?\",\n \"dataSourceSchemas\": [\n {\n \"dataSourceName\": \"Store Sales\",\n \"description\": \"\",\n \"columns\": [\n {\n \"type\": \"STRING\",\n \"name\": \"product\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"store\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"amount\",\n \"description\": \"\"\n },\n {\n \"type\": \"DATETIME\",\n \"name\": \"timestamp\",\n \"description\": \"\"\n },\n {\n \"type\": \"STRING\",\n \"name\": \"region\",\n \"description\": \"\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"output": "SELECT region, SUM(amount) AS total_sales FROM `Store Sales` GROUP BY region",
"modelId": "domo.domo_ai.domogpt-sql-v1:anthropic"
}{
"message": "<string>"
}AI Services API
Text-to-SQL
Generate SQL based on the given text input and schemas.
POST
/
api
/
ai
/
v1
/
text
/
sql
Text-to-SQL
curl --request POST \
--url https://{instance}.domo.com/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": ""
}
]
}
]
}
'import requests
url = "https://{instance}.domo.com/api/ai/v1/text/sql"
payload = {
"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": ""
}
]
}
]
}
headers = {
"X-DOMO-Developer-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-DOMO-Developer-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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: ''}
]
}
]
})
};
fetch('https://{instance}.domo.com/api/ai/v1/text/sql', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.domo.com/api/ai/v1/text/sql",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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' => ''
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DOMO-Developer-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{instance}.domo.com/api/ai/v1/text/sql"
payload := strings.NewReader("{\n \"input\": \"What are my total sales by region?\",\n \"dataSourceSchemas\": [\n {\n \"dataSourceName\": \"Store Sales\",\n \"description\": \"\",\n \"columns\": [\n {\n \"type\": \"STRING\",\n \"name\": \"product\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"store\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"amount\",\n \"description\": \"\"\n },\n {\n \"type\": \"DATETIME\",\n \"name\": \"timestamp\",\n \"description\": \"\"\n },\n {\n \"type\": \"STRING\",\n \"name\": \"region\",\n \"description\": \"\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DOMO-Developer-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{instance}.domo.com/api/ai/v1/text/sql")
.header("X-DOMO-Developer-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"What are my total sales by region?\",\n \"dataSourceSchemas\": [\n {\n \"dataSourceName\": \"Store Sales\",\n \"description\": \"\",\n \"columns\": [\n {\n \"type\": \"STRING\",\n \"name\": \"product\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"store\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"amount\",\n \"description\": \"\"\n },\n {\n \"type\": \"DATETIME\",\n \"name\": \"timestamp\",\n \"description\": \"\"\n },\n {\n \"type\": \"STRING\",\n \"name\": \"region\",\n \"description\": \"\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.domo.com/api/ai/v1/text/sql")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DOMO-Developer-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"What are my total sales by region?\",\n \"dataSourceSchemas\": [\n {\n \"dataSourceName\": \"Store Sales\",\n \"description\": \"\",\n \"columns\": [\n {\n \"type\": \"STRING\",\n \"name\": \"product\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"store\",\n \"description\": \"\"\n },\n {\n \"type\": \"LONG\",\n \"name\": \"amount\",\n \"description\": \"\"\n },\n {\n \"type\": \"DATETIME\",\n \"name\": \"timestamp\",\n \"description\": \"\"\n },\n {\n \"type\": \"STRING\",\n \"name\": \"region\",\n \"description\": \"\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"output": "SELECT region, SUM(amount) AS total_sales FROM `Store Sales` GROUP BY region",
"modelId": "domo.domo_ai.domogpt-sql-v1:anthropic"
}{
"message": "<string>"
}Authorizations
Domo Developer Token for authentication.
Body
application/json
The input text to send to the model.
Show child attributes
Show child attributes
The ID of the model to use.
Additional model-specific configuration key-value pairs (e.g., temperature).
Example:
{ "temperature": 0.7, "max_tokens": 1024 }
A prompt template object. The 'template' string should contain placeholders.
Show child attributes
Show child attributes
Custom parameters to inject into the prompt template.
Example:
{ "language": "Japanese" }
The system message to use.
⌘I