Create semantic model
curl --request POST \
--url https://api.example.com/api/semantic-models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"domain_urn": "<string>",
"domain_name": "<string>",
"source_tables": [
"<string>"
],
"generated_sql": "<string>",
"target_catalog": "<string>",
"target_schema": "<string>",
"description": "",
"columns": [],
"ai_confidence_score": 123,
"ai_reasoning": "<string>"
}
'import requests
url = "https://api.example.com/api/semantic-models"
payload = {
"name": "<string>",
"domain_urn": "<string>",
"domain_name": "<string>",
"source_tables": ["<string>"],
"generated_sql": "<string>",
"target_catalog": "<string>",
"target_schema": "<string>",
"description": "",
"columns": [],
"ai_confidence_score": 123,
"ai_reasoning": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
domain_urn: '<string>',
domain_name: '<string>',
source_tables: ['<string>'],
generated_sql: '<string>',
target_catalog: '<string>',
target_schema: '<string>',
description: '',
columns: [],
ai_confidence_score: 123,
ai_reasoning: '<string>'
})
};
fetch('https://api.example.com/api/semantic-models', 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://api.example.com/api/semantic-models",
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([
'name' => '<string>',
'domain_urn' => '<string>',
'domain_name' => '<string>',
'source_tables' => [
'<string>'
],
'generated_sql' => '<string>',
'target_catalog' => '<string>',
'target_schema' => '<string>',
'description' => '',
'columns' => [
],
'ai_confidence_score' => 123,
'ai_reasoning' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.example.com/api/semantic-models"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"domain_urn\": \"<string>\",\n \"domain_name\": \"<string>\",\n \"source_tables\": [\n \"<string>\"\n ],\n \"generated_sql\": \"<string>\",\n \"target_catalog\": \"<string>\",\n \"target_schema\": \"<string>\",\n \"description\": \"\",\n \"columns\": [],\n \"ai_confidence_score\": 123,\n \"ai_reasoning\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.example.com/api/semantic-models")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"domain_urn\": \"<string>\",\n \"domain_name\": \"<string>\",\n \"source_tables\": [\n \"<string>\"\n ],\n \"generated_sql\": \"<string>\",\n \"target_catalog\": \"<string>\",\n \"target_schema\": \"<string>\",\n \"description\": \"\",\n \"columns\": [],\n \"ai_confidence_score\": 123,\n \"ai_reasoning\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/semantic-models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"domain_urn\": \"<string>\",\n \"domain_name\": \"<string>\",\n \"source_tables\": [\n \"<string>\"\n ],\n \"generated_sql\": \"<string>\",\n \"target_catalog\": \"<string>\",\n \"target_schema\": \"<string>\",\n \"description\": \"\",\n \"columns\": [],\n \"ai_confidence_score\": 123,\n \"ai_reasoning\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"domain_urn": "<string>",
"domain_name": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_tables": "<string>",
"generated_sql": "<string>",
"approved_sql": "<string>",
"target_catalog": "<string>",
"target_schema": "<string>",
"view_name": "<string>",
"status": "draft",
"ai_confidence_score": 123,
"ai_reasoning": "<string>",
"generation_task_id": "<string>",
"reviewed_by": "<string>",
"reviewed_at": "2023-11-07T05:31:56Z",
"review_notes": "<string>",
"schedule_cron": "<string>",
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by": "<string>",
"owner_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deployed_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"version": 123,
"parent_model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": ""
}{
"error": "<string>",
"code": 500
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Semantic models
Create semantic model
Create a new semantic model manually. For AI-generated models, use the “Generate semantic model” endpoint instead.
Required roles: nx1_semantic_modeller or nx1_semantic_admin
POST
/
api
/
semantic-models
Create semantic model
curl --request POST \
--url https://api.example.com/api/semantic-models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"domain_urn": "<string>",
"domain_name": "<string>",
"source_tables": [
"<string>"
],
"generated_sql": "<string>",
"target_catalog": "<string>",
"target_schema": "<string>",
"description": "",
"columns": [],
"ai_confidence_score": 123,
"ai_reasoning": "<string>"
}
'import requests
url = "https://api.example.com/api/semantic-models"
payload = {
"name": "<string>",
"domain_urn": "<string>",
"domain_name": "<string>",
"source_tables": ["<string>"],
"generated_sql": "<string>",
"target_catalog": "<string>",
"target_schema": "<string>",
"description": "",
"columns": [],
"ai_confidence_score": 123,
"ai_reasoning": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
domain_urn: '<string>',
domain_name: '<string>',
source_tables: ['<string>'],
generated_sql: '<string>',
target_catalog: '<string>',
target_schema: '<string>',
description: '',
columns: [],
ai_confidence_score: 123,
ai_reasoning: '<string>'
})
};
fetch('https://api.example.com/api/semantic-models', 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://api.example.com/api/semantic-models",
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([
'name' => '<string>',
'domain_urn' => '<string>',
'domain_name' => '<string>',
'source_tables' => [
'<string>'
],
'generated_sql' => '<string>',
'target_catalog' => '<string>',
'target_schema' => '<string>',
'description' => '',
'columns' => [
],
'ai_confidence_score' => 123,
'ai_reasoning' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.example.com/api/semantic-models"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"domain_urn\": \"<string>\",\n \"domain_name\": \"<string>\",\n \"source_tables\": [\n \"<string>\"\n ],\n \"generated_sql\": \"<string>\",\n \"target_catalog\": \"<string>\",\n \"target_schema\": \"<string>\",\n \"description\": \"\",\n \"columns\": [],\n \"ai_confidence_score\": 123,\n \"ai_reasoning\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.example.com/api/semantic-models")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"domain_urn\": \"<string>\",\n \"domain_name\": \"<string>\",\n \"source_tables\": [\n \"<string>\"\n ],\n \"generated_sql\": \"<string>\",\n \"target_catalog\": \"<string>\",\n \"target_schema\": \"<string>\",\n \"description\": \"\",\n \"columns\": [],\n \"ai_confidence_score\": 123,\n \"ai_reasoning\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/semantic-models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"domain_urn\": \"<string>\",\n \"domain_name\": \"<string>\",\n \"source_tables\": [\n \"<string>\"\n ],\n \"generated_sql\": \"<string>\",\n \"target_catalog\": \"<string>\",\n \"target_schema\": \"<string>\",\n \"description\": \"\",\n \"columns\": [],\n \"ai_confidence_score\": 123,\n \"ai_reasoning\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"domain_urn": "<string>",
"domain_name": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_tables": "<string>",
"generated_sql": "<string>",
"approved_sql": "<string>",
"target_catalog": "<string>",
"target_schema": "<string>",
"view_name": "<string>",
"status": "draft",
"ai_confidence_score": 123,
"ai_reasoning": "<string>",
"generation_task_id": "<string>",
"reviewed_by": "<string>",
"reviewed_at": "2023-11-07T05:31:56Z",
"review_notes": "<string>",
"schedule_cron": "<string>",
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by": "<string>",
"owner_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deployed_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"version": 123,
"parent_model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": ""
}{
"error": "<string>",
"code": 500
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
OAuth2AuthorizationCodeBearerAPIKeyHeader
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/json
Request to create a semantic model.
Business-friendly model name.
DataHub domain URN.
Human-readable domain name.
List of source table URNs.
SQL query for the view.
Trino catalog.
Trino schema.
Model description.
Column definitions.
Show child attributes
Show child attributes
AI confidence score.
AI reasoning for this model.
Response
Model created successfully
Response model for a semantic model.
Business-friendly model name.
DataHub domain URN.
Human-readable domain name.
Status of a semantic model.
Available options:
draft, pending_review, approved, rejected, deployed, failed, archived Model description.
Was this page helpful?

