Update a permission group
curl --request PATCH \
--url https://api.nekt.ai/api/v1/organization/permission-groups/{id}/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"users": [
123
]
}
'import requests
url = "https://api.nekt.ai/api/v1/organization/permission-groups/{id}/"
payload = {
"name": "<string>",
"description": "<string>",
"users": [123]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>', users: [123]})
};
fetch('https://api.nekt.ai/api/v1/organization/permission-groups/{id}/', 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/organization/permission-groups/{id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'users' => [
123
]
]),
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/organization/permission-groups/{id}/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"users\": [\n 123\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.nekt.ai/api/v1/organization/permission-groups/{id}/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"users\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/organization/permission-groups/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"users\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"all_group": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"users": [
123
],
"description": "<string>"
}Permission groups
Update a Permission Group
Rename a group, or replace its membership wholesale.
PATCH
/
api
/
v1
/
organization
/
permission-groups
/
{id}
/
Update a permission group
curl --request PATCH \
--url https://api.nekt.ai/api/v1/organization/permission-groups/{id}/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"users": [
123
]
}
'import requests
url = "https://api.nekt.ai/api/v1/organization/permission-groups/{id}/"
payload = {
"name": "<string>",
"description": "<string>",
"users": [123]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>', users: [123]})
};
fetch('https://api.nekt.ai/api/v1/organization/permission-groups/{id}/', 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/organization/permission-groups/{id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'users' => [
123
]
]),
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/organization/permission-groups/{id}/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"users\": [\n 123\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.nekt.ai/api/v1/organization/permission-groups/{id}/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"users\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/organization/permission-groups/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"users\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"all_group": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"users": [
123
],
"description": "<string>"
}Changes a group’s name, description, or membership. Send only the fields you are changing.
Renaming changes nothing about access. Grants point at the group’s id.
Anybody dropped from the list loses the group’s grants immediately, and anybody added gains them — no permission call either way.
Request body
| Parameter | Type | Description |
|---|---|---|
name | string | The group’s name. |
description | string | What the group is for. |
users | array of integers | Replaces the entire membership. |
users is a replacement, not an addition. Sending {"users": [7]} to a group of twelve leaves one person in it, and the other eleven lose every grant that reached them through the group. To add or remove a few people without touching the rest, use Add Members and Remove Members.Rename a group
curl --request PATCH \
--url https://api.nekt.ai/api/v1/organization/permission-groups/GROUP_ID/ \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{"name": "Data Analysts"}'
Replace a membership
Useful when your own system is the source of truth for a team and you are syncing it across, rather than tracking individual joins and leaves.import os
import requests
BASE_URL = "https://api.nekt.ai"
headers = {"x-api-key": os.environ["NEKT_API_KEY"], "Content-Type": "application/json"}
# Whoever is on the team right now, per your HR system.
current_team = [12, 42, 57]
response = requests.patch(
f"{BASE_URL}/api/v1/organization/permission-groups/GROUP_ID/",
headers=headers,
json={"users": current_team},
)
response.raise_for_status()
Response
200, with the updated permission group object.
Errors
| Status | When |
|---|---|
400 | A user id in users belongs to a deactivated member. |
400 | You are renaming the All group, or setting its users. Its membership is automatic. |
403 | Your API key was created by a Member. |
404 | No group with that id in your workspace. |
PUT is also available and replaces every writable field at once. PATCH is what you usually want.Related
- Add Members — adjusting membership instead of replacing it.
- The All group — what cannot be changed.
Authorizations
API Key authentication. Format: 'x-api-key: api_key'
Path Parameters
The permission group's id.
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Was this page helpful?