Expand Relationships
curl --request POST \
--url https://sync.useparagon.com/api/permissions/{syncId}/expand \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"object": "<string>",
"relation": "<string>"
}
'import requests
url = "https://sync.useparagon.com/api/permissions/{syncId}/expand"
payload = {
"object": "<string>",
"relation": "<string>"
}
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({object: '<string>', relation: '<string>'})
};
fetch('https://sync.useparagon.com/api/permissions/{syncId}/expand', 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://sync.useparagon.com/api/permissions/{syncId}/expand",
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([
'object' => '<string>',
'relation' => '<string>'
]),
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://sync.useparagon.com/api/permissions/{syncId}/expand"
payload := strings.NewReader("{\n \"object\": \"<string>\",\n \"relation\": \"<string>\"\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://sync.useparagon.com/api/permissions/{syncId}/expand")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"object\": \"<string>\",\n \"relation\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sync.useparagon.com/api/permissions/{syncId}/expand")
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 \"object\": \"<string>\",\n \"relation\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tree": {
"root": {
"name": "<string>",
"leaf": {
"users": {
"users": [
"<string>"
]
},
"computed": {
"userset": "<string>"
},
"tupleToUserset": {
"tupleset": "<string>",
"computed": [
{
"userset": "<string>"
}
]
}
},
"difference": {
"base": "<unknown>",
"subtract": "<unknown>"
},
"union": {
"nodes": "<array>"
},
"intersection": {
"nodes": "<array>"
}
}
}
}Permissions API
Expand Relationships
Get all users and group relationships associated with an object by role
POST
/
api
/
permissions
/
{syncId}
/
expand
Expand Relationships
curl --request POST \
--url https://sync.useparagon.com/api/permissions/{syncId}/expand \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"object": "<string>",
"relation": "<string>"
}
'import requests
url = "https://sync.useparagon.com/api/permissions/{syncId}/expand"
payload = {
"object": "<string>",
"relation": "<string>"
}
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({object: '<string>', relation: '<string>'})
};
fetch('https://sync.useparagon.com/api/permissions/{syncId}/expand', 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://sync.useparagon.com/api/permissions/{syncId}/expand",
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([
'object' => '<string>',
'relation' => '<string>'
]),
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://sync.useparagon.com/api/permissions/{syncId}/expand"
payload := strings.NewReader("{\n \"object\": \"<string>\",\n \"relation\": \"<string>\"\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://sync.useparagon.com/api/permissions/{syncId}/expand")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"object\": \"<string>\",\n \"relation\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sync.useparagon.com/api/permissions/{syncId}/expand")
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 \"object\": \"<string>\",\n \"relation\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tree": {
"root": {
"name": "<string>",
"leaf": {
"users": {
"users": [
"<string>"
]
},
"computed": {
"userset": "<string>"
},
"tupleToUserset": {
"tupleset": "<string>",
"computed": [
{
"userset": "<string>"
}
]
}
},
"difference": {
"base": "<unknown>",
"subtract": "<unknown>"
},
"union": {
"nodes": "<array>"
},
"intersection": {
"nodes": "<array>"
}
}
}
}The Expand endpoint can be used to query relationships in the permissions graph, returning all users and sets of users that have a certain relationship type to a given object. This provides visibility into why certain users have access to a file (via direct access, inherited role, group membership, or parent access).
Here’s a breakdown of using this endpoint to list all users (and groups) that have a
This provides a response like:
This tells us that the users / groups that can read this file can be found in relations:
can_read relationship to a file.
First, we can call the /expand endpoint to query can_read relationships to a file ID:
POST /api/permissions/{syncId}/expand
{
"object": "1f2c08ea-c785-54e2-a9b2-c362364e1d23",
"relation": "can_read"
}
Response
{
"tree": {
"root": {
"name": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#can_read",
"union": {
"nodes": [
{
"name": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#can_read",
"leaf": {
"computed": {
"userset": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#viewer"
}
}
},
{
"name": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#can_read",
"leaf": {
"computed": {
"userset": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#editor"
}
}
},
{
"name": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#can_read",
"leaf": {
"tupleToUserset": {
"tupleset": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#parent",
"computed": [
{
"userset": "file:db847d33-9272-5f4e-87a9-0b7fde41638f#viewer"
}
]
}
}
},
{
"name": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#can_read",
"leaf": {
"tupleToUserset": {
"tupleset": "file:de087147-d851-5f18-ba1f-79e84ff09b0c#space",
"computed": [
{
"userset": "space:42d2e50f-2e93-5f14-98c3-911c9a3fdb39#viewer"
}
]
}
}
}
]
}
}
}
}
- Users with the
viewerrole explicitly assigned to this file - Users with the
editorrole explicitly assigned to this file - Users with the
viewerrole to the parent of this file (file:db847d33-9272-5f4e-87a9-0b7fde41638f) - Users with the
viewerrole to the space to which this file belongs (space:42d2e50f-2e93-5f14-98c3-911c9a3fdb39)
POST /api/permissions/{syncId}/expand
{
"object": "1f2c08ea-c785-54e2-a9b2-c362364e1d23",
"relation": "editor"
}
Authorizations
Paragon User Token. Add to the Authorization header of your requests.
Path Parameters
UUID of the Sync to query, returned from the Enable Sync endpoint.
Body
application/json
Response
200 - application/json
Expanded relationships tree showing all users and groups related to the object
Show child attributes
Show child attributes
Was this page helpful?