Retrieve the Semantic Layer root
curl --request GET \
--url https://api.nekt.ai/api/v1/semantic-layer/catalog/ \
--header 'x-api-key: <api-key>'import requests
url = "https://api.nekt.ai/api/v1/semantic-layer/catalog/"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.nekt.ai/api/v1/semantic-layer/catalog/', 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.nekt.ai/api/v1/semantic-layer/catalog/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <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"
"net/http"
"io"
)
func main() {
url := "https://api.nekt.ai/api/v1/semantic-layer/catalog/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nekt.ai/api/v1/semantic-layer/catalog/")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/semantic-layer/catalog/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Semantic Layer
Read the Semantic Layer
Discover the catalog, folder, and document ids a grant can name.
GET
/
api
/
v1
/
semantic-layer
/
catalog
/
Retrieve the Semantic Layer root
curl --request GET \
--url https://api.nekt.ai/api/v1/semantic-layer/catalog/ \
--header 'x-api-key: <api-key>'import requests
url = "https://api.nekt.ai/api/v1/semantic-layer/catalog/"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.nekt.ai/api/v1/semantic-layer/catalog/', 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.nekt.ai/api/v1/semantic-layer/catalog/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <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"
"net/http"
"io"
)
func main() {
url := "https://api.nekt.ai/api/v1/semantic-layer/catalog/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nekt.ai/api/v1/semantic-layer/catalog/")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/semantic-layer/catalog/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Assigning a Semantic Layer permission needs the UUID of a catalog, folder, or document. Three read endpoints provide them, and an API key may call all three.
Each list is already filtered to what your key’s creator can reach, so anything it returns is a resource you may name in an assignment. The playground on this page exercises the catalog root; the other two have their own pages.
| Endpoint | Returns | |
|---|---|---|
GET /api/v1/semantic-layer/catalog/ | The root of the tree, the coarsest resource a grant can name. | this page |
GET /api/v1/semantic-layer/folders/ | Top-level folders you can see, paginated. Pass ?flat=true for folders at every depth. | reference |
GET /api/v1/semantic-layer/documents/ | Documents you can see, paginated. Filter with ?folder=<id>, or ?folder=root for documents outside any folder. | reference |
An API key may also write documents: create and edit, bounded by the standing of the person who created
the key (see Create a document). Two things stay closed to a key:
deleting a document, and every write on the folder tree. Deleting a document and creating, renaming,
or deleting a folder return
403; moving and sorting items return 401. Use the app for those.Walk the tree, then grant
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.nekt.ai"
GROUP = "b8c5e1e3-6d02-4f45-ad20-8f4b6e2d0e13"
headers = {"x-api-key": API_KEY, "Content-Type": "application/json"}
def all_folders():
url = f"{BASE_URL}/api/v1/semantic-layer/folders/?flat=true&page_size=100"
while url:
page = requests.get(url, headers=headers).json()
yield from page["results"]
url = page["next"]
finance = next(f for f in all_folders() if f["name"] == "Finance")
requests.post(
f"{BASE_URL}/api/v1/semantic-layer/permissions/",
headers=headers,
json={
"assignments": [
{"permission_level": "viewer", "groups": [GROUP], "folders": [finance["id"]]}
]
},
)
/api/v1/context-documents/ is a legacy alias of the documents endpoint, kept while internal clients migrate. It is not part of the published API: build against /api/v1/semantic-layer/documents/.Related
- List Semantic Layer Folders and List Semantic Layer Documents: the other two reads, with their own playgrounds.
- Assign Semantic Layer Permissions: what to do with the ids.
- Create a Semantic Layer Document: the write side of this tree.
- Semantic Layer: what the module is and how it is used in the app.
Was this page helpful?