curl --request POST \
--url https://{region}.api.plerion.com/v1/organization/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Finding triage",
"description": "Triage findings on the production accounts",
"scope": "tenant",
"tenantId": "9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a",
"permissions": [
{
"actions": [
"Finding:Read",
"Finding:Triage"
],
"resources": [
"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
]
}
]
}
'import requests
url = "https://{region}.api.plerion.com/v1/organization/roles"
payload = {
"name": "Finding triage",
"description": "Triage findings on the production accounts",
"scope": "tenant",
"tenantId": "9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a",
"permissions": [
{
"actions": ["Finding:Read", "Finding:Triage"],
"resources": ["e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"]
}
]
}
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: 'Finding triage',
description: 'Triage findings on the production accounts',
scope: 'tenant',
tenantId: '9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a',
permissions: [
{
actions: ['Finding:Read', 'Finding:Triage'],
resources: ['e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b']
}
]
})
};
fetch('https://{region}.api.plerion.com/v1/organization/roles', 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://{region}.api.plerion.com/v1/organization/roles",
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' => 'Finding triage',
'description' => 'Triage findings on the production accounts',
'scope' => 'tenant',
'tenantId' => '9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a',
'permissions' => [
[
'actions' => [
'Finding:Read',
'Finding:Triage'
],
'resources' => [
'e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b'
]
]
]
]),
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://{region}.api.plerion.com/v1/organization/roles"
payload := strings.NewReader("{\n \"name\": \"Finding triage\",\n \"description\": \"Triage findings on the production accounts\",\n \"scope\": \"tenant\",\n \"tenantId\": \"9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a\",\n \"permissions\": [\n {\n \"actions\": [\n \"Finding:Read\",\n \"Finding:Triage\"\n ],\n \"resources\": [\n \"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b\"\n ]\n }\n ]\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://{region}.api.plerion.com/v1/organization/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Finding triage\",\n \"description\": \"Triage findings on the production accounts\",\n \"scope\": \"tenant\",\n \"tenantId\": \"9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a\",\n \"permissions\": [\n {\n \"actions\": [\n \"Finding:Read\",\n \"Finding:Triage\"\n ],\n \"resources\": [\n \"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/organization/roles")
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\": \"Finding triage\",\n \"description\": \"Triage findings on the production accounts\",\n \"scope\": \"tenant\",\n \"tenantId\": \"9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a\",\n \"permissions\": [\n {\n \"actions\": [\n \"Finding:Read\",\n \"Finding:Triage\"\n ],\n \"resources\": [\n \"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"scope": "organization",
"permissions": [
{
"actions": [
"<string>"
],
"resources": "*"
}
],
"builtIn": true,
"description": "<string>",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>"
}
}{
"errors": [
{
"code": "InvalidRolePermissions",
"message": "org-level action 'Organization:Read' cannot be used in a tenant-scoped role"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}{
"errors": [
{
"code": "RoleNotFound",
"message": "role not found"
}
]
}Create a custom role
Creates a custom role. tenantId is required for a tenant-scoped role and not accepted for an organization-scoped one; a tenant that is not in your organization answers 404 TenantNotFound. Each permission names either actions or an actionGroup from the permission catalog. An action whose resourceType is integration needs resources: * for every integration, or a list of integration ids. In an organization-scoped role only * is allowed. An action whose resourceType is null takes no resources, and an organization-level action cannot be used in a tenant-scoped role. Requires the readWrite access level.
curl --request POST \
--url https://{region}.api.plerion.com/v1/organization/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Finding triage",
"description": "Triage findings on the production accounts",
"scope": "tenant",
"tenantId": "9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a",
"permissions": [
{
"actions": [
"Finding:Read",
"Finding:Triage"
],
"resources": [
"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
]
}
]
}
'import requests
url = "https://{region}.api.plerion.com/v1/organization/roles"
payload = {
"name": "Finding triage",
"description": "Triage findings on the production accounts",
"scope": "tenant",
"tenantId": "9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a",
"permissions": [
{
"actions": ["Finding:Read", "Finding:Triage"],
"resources": ["e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"]
}
]
}
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: 'Finding triage',
description: 'Triage findings on the production accounts',
scope: 'tenant',
tenantId: '9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a',
permissions: [
{
actions: ['Finding:Read', 'Finding:Triage'],
resources: ['e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b']
}
]
})
};
fetch('https://{region}.api.plerion.com/v1/organization/roles', 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://{region}.api.plerion.com/v1/organization/roles",
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' => 'Finding triage',
'description' => 'Triage findings on the production accounts',
'scope' => 'tenant',
'tenantId' => '9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a',
'permissions' => [
[
'actions' => [
'Finding:Read',
'Finding:Triage'
],
'resources' => [
'e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b'
]
]
]
]),
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://{region}.api.plerion.com/v1/organization/roles"
payload := strings.NewReader("{\n \"name\": \"Finding triage\",\n \"description\": \"Triage findings on the production accounts\",\n \"scope\": \"tenant\",\n \"tenantId\": \"9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a\",\n \"permissions\": [\n {\n \"actions\": [\n \"Finding:Read\",\n \"Finding:Triage\"\n ],\n \"resources\": [\n \"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b\"\n ]\n }\n ]\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://{region}.api.plerion.com/v1/organization/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Finding triage\",\n \"description\": \"Triage findings on the production accounts\",\n \"scope\": \"tenant\",\n \"tenantId\": \"9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a\",\n \"permissions\": [\n {\n \"actions\": [\n \"Finding:Read\",\n \"Finding:Triage\"\n ],\n \"resources\": [\n \"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/organization/roles")
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\": \"Finding triage\",\n \"description\": \"Triage findings on the production accounts\",\n \"scope\": \"tenant\",\n \"tenantId\": \"9d0e1f2a-3b4c-4d5e-8f7a-8b9c0d1e2f3a\",\n \"permissions\": [\n {\n \"actions\": [\n \"Finding:Read\",\n \"Finding:Triage\"\n ],\n \"resources\": [\n \"e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"scope": "organization",
"permissions": [
{
"actions": [
"<string>"
],
"resources": "*"
}
],
"builtIn": true,
"description": "<string>",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>"
}
}{
"errors": [
{
"code": "InvalidRolePermissions",
"message": "org-level action 'Organization:Read' cannot be used in a tenant-scoped role"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}{
"errors": [
{
"code": "RoleNotFound",
"message": "role not found"
}
]
}Authorizations
Plerion organization API key (plerion_oak_…), created by an organization admin in the Plerion app. GET operations work with a key of either access level; POST, PUT and DELETE require the readWrite access level.
Body
1 - 120organization, tenant 1One permission: either actions or an actionGroup, optionally narrowed with resources. resources is * for every integration or a list of integration ids, and is required for actions whose resourceType is integration and not accepted otherwise.
- Option 1
- Option 2
Show child attributes
Show child attributes
500Required for scope: tenant, not accepted for scope: organization.
Response
The created role.
Show child attributes
Show child attributes
Was this page helpful?