Update a collection share
const url = 'https://firma.company-gpt.com/companygpt/rag/api/api/collections/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/shares/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"role":"viewer"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://firma.company-gpt.com/companygpt/rag/api/api/collections/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/shares/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "role": "viewer" }'Change a share’s role, including handing over ownership. Only collection owners may update shares.
Authorizations
Abschnitt betitelt „Authorizations“Parameters
Abschnitt betitelt „Parameters“Path Parameters
Abschnitt betitelt „Path Parameters“Collection UUID
Share UUID
Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“object
Set “owner” to hand over (or add) ownership. Moving the last owner off “owner” is rejected with 409 — a collection must keep an owner.
Responses
Abschnitt betitelt „Responses“Share updated
A collection share (handlers.ShareResponse)
object
Email for “user” shares, Entra object ID for “entra_user”/“entra_group” shares, empty for “public”
Human-readable label (e.g. resolved Entra group name); falls back to “target”
Display name of the principal, when known
Address of the principal, when known (groups usually have none)
“owner” shares express collection ownership; a collection always has at least one and they are only valid for “user”/“entra_user” shares.
Example
{ "type": "user", "role": "viewer"}Invalid request
Unauthorized
Forbidden — only collection owners may update shares
Collection or share not found
Conflict — the collection would be left without an owner