Change a member's system role
curl --request POST \
--url https://api.langdock.com/user-management/v1/update-user-role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "user@example.com",
"role": "editor"
}
'import requests
url = "https://api.langdock.com/user-management/v1/update-user-role"
payload = {
"email": "user@example.com",
"role": "editor"
}
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({email: 'user@example.com', role: 'editor'})
};
fetch('https://api.langdock.com/user-management/v1/update-user-role', 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.langdock.com/user-management/v1/update-user-role",
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([
'email' => 'user@example.com',
'role' => 'editor'
]),
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.langdock.com/user-management/v1/update-user-role"
payload := strings.NewReader("{\n \"email\": \"user@example.com\",\n \"role\": \"editor\"\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://api.langdock.com/user-management/v1/update-user-role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"user@example.com\",\n \"role\": \"editor\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/user-management/v1/update-user-role")
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 \"email\": \"user@example.com\",\n \"role\": \"editor\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"email": "user@example.com",
"role": "editor"
}User Management API
Update User Role
Change an active member’s workspace system role to member, editor, or admin
POST
/
user-management
/
v1
/
update-user-role
Change a member's system role
curl --request POST \
--url https://api.langdock.com/user-management/v1/update-user-role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "user@example.com",
"role": "editor"
}
'import requests
url = "https://api.langdock.com/user-management/v1/update-user-role"
payload = {
"email": "user@example.com",
"role": "editor"
}
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({email: 'user@example.com', role: 'editor'})
};
fetch('https://api.langdock.com/user-management/v1/update-user-role', 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.langdock.com/user-management/v1/update-user-role",
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([
'email' => 'user@example.com',
'role' => 'editor'
]),
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.langdock.com/user-management/v1/update-user-role"
payload := strings.NewReader("{\n \"email\": \"user@example.com\",\n \"role\": \"editor\"\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://api.langdock.com/user-management/v1/update-user-role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"user@example.com\",\n \"role\": \"editor\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/user-management/v1/update-user-role")
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 \"email\": \"user@example.com\",\n \"role\": \"editor\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"email": "user@example.com",
"role": "editor"
}This endpoint changes an active human member’s workspace system role by email. Send
member, editor, or admin. Custom roles are not part of this endpoint.
The call is authorized by the workspace API key’s USER_MANAGEMENT_API scope. It does not run as the person who created the key, so it keeps working after that admin leaves the workspace.
Base URL
https://api.langdock.com/user-management/v1/update-user-role
Dedicated deploymentsReplace
api.langdock.com with <your-deployment-url>/api/public in all requests.Prerequisites
- API Key with the
USER_MANAGEMENT_APIscope - The API key must be created by a workspace admin
Behavior
- Not an active human member? Returns
404(unknown email, invited, deactivated, service account, or another workspace). - Last remaining admin? Returns
400withcode: "BAD_REQUEST". - Repeating the member’s current role succeeds.
- Email matching is case-insensitive. Role values are lowercase:
member,editor,admin.ADMINreturns400.
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.
Authorizations
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
application/json
Response
Role updated successfully
Always "success" when the role is updated
Available options:
success Example:
"success"
Email address of the updated member
Example:
"user@example.com"
System role after the update
Available options:
member, editor, admin Example:
"editor"
Was this page helpful?