---
title: "Change a library member's role"
method: PATCH
path: "/api/libraries/{library_id}/members/{user_id}"
tags: ["libraries"]
---

# Change a library member's role

`PATCH /api/libraries/{library_id}/members/{user_id}`

## Request

- Base URL: `https://api.gumnut.ai`
- URL: `https://api.gumnut.ai/api/libraries/{library_id}/members/{user_id}`
- Auth: HTTP bearer

Change an active non-owner member's role. Repeating the same role is unchanged. An inactive membership or attempt to change the owner returns 409; retrying unchanged will not clear it.

## Path parameters

- `library_id` string, required: Library identifier.
- `user_id` string, required: Member account identifier.

## Request body

- MembershipRoleUpdate
  - `role` 'viewer' | 'collaborator', required: Non-owner library permissions. viewer reads library content. collaborator also edits and organizes content, including trash and restore. Neither administers members or permanently deletes photos.

## Response `200`

Successful Response

- MembershipResponse
  - `id` string, required: Stable membership record identifier.
  - `library_id` string, required: Library this membership belongs to.
  - `user` UserSummary, required
    - `id` string, required: User identifier
    - `display_name` string, nullable, required: Public display name, when available
  - `role` 'viewer' | 'collaborator', required: Non-owner library permissions. viewer reads library content. collaborator also edits and organizes content, including trash and restore. Neither administers members or permanently deletes photos.
  - `state` 'active' | 'left' | 'removed', required: A member's library access state. active grants the assigned role. left means the member departed; removed means the owner revoked access. left and removed grant no access.
  - `joined_at` string, date-time, required: Most recent admission instant.
  - `ended_at` string, date-time, nullable, required: Most recent departure or removal instant, or null while active.
  - `last_removed_at` string, date-time, nullable, required: Retained owner-removal cutoff for readmission, or null.
  - `created_at` string, date-time, required: When this record was created.
  - `updated_at` string, date-time, required: When this record last changed.

## Other responses

- `401`: Missing, invalid, or expired credentials.
- `403`: The credentials are valid but not authorized for this operation — for example an API key whose action or library scope excludes it, or a credential type this operation does not accept.
- `404`: Not found
- `409`: `membership_inactive`: membership is inactive, or `owner_membership_protected`: it belongs to the owner. Retrying unchanged will not clear the conflict. Clerk sign-in could not be associated with the existing account. Resolve the identity conflict before retrying sign-in; repeated requests with unchanged verification and identity state will not resolve it.
- `422`: Validation Error
- `429`: Rate limit exceeded, or too many of your requests are already in progress. Retry after the interval in the `Retry-After` header.
- `503`: Authentication provider temporarily unavailable. Retry sign-in later.

## Changes

- **2026-10-16** `7c2860d9eb88`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gumnut-ai/apis/gumnut-api/changes/api/libraries/:library_id/members/:user_id/patch.md)

---

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