---
title: "Change a member's role and/or project access (session only; owners manage everyone, admins developers/viewers/billing)"
method: PATCH
path: "/orgs/{orgId}/members/{userId}"
tags: ["Teams"]
---

# Change a member's role and/or project access (session only; owners manage everyone, admins developers/viewers/billing)

`PATCH /orgs/{orgId}/members/{userId}`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/orgs/{orgId}/members/{userId}`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Path parameters

- `orgId` string, uuid, required
- `userId` string, uuid, required

## Request body

- object
  - `role` 'owner' | 'admin' | 'developer' | 'viewer' | 'billing'
  - `projectAccess` object: developers and viewers: "All projects" or selected projects
    - `allProjects` boolean, required
    - `projectIds` string[]: ignored when allProjects is true

## Response `200`

Updated members

- object
  - `role` 'owner' | 'admin' | 'developer' | 'viewer' | 'billing' | 'editor', required: your role in this team
  - `members` object[], required: owners/admins see every member, other roles only themselves
    - `userId` string, uuid, required
    - `name` string, required
    - `email` string, required
    - `role` 'owner' | 'admin' | 'developer' | 'viewer' | 'billing' | 'editor', required: `editor` is a legacy role: existing members keep it, it can no longer be assigned
    - `allProjects` boolean, required: owner/admin/billing always; developer/viewer when given "All projects" (including future ones)
    - `projectIds` string[], required: the selected projects when allProjects is false
    - `mfaEnabled` boolean, required: an authenticator app is set up on Hostingsurge
    - `ssoLinked` boolean, required: the member has signed in through the team's SSO connection
    - `self` boolean, required
  - `invitations` object[], required: pending invitations (owners/admins only)
    - `id` string, uuid, required
    - `email` string, required
    - `role` 'owner' | 'admin' | 'developer' | 'viewer' | 'billing' | 'editor', required: `editor` is a legacy role: existing members keep it, it can no longer be assigned
    - `allProjects` boolean, required
    - `projectIds` string[], required
    - `createdAt` string, required: ISO-8601 timestamp
    - `expiresAt` string, required: ISO-8601 timestamp

## Other responses

- `400`: Invalid request (code invalid_request; details.reason names a policy rule)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Not permitted (code forbidden). details.sessionRequired: changes need a dashboard session; details.reauthenticate: sign in again (changes need a session younger than 5 minutes); details.policy: the team requires mfa/sso. Code ip_not_allowed: the team's IP allow-list does not include your address (details.clientIp)
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Conflicts with the team state, e.g. the last owner (code conflict)
- `429`: Too many requests (code rate_limited); see Retry-After

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
