curl --request POST \
--url https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": "12345678901"
}
'import requests
url = "https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members"
payload = { "subject": "12345678901" }
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({subject: '12345678901'})
};
fetch('https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members', 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://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members",
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([
'subject' => '12345678901'
]),
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://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members"
payload := strings.NewReader("{\n \"subject\": \"12345678901\"\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://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": \"12345678901\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members")
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 \"subject\": \"12345678901\"\n}"
response = http.request(request)
puts response.read_body{
"status": "member_added",
"group": "engineering_team:backend",
"subject": "12345678901"
}{
"detail": "User is already a member of this group"
}{
"detail": "Could not validate credentials"
}{
"detail": "Permission denied to add member to group 'engineering_team:backend'"
}{
"detail": "Group 'unknown-group' not found"
}{
"detail": "Validation error",
"errors": [
{
"loc": [
"body",
"subject"
],
"msg": "string does not match regex",
"type": "value_error.regex"
}
]
}{
"detail": "Failed to add member: Database connection error"
}Add member to group
Add a user to a group with automatic user creation and authorization checks.
Authorization: Users can add members to groups they have permission to manage. Permissions are checked via Cerbos policies.
Auto-Creation: If the user being added doesn’t exist in the system, they will be automatically created with their CPF as the identifier.
Member Identification: Users are identified by their CPF (Brazilian tax ID), which serves as the unique subject identifier.
Use Cases:
- Add team members to project groups
- Grant users access to specific resources
- Administrative user management
- Bulk user provisioning workflows
Role Inheritance: Users automatically inherit all roles assigned to groups they’re members of.
curl --request POST \
--url https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": "12345678901"
}
'import requests
url = "https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members"
payload = { "subject": "12345678901" }
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({subject: '12345678901'})
};
fetch('https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members', 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://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members",
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([
'subject' => '12345678901'
]),
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://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members"
payload := strings.NewReader("{\n \"subject\": \"12345678901\"\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://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": \"12345678901\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/heimdall-admin/api/v1/groups/{group_name}/members")
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 \"subject\": \"12345678901\"\n}"
response = http.request(request)
puts response.read_body{
"status": "member_added",
"group": "engineering_team:backend",
"subject": "12345678901"
}{
"detail": "User is already a member of this group"
}{
"detail": "Could not validate credentials"
}{
"detail": "Permission denied to add member to group 'engineering_team:backend'"
}{
"detail": "Group 'unknown-group' not found"
}{
"detail": "Validation error",
"errors": [
{
"loc": [
"body",
"subject"
],
"msg": "string does not match regex",
"type": "value_error.regex"
}
]
}{
"detail": "Failed to add member: Database connection error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Request model for adding a member to a group.
User's CPF (Brazilian tax ID) to add to the group
^[0-9]{11}$"12345678901"
Response
Member added to group successfully
