curl --request PUT \
--url https://api.example.com/api/auth/principals/{user_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"disabled": true,
"display_name": "<string>"
}
'import requests
url = "https://api.example.com/api/auth/principals/{user_id}"
payload = {
"disabled": True,
"display_name": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({disabled: true, display_name: '<string>'})
};
fetch('https://api.example.com/api/auth/principals/{user_id}', 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/api/auth/principals/{user_id}",
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([
'disabled' => true,
'display_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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/api/auth/principals/{user_id}"
payload := strings.NewReader("{\n \"disabled\": true,\n \"display_name\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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/api/auth/principals/{user_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"disabled\": true,\n \"display_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/auth/principals/{user_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"disabled\": true,\n \"display_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"created_at": "2023-11-07T05:31:56Z",
"display_name": "<string>",
"kind": "human",
"user_id": "<string>",
"created_by": "<string>",
"disabled": false
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Update a principal
Update a principal’s display name and/or disabled state (admin only).
Both fields are omit-means-keep. A disabled change is refused (409) when a
login-attaching accounts provider owns the principal’s login — its disabled state lives
at that provider’s users door — and otherwise flips both homes through the single
disabled writer. Disabling the last enabled admin principal is refused (409) behind the
store’s advisory-locked guard. A display-name edit is accepted for any kind. Returns the
updated principal; a missing principal is a 404.
curl --request PUT \
--url https://api.example.com/api/auth/principals/{user_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"disabled": true,
"display_name": "<string>"
}
'import requests
url = "https://api.example.com/api/auth/principals/{user_id}"
payload = {
"disabled": True,
"display_name": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({disabled: true, display_name: '<string>'})
};
fetch('https://api.example.com/api/auth/principals/{user_id}', 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/api/auth/principals/{user_id}",
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([
'disabled' => true,
'display_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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/api/auth/principals/{user_id}"
payload := strings.NewReader("{\n \"disabled\": true,\n \"display_name\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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/api/auth/principals/{user_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"disabled\": true,\n \"display_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/auth/principals/{user_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"disabled\": true,\n \"display_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"created_at": "2023-11-07T05:31:56Z",
"display_name": "<string>",
"kind": "human",
"user_id": "<string>",
"created_by": "<string>",
"disabled": false
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Authorizations
Path Parameters
Body
Response
Success.
A principal: the unit of identity and authority every credential belongs to.
user_id is the id the access-control policy row is keyed by. kind is
human (authenticates through an accounts provider) or service (holds
keys only, never logs in interactively). display_name is the operator-
facing label. created_by is the principal id that created this one, or
None for the owner the setup door mints. disabled turns off every
credential the principal owns. created_at is timezone-aware (UTC).
Show child attributes
Show child attributes

