Replace object access grants
curl --request PUT \
--url https://api.example.com/access/{resourceKind}/{resourceId}/grants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grants": [
{
"principalType": "USER",
"userId": "<string>"
}
]
}
'import requests
url = "https://api.example.com/access/{resourceKind}/{resourceId}/grants"
payload = { "grants": [
{
"principalType": "USER",
"userId": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({grants: [{principalType: 'USER', userId: '<string>'}]})
};
fetch('https://api.example.com/access/{resourceKind}/{resourceId}/grants', 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/access/{resourceKind}/{resourceId}/grants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'grants' => [
[
'principalType' => 'USER',
'userId' => '<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://api.example.com/access/{resourceKind}/{resourceId}/grants"
payload := strings.NewReader("{\n \"grants\": [\n {\n \"principalType\": \"USER\",\n \"userId\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/access/{resourceKind}/{resourceId}/grants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"grants\": [\n {\n \"principalType\": \"USER\",\n \"userId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/access/{resourceKind}/{resourceId}/grants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grants\": [\n {\n \"principalType\": \"USER\",\n \"userId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"grants": [
{
"id": "<string>",
"principalType": "USER",
"role": "READER",
"userId": "<string>",
"name": "<string>",
"email": "<string>",
"avatar": "<string>"
}
],
"callerRole": "READER",
"capabilities": {
"canView": true,
"canEdit": true,
"canManage": true
},
"availableRoles": [
"READER"
]
}{
"error": "<string>",
"reason": "<string>",
"details": "<unknown>",
"summary": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"reason": "<string>",
"details": "<unknown>",
"summary": "<string>"
}{
"error": "<string>"
}Access
Replace object access grants
PUT
/
access
/
{resourceKind}
/
{resourceId}
/
grants
Replace object access grants
curl --request PUT \
--url https://api.example.com/access/{resourceKind}/{resourceId}/grants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"grants": [
{
"principalType": "USER",
"userId": "<string>"
}
]
}
'import requests
url = "https://api.example.com/access/{resourceKind}/{resourceId}/grants"
payload = { "grants": [
{
"principalType": "USER",
"userId": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({grants: [{principalType: 'USER', userId: '<string>'}]})
};
fetch('https://api.example.com/access/{resourceKind}/{resourceId}/grants', 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/access/{resourceKind}/{resourceId}/grants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'grants' => [
[
'principalType' => 'USER',
'userId' => '<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://api.example.com/access/{resourceKind}/{resourceId}/grants"
payload := strings.NewReader("{\n \"grants\": [\n {\n \"principalType\": \"USER\",\n \"userId\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/access/{resourceKind}/{resourceId}/grants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"grants\": [\n {\n \"principalType\": \"USER\",\n \"userId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/access/{resourceKind}/{resourceId}/grants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grants\": [\n {\n \"principalType\": \"USER\",\n \"userId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"grants": [
{
"id": "<string>",
"principalType": "USER",
"role": "READER",
"userId": "<string>",
"name": "<string>",
"email": "<string>",
"avatar": "<string>"
}
],
"callerRole": "READER",
"capabilities": {
"canView": true,
"canEdit": true,
"canManage": true
},
"availableRoles": [
"READER"
]
}{
"error": "<string>",
"reason": "<string>",
"details": "<unknown>",
"summary": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"reason": "<string>",
"details": "<unknown>",
"summary": "<string>"
}{
"error": "<string>"
}Authorizations
Send Authorization: Bearer <credential> using either a Clerk session JWT or a Clerk API key (ak_*). API keys may identify a user (user_*) or organization (org_*) principal and are generated in the Clerk Dashboard under API keys.
Path Parameters
Available options:
dashboard, report, budget, costAlert Minimum string length:
1Body
application/json
Full replacement of direct grants. Omitted principals lose access. Every object must retain a USER, TEAM, or CLERK_ADMIN Admin grant. Each principal may appear once.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Response
Grants after the replacement
Last modified on October 12, 2026
Was this page helpful?
