Members
Update member role
Updates a workspace member’s role. Cannot update your own role or demote owners.
PATCH
/
workspaces
/
{workspaceSlug}
/
members
/
{username}
/
Update member role
curl --request PATCH \
--url https://api.example.com/workspaces/{workspaceSlug}/members/{username}/ \
--header 'Content-Type: application/json' \
--data '
{
"role": "owner"
}
'import requests
url = "https://api.example.com/workspaces/{workspaceSlug}/members/{username}/"
payload = { "role": "owner" }
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({role: 'owner'})
};
fetch('https://api.example.com/workspaces/{workspaceSlug}/members/{username}/', 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/workspaces/{workspaceSlug}/members/{username}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'role' => 'owner'
]),
CURLOPT_HTTPHEADER => [
"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/workspaces/{workspaceSlug}/members/{username}/"
payload := strings.NewReader("{\n \"role\": \"owner\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.example.com/workspaces/{workspaceSlug}/members/{username}/")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"owner\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workspaces/{workspaceSlug}/members/{username}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"owner\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "2023-11-07T05:31:56Z",
"emailAddress": "<string>",
"has2fa": true,
"memberRole": "owner",
"username": "<string>",
"avatarUrl": "<string>",
"displayName": "<string>"
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}"<string>""<string>"Path Parameters
URL-safe workspace identifier.
Public handle of the member's account.
Required string length:
3 - 32Pattern:
^[a-z0-9]+(?:-[a-z0-9]+)*$Body
application/json
Request to update a member's role.
Request to update a member's role.
New role for the member.
Allowed value:
"owner"Response
Represents a workspace member.
Represents a workspace member.
Timestamp when the member joined the workspace.
Email address of the member.
Whether the member has two-factor authentication enabled.
Role of the member in the workspace.
Allowed value:
"owner"Handle of the member's account.
Required string length:
3 - 32Pattern:
^[a-z0-9]+(?:-[a-z0-9]+)*$Serve path of the member's avatar, when set.
Display name of the member, when set.
Update member role
curl --request PATCH \
--url https://api.example.com/workspaces/{workspaceSlug}/members/{username}/ \
--header 'Content-Type: application/json' \
--data '
{
"role": "owner"
}
'import requests
url = "https://api.example.com/workspaces/{workspaceSlug}/members/{username}/"
payload = { "role": "owner" }
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({role: 'owner'})
};
fetch('https://api.example.com/workspaces/{workspaceSlug}/members/{username}/', 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/workspaces/{workspaceSlug}/members/{username}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'role' => 'owner'
]),
CURLOPT_HTTPHEADER => [
"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/workspaces/{workspaceSlug}/members/{username}/"
payload := strings.NewReader("{\n \"role\": \"owner\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.example.com/workspaces/{workspaceSlug}/members/{username}/")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"owner\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workspaces/{workspaceSlug}/members/{username}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"owner\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "2023-11-07T05:31:56Z",
"emailAddress": "<string>",
"has2fa": true,
"memberRole": "owner",
"username": "<string>",
"avatarUrl": "<string>",
"displayName": "<string>"
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}"<string>""<string>"