curl --request POST \
--url https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"schema_version": "<string>",
"snap_token": "<string>",
"depth": 123
},
"items": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"permission": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"context": {
"tuples": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"relation": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"attributes": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"attribute": "<string>",
"value": {
"@type": "<string>"
}
}
],
"data": {}
},
"arguments": [
{
"computedAttribute": {
"name": "<string>"
}
}
]
}
'import requests
url = "https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check"
payload = {
"metadata": {
"schema_version": "<string>",
"snap_token": "<string>",
"depth": 123
},
"items": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"permission": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"context": {
"tuples": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"relation": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"attributes": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"attribute": "<string>",
"value": { "@type": "<string>" }
}
],
"data": {}
},
"arguments": [{ "computedAttribute": { "name": "<string>" } }]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {schema_version: '<string>', snap_token: '<string>', depth: 123},
items: [
{
entity: {type: '<string>', id: '<string>'},
permission: '<string>',
subject: {type: '<string>', id: '<string>', relation: '<string>'}
}
],
context: {
tuples: [
{
entity: {type: '<string>', id: '<string>'},
relation: '<string>',
subject: {type: '<string>', id: '<string>', relation: '<string>'}
}
],
attributes: [
{
entity: {type: '<string>', id: '<string>'},
attribute: '<string>',
value: {'@type': '<string>'}
}
],
data: {}
},
arguments: [{computedAttribute: {name: '<string>'}}]
})
};
fetch('https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check', 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.example.com/v1/tenants/{tenant_id}/permissions/bulk-check",
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([
'metadata' => [
'schema_version' => '<string>',
'snap_token' => '<string>',
'depth' => 123
],
'items' => [
[
'entity' => [
'type' => '<string>',
'id' => '<string>'
],
'permission' => '<string>',
'subject' => [
'type' => '<string>',
'id' => '<string>',
'relation' => '<string>'
]
]
],
'context' => [
'tuples' => [
[
'entity' => [
'type' => '<string>',
'id' => '<string>'
],
'relation' => '<string>',
'subject' => [
'type' => '<string>',
'id' => '<string>',
'relation' => '<string>'
]
]
],
'attributes' => [
[
'entity' => [
'type' => '<string>',
'id' => '<string>'
],
'attribute' => '<string>',
'value' => [
'@type' => '<string>'
]
]
],
'data' => [
]
],
'arguments' => [
[
'computedAttribute' => [
'name' => '<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check"
payload := strings.NewReader("{\n \"metadata\": {\n \"schema_version\": \"<string>\",\n \"snap_token\": \"<string>\",\n \"depth\": 123\n },\n \"items\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"permission\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"context\": {\n \"tuples\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"relation\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"attributes\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"attribute\": \"<string>\",\n \"value\": {\n \"@type\": \"<string>\"\n }\n }\n ],\n \"data\": {}\n },\n \"arguments\": [\n {\n \"computedAttribute\": {\n \"name\": \"<string>\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/tenants/{tenant_id}/permissions/bulk-check")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"schema_version\": \"<string>\",\n \"snap_token\": \"<string>\",\n \"depth\": 123\n },\n \"items\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"permission\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"context\": {\n \"tuples\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"relation\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"attributes\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"attribute\": \"<string>\",\n \"value\": {\n \"@type\": \"<string>\"\n }\n }\n ],\n \"data\": {}\n },\n \"arguments\": [\n {\n \"computedAttribute\": {\n \"name\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"schema_version\": \"<string>\",\n \"snap_token\": \"<string>\",\n \"depth\": 123\n },\n \"items\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"permission\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"context\": {\n \"tuples\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"relation\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"attributes\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"attribute\": \"<string>\",\n \"value\": {\n \"@type\": \"<string>\"\n }\n }\n ],\n \"data\": {}\n },\n \"arguments\": [\n {\n \"computedAttribute\": {\n \"name\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"can": "CHECK_RESULT_UNSPECIFIED",
"metadata": {
"check_count": 123
}
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Bulk Check
Check multiple permissions in a single request. Maximum 100 requests allowed.
curl --request POST \
--url https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"schema_version": "<string>",
"snap_token": "<string>",
"depth": 123
},
"items": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"permission": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"context": {
"tuples": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"relation": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"attributes": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"attribute": "<string>",
"value": {
"@type": "<string>"
}
}
],
"data": {}
},
"arguments": [
{
"computedAttribute": {
"name": "<string>"
}
}
]
}
'import requests
url = "https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check"
payload = {
"metadata": {
"schema_version": "<string>",
"snap_token": "<string>",
"depth": 123
},
"items": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"permission": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"context": {
"tuples": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"relation": "<string>",
"subject": {
"type": "<string>",
"id": "<string>",
"relation": "<string>"
}
}
],
"attributes": [
{
"entity": {
"type": "<string>",
"id": "<string>"
},
"attribute": "<string>",
"value": { "@type": "<string>" }
}
],
"data": {}
},
"arguments": [{ "computedAttribute": { "name": "<string>" } }]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {schema_version: '<string>', snap_token: '<string>', depth: 123},
items: [
{
entity: {type: '<string>', id: '<string>'},
permission: '<string>',
subject: {type: '<string>', id: '<string>', relation: '<string>'}
}
],
context: {
tuples: [
{
entity: {type: '<string>', id: '<string>'},
relation: '<string>',
subject: {type: '<string>', id: '<string>', relation: '<string>'}
}
],
attributes: [
{
entity: {type: '<string>', id: '<string>'},
attribute: '<string>',
value: {'@type': '<string>'}
}
],
data: {}
},
arguments: [{computedAttribute: {name: '<string>'}}]
})
};
fetch('https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check', 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.example.com/v1/tenants/{tenant_id}/permissions/bulk-check",
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([
'metadata' => [
'schema_version' => '<string>',
'snap_token' => '<string>',
'depth' => 123
],
'items' => [
[
'entity' => [
'type' => '<string>',
'id' => '<string>'
],
'permission' => '<string>',
'subject' => [
'type' => '<string>',
'id' => '<string>',
'relation' => '<string>'
]
]
],
'context' => [
'tuples' => [
[
'entity' => [
'type' => '<string>',
'id' => '<string>'
],
'relation' => '<string>',
'subject' => [
'type' => '<string>',
'id' => '<string>',
'relation' => '<string>'
]
]
],
'attributes' => [
[
'entity' => [
'type' => '<string>',
'id' => '<string>'
],
'attribute' => '<string>',
'value' => [
'@type' => '<string>'
]
]
],
'data' => [
]
],
'arguments' => [
[
'computedAttribute' => [
'name' => '<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check"
payload := strings.NewReader("{\n \"metadata\": {\n \"schema_version\": \"<string>\",\n \"snap_token\": \"<string>\",\n \"depth\": 123\n },\n \"items\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"permission\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"context\": {\n \"tuples\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"relation\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"attributes\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"attribute\": \"<string>\",\n \"value\": {\n \"@type\": \"<string>\"\n }\n }\n ],\n \"data\": {}\n },\n \"arguments\": [\n {\n \"computedAttribute\": {\n \"name\": \"<string>\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/tenants/{tenant_id}/permissions/bulk-check")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"schema_version\": \"<string>\",\n \"snap_token\": \"<string>\",\n \"depth\": 123\n },\n \"items\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"permission\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"context\": {\n \"tuples\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"relation\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"attributes\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"attribute\": \"<string>\",\n \"value\": {\n \"@type\": \"<string>\"\n }\n }\n ],\n \"data\": {}\n },\n \"arguments\": [\n {\n \"computedAttribute\": {\n \"name\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/tenants/{tenant_id}/permissions/bulk-check")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"schema_version\": \"<string>\",\n \"snap_token\": \"<string>\",\n \"depth\": 123\n },\n \"items\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"permission\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"context\": {\n \"tuples\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"relation\": \"<string>\",\n \"subject\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\",\n \"relation\": \"<string>\"\n }\n }\n ],\n \"attributes\": [\n {\n \"entity\": {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n },\n \"attribute\": \"<string>\",\n \"value\": {\n \"@type\": \"<string>\"\n }\n }\n ],\n \"data\": {}\n },\n \"arguments\": [\n {\n \"computedAttribute\": {\n \"name\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"can": "CHECK_RESULT_UNSPECIFIED",
"metadata": {
"check_count": 123
}
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}- Check up to 100 permissions in a single API call
- Reduce network round trips by batching multiple checks
- All checks are evaluated against the same snapshot of your authorization data
Path Parameters
Identifier of the tenant, if you are not using multi-tenancy (have only one tenant) use pre-inserted tenant t1 for this field. Required, and must match the pattern \“[a-zA-Z0-9-,]+\“, max 64 bytes.
Body
PermissionBulkCheckRequest is the request message for the BulkCheck method in the Permission service.
PermissionCheckRequestMetadata metadata for the PermissionCheckRequest.
Show child attributes
Show child attributes
List of permission check requests, maximum 100 items.
Show child attributes
Show child attributes
Context encapsulates the information related to a single operation, including the tuples involved and the associated attributes.
Show child attributes
Show child attributes
Additional arguments associated with this request.
Show child attributes
Show child attributes
Response
A successful response.
PermissionBulkCheckResponse is the response message for the BulkCheck method in the Permission service.
List of permission check responses corresponding to each request.
Show child attributes
Show child attributes