Update Member Role
curl --request PATCH \
--url https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}"
payload = { "role": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: '<string>'})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}', 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.bunship.com/api/v1/organizations/{orgId}/members/{memberId}",
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' => '<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.bunship.com/api/v1/organizations/{orgId}/members/{memberId}"
payload := strings.NewReader("{\n \"role\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "mbr_def456",
"userId": "usr_xyz789ghi012345",
"organizationId": "org_cld2abc123def456",
"role": "admin",
"user": {
"id": "usr_xyz789ghi012345",
"email": "jane@example.com",
"fullName": "Jane Smith",
"avatarUrl": null
},
"joinedAt": "2024-02-01T14:30:00Z"
}
Members
Update Member Role
Change a member’s role within the organization
PATCH
/
api
/
v1
/
organizations
/
{orgId}
/
members
/
{memberId}
Update Member Role
curl --request PATCH \
--url https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}"
payload = { "role": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: '<string>'})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}', 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.bunship.com/api/v1/organizations/{orgId}/members/{memberId}",
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' => '<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.bunship.com/api/v1/organizations/{orgId}/members/{memberId}"
payload := strings.NewReader("{\n \"role\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/members/{memberId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "mbr_def456",
"userId": "usr_xyz789ghi012345",
"organizationId": "org_cld2abc123def456",
"role": "admin",
"user": {
"id": "usr_xyz789ghi012345",
"email": "jane@example.com",
"fullName": "Jane Smith",
"avatarUrl": null
},
"joinedAt": "2024-02-01T14:30:00Z"
}
Updates a member’s role. You cannot change the owner’s role (transfer ownership first) or your own role. Requires the
members:update permission.
Auth
Requires a valid Bearer token with
members:update permission.Path Parameters
Organization identifier.
Membership identifier of the member to update.
Request Body
New role for the member. One of
"admin", "member", or "viewer". Cannot assign "owner" —
use ownership transfer instead.Response
Returns the updated member object with embedded user profile.{
"id": "mbr_def456",
"userId": "usr_xyz789ghi012345",
"organizationId": "org_cld2abc123def456",
"role": "admin",
"user": {
"id": "usr_xyz789ghi012345",
"email": "jane@example.com",
"fullName": "Jane Smith",
"avatarUrl": null
},
"joinedAt": "2024-02-01T14:30:00Z"
}
Errors
| Status | Code | Description |
|---|---|---|
400 | VALIDATION_ERROR | Cannot change owner role or your own role |
401 | AUTHENTICATION_ERROR | Missing or invalid Bearer token |
403 | AUTHORIZATION_ERROR | Insufficient permissions (members:update required) |
404 | NOT_FOUND | Member not found in this organization |
Example
curl -X PATCH https://api.bunship.com/api/v1/organizations/org_cld2abc123def456/members/mbr_def456 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{"role": "admin"}'
⌘I

