Create a Semantic Layer document
curl --request POST \
--url https://api.nekt.ai/api/v1/semantic-layer/documents/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"content": "<string>",
"folder": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.nekt.ai/api/v1/semantic-layer/documents/"
payload = {
"name": "<string>",
"content": "<string>",
"folder": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
content: '<string>',
folder: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.nekt.ai/api/v1/semantic-layer/documents/', 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/documents/",
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>',
'content' => '<string>',
'folder' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nekt.ai/api/v1/semantic-layer/documents/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"folder\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.nekt.ai/api/v1/semantic-layer/documents/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"folder\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/semantic-layer/documents/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"folder\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"mentions": "<unknown>",
"order": 123,
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content": "<string>",
"folder": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Semantic Layer
Create Semantic Layer Document
Write a document into the Semantic Layer with an API key.
POST
/
api
/
v1
/
semantic-layer
/
documents
/
Create a Semantic Layer document
curl --request POST \
--url https://api.nekt.ai/api/v1/semantic-layer/documents/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"content": "<string>",
"folder": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.nekt.ai/api/v1/semantic-layer/documents/"
payload = {
"name": "<string>",
"content": "<string>",
"folder": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
content: '<string>',
folder: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.nekt.ai/api/v1/semantic-layer/documents/', 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/documents/",
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>',
'content' => '<string>',
'folder' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nekt.ai/api/v1/semantic-layer/documents/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"folder\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.nekt.ai/api/v1/semantic-layer/documents/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"folder\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/semantic-layer/documents/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"folder\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"mentions": "<unknown>",
"order": 123,
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content": "<string>",
"folder": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}An API key writes as the person who created it, checked on every request. So a key may create a
document exactly where its creator may:
Demote the creator and every key they minted narrows on the next call — there is nothing to revoke
separately.
Mentions are parsed out of
| Plan | Who may create |
|---|---|
| Growth, Custom | Owners and admins anywhere; a member needs editor on the destination — the folder, or the root when folder is omitted. |
| Free, Starter | Owners and admins only. Grants are not enforced on these plans, so the rule is the role the key inherits. |
curl --request POST \
--url "https://api.nekt.ai/api/v1/semantic-layer/documents/" \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"name": "MRR definition",
"content": "MRR counts active subscriptions in @table::silver.subscriptions, excluding trials.",
"folder": "b8c5e1e3-6d02-4f45-ad20-8f4b6e2d0e13"
}'
content for you and returned in the read-only mentions field; the
document is indexed for semantic search right after it is written.
Folders are read-only to an API key, so
folder has to name one that already exists — create
folders in the app. Deleting a document is not available to a key either and returns 403.Related
- Update a document.
- List Semantic Layer Documents — to find folder and document ids.
- Assign Semantic Layer Permissions — to give the key’s creator editor access somewhere.
Authorizations
API Key authentication. Format: 'x-api-key: api_key'
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Response
201 - application/json
Maximum string length:
255Manual position among its siblings; NULL falls back to created_at ordering.
Created by (Expandable)
Folder to place the document in. Omit or send null to put it at the root.
Was this page helpful?