curl --request POST \
--url https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role_id": "00000000-0000-0000-0000-000000000020"
}
'import requests
url = "https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles"
payload = { "role_id": "00000000-0000-0000-0000-000000000020" }
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({role_id: '00000000-0000-0000-0000-000000000020'})
};
fetch('https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/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://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/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([
'role_id' => '00000000-0000-0000-0000-000000000020'
]),
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://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles"
payload := strings.NewReader("{\n \"role_id\": \"00000000-0000-0000-0000-000000000020\"\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://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role_id\": \"00000000-0000-0000-0000-000000000020\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/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 \"role_id\": \"00000000-0000-0000-0000-000000000020\"\n}"
response = http.request(request)
puts response.read_body{
"id": "r2b3c4d5-e6f7-8901-abcd-ef1234567890",
"user_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"workspace_id": "w1b2c3d4-e5f6-7890-abcd-ef1234567890",
"role_id": "00000000-0000-0000-0000-000000000020",
"role_name": "workspace_admin",
"role_type": "system_role",
"granted_at": "2026-06-01T12:00:00Z",
"granted_by": "00000000-0000-0000-0000-000000000001"
}Assign User Workspace Role
Assign a workspace-scoped role (system, such as workspace_admin, or custom access) to a user. This is how all workspace-scoped system roles are granted; only the account-wide admin role is assigned via POST /users/{id}/roles. The user must be a direct member of the target workspace before this call.
curl --request POST \
--url https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role_id": "00000000-0000-0000-0000-000000000020"
}
'import requests
url = "https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles"
payload = { "role_id": "00000000-0000-0000-0000-000000000020" }
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({role_id: '00000000-0000-0000-0000-000000000020'})
};
fetch('https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/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://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/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([
'role_id' => '00000000-0000-0000-0000-000000000020'
]),
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://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles"
payload := strings.NewReader("{\n \"role_id\": \"00000000-0000-0000-0000-000000000020\"\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://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role_id\": \"00000000-0000-0000-0000-000000000020\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.cdata.com/api/v1/admin/users/{id}/workspaces/{workspace_id}/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 \"role_id\": \"00000000-0000-0000-0000-000000000020\"\n}"
response = http.request(request)
puts response.read_body{
"id": "r2b3c4d5-e6f7-8901-abcd-ef1234567890",
"user_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"workspace_id": "w1b2c3d4-e5f6-7890-abcd-ef1234567890",
"role_id": "00000000-0000-0000-0000-000000000020",
"role_name": "workspace_admin",
"role_type": "system_role",
"granted_at": "2026-06-01T12:00:00Z",
"granted_by": "00000000-0000-0000-0000-000000000001"
}Authorizations
OAuth 2.0 client credentials. Alternatively, you can authenticate with a personal access token (PAT) by sending Authorization: Basic base64(email:PAT).
Scopes
Write access to user resources.
Path Parameters
User identifier (UUID).
Workspace identifier (UUID).
Body
Role to assign. Must exist in the organization.
Response
Created. Returns the new workspace role assignment.
A workspace-scoped role assignment for a user.
Assignment identifier.
The user this workspace role is assigned to.
The workspace this role is assigned to.
The role identifier.
The name of the role.
system_role: built-in, non-modifiable. access_role: custom, fully manageable.
system_role, access_role ISO 8601 UTC.
The user who granted the workspace role.
Was this page helpful?