Change a member's role
PATCH
/v1/members/{memberId}/role
const url = 'https://api.overwatch.weareheavy.dev/v1/members/example/role';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"role":"admin"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.overwatch.weareheavy.dev/v1/members/example/role \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "role": "admin" }'Change a member’s role. Routed through the auth layer, whose guards apply: a non-owner can’t mint owners, and the last owner is protected. Session-only, owner/admin.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”memberId
required
string
The member’s id (from GET /v1/members).
Request Bodyrequired
Section titled “ Request Bodyrequired ”Media typeapplication/json
object
role
required
string
Example
{ "role": "admin"}Responses
Section titled “ Responses ”The role was changed.
Media typeapplication/json
object
ok
required
boolean
Example
{ "ok": true}Invalid role, or the auth layer rejected the change.
Media typeapplication/json
object
error
required
A human-readable error message.
string
Example
{ "error": "role must be owner, admin, or member"}Missing or invalid credentials.
Media typeapplication/json
object
error
required
A human-readable error message.
string
Example
{ "error": "invalid api key"}A dashboard session is required (API-key callers are rejected), or the session’s role does not allow this action.
Media typeapplication/json
object
error
required
A human-readable error message.
string
Example
{ "error": "a dashboard session is required"}