cURL
curl --request POST \
--url https://api.nekt.ai/api/v1/semantic-layer/permissions/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"assignments": [
{
"users": [],
"groups": [],
"catalogs": [],
"folders": [],
"documents": []
}
],
"notify_members": false,
"message": "<string>"
}
'import requests
url = "https://api.nekt.ai/api/v1/semantic-layer/permissions/"
payload = {
"assignments": [
{
"users": [],
"groups": [],
"catalogs": [],
"folders": [],
"documents": []
}
],
"notify_members": False,
"message": "<string>"
}
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({
assignments: [{users: [], groups: [], catalogs: [], folders: [], documents: []}],
notify_members: false,
message: '<string>'
})
};
fetch('https://api.nekt.ai/api/v1/semantic-layer/permissions/', 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/permissions/",
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([
'assignments' => [
[
'users' => [
],
'groups' => [
],
'catalogs' => [
],
'folders' => [
],
'documents' => [
]
]
],
'notify_members' => false,
'message' => '<string>'
]),
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/permissions/"
payload := strings.NewReader("{\n \"assignments\": [\n {\n \"users\": [],\n \"groups\": [],\n \"catalogs\": [],\n \"folders\": [],\n \"documents\": []\n }\n ],\n \"notify_members\": false,\n \"message\": \"<string>\"\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/permissions/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"assignments\": [\n {\n \"users\": [],\n \"groups\": [],\n \"catalogs\": [],\n \"folders\": [],\n \"documents\": []\n }\n ],\n \"notify_members\": false,\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/semantic-layer/permissions/")
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 \"assignments\": [\n {\n \"users\": [],\n \"groups\": [],\n \"catalogs\": [],\n \"folders\": [],\n \"documents\": []\n }\n ],\n \"notify_members\": false,\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": "<string>",
"group": "<string>",
"permission_level": "manager",
"catalog": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"folder": "<string>",
"document": "<string>",
"granted_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"updated": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": "<string>",
"group": "<string>",
"permission_level": "manager",
"catalog": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"folder": "<string>",
"document": "<string>",
"granted_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"revoked": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": "<string>",
"group": "<string>",
"permission_level": "manager",
"catalog": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"folder": "<string>",
"document": "<string>",
"granted_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}Semantic Layer
Assign Semantic Layer Permissions
Grant, change, and revoke access to Semantic Layer catalogs, folders, and documents.
POST
/
api
/
v1
/
semantic-layer
/
permissions
/
cURL
curl --request POST \
--url https://api.nekt.ai/api/v1/semantic-layer/permissions/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"assignments": [
{
"users": [],
"groups": [],
"catalogs": [],
"folders": [],
"documents": []
}
],
"notify_members": false,
"message": "<string>"
}
'import requests
url = "https://api.nekt.ai/api/v1/semantic-layer/permissions/"
payload = {
"assignments": [
{
"users": [],
"groups": [],
"catalogs": [],
"folders": [],
"documents": []
}
],
"notify_members": False,
"message": "<string>"
}
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({
assignments: [{users: [], groups: [], catalogs: [], folders: [], documents: []}],
notify_members: false,
message: '<string>'
})
};
fetch('https://api.nekt.ai/api/v1/semantic-layer/permissions/', 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/permissions/",
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([
'assignments' => [
[
'users' => [
],
'groups' => [
],
'catalogs' => [
],
'folders' => [
],
'documents' => [
]
]
],
'notify_members' => false,
'message' => '<string>'
]),
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/permissions/"
payload := strings.NewReader("{\n \"assignments\": [\n {\n \"users\": [],\n \"groups\": [],\n \"catalogs\": [],\n \"folders\": [],\n \"documents\": []\n }\n ],\n \"notify_members\": false,\n \"message\": \"<string>\"\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/permissions/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"assignments\": [\n {\n \"users\": [],\n \"groups\": [],\n \"catalogs\": [],\n \"folders\": [],\n \"documents\": []\n }\n ],\n \"notify_members\": false,\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/semantic-layer/permissions/")
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 \"assignments\": [\n {\n \"users\": [],\n \"groups\": [],\n \"catalogs\": [],\n \"folders\": [],\n \"documents\": []\n }\n ],\n \"notify_members\": false,\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": "<string>",
"group": "<string>",
"permission_level": "manager",
"catalog": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"folder": "<string>",
"document": "<string>",
"granted_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"updated": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": "<string>",
"group": "<string>",
"permission_level": "manager",
"catalog": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"folder": "<string>",
"document": "<string>",
"granted_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"revoked": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": "<string>",
"group": "<string>",
"permission_level": "manager",
"catalog": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"folder": "<string>",
"document": "<string>",
"granted_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}The same declarative bulk upsert as the other two axes, applied to the Semantic Layer. Each assignment is a cross product of recipients and resources, and
Each object in
permission_level: null revokes.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
assignments | array of objects | Yes | One or more assignment blocks. Must not be empty. |
notify_members | boolean | No | Email the recipients. This axis actually sends. |
message | string | No | A note included in the notification email. |
assignments:
| Parameter | Type | Required | Description |
|---|---|---|---|
permission_level | viewer, editor, manager, or null | Yes | The level to apply. null revokes. |
users | array of UUIDs | No | Recipient users. |
groups | array of UUIDs | No | Recipient permission groups. |
catalogs | array of UUIDs | No | Target the Semantic Layer root. |
folders | array of UUIDs | No | Target folders. |
documents | array of UUIDs | No | Target documents. |
Unlike Assign Permissions on the Catalog axis,
notify_members on this endpoint does send email. If you are provisioning in bulk and do not want to flood inboxes, leave it at its default of false.The three resource levels
catalogs, folders, and documents are the same hierarchy the Semantic Layer shows in the app, from coarsest to finest. A grant on the catalog root reaches everything; a grant on a folder reaches the documents inside it. Prefer the coarsest resource that expresses the intent — it survives documents being added later.
Resource ids come from Read the Semantic Layer.
Grant a group access to one folder
curl --request POST \
--url https://api.nekt.ai/api/v1/semantic-layer/permissions/ \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"assignments": [
{
"permission_level": "viewer",
"groups": ["b8c5e1e3-6d02-4f45-ad20-8f4b6e2d0e13"],
"folders": ["a1b2c3d4-e5f6-4718-9a0b-1c2d3e4f5061"]
}
]
}'
Open the whole Semantic Layer to a group
curl --request POST \
--url https://api.nekt.ai/api/v1/semantic-layer/permissions/ \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"assignments": [
{
"permission_level": "viewer",
"groups": ["b8c5e1e3-6d02-4f45-ad20-8f4b6e2d0e13"],
"catalogs": ["7d8e9f0a-1b2c-43d4-85e6-f708192a3b4c"]
}
]
}'
Response
{ "created": [ … ], "updated": [], "revoked": [] }
Errors
| Status | When |
|---|---|
400 | Two assignments conflict on the same recipient and resource, a recipient’s membership is deactivated, or a referenced id is not visible to your API key. |
403 | The key’s ceiling does not allow the grant. See Permissions flow. |
Related
- Permissions flow — the ceiling rules and the upsert semantics in full.
- List Recipients — where recipient ids come from.
- Read the Semantic Layer — where resource ids come from.
Authorizations
API Key authentication. Format: 'x-api-key: api_key'
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
One request handles a whole share modal.
Every recipient x every resource inside an assignment gets that level, and
permission_level: null revokes. The frontend sends the diff as ONE call.
Response
201 - application/json
One request handles a whole share modal.
Every recipient x every resource inside an assignment gets that level, and
permission_level: null revokes. The frontend sends the diff as ONE call.
Was this page helpful?