Zum Inhalt springen

Create a collection share

POST
/api/collections/{id}/shares
curl --request POST \
--url https://firma.company-gpt.com/companygpt/rag/api/api/collections/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/shares \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "type": "user", "target": "example", "targetDisplay": "example", "role": "viewer" }'

Share a collection with a user, an Entra group, or the public. Only collection owners may create shares.

id
required
string format: uuid

Collection UUID

Media typeapplication/json

Target is required unless type is “public”

object
type
required
string
Allowed values: user entra_user entra_group public
target
string
targetDisplay
string
role
required

“owner” is only accepted for “user”/“entra_user” shares

string
Allowed values: viewer admin owner

Share created

Media typeapplication/json

A collection share (handlers.ShareResponse)

object
id
required
string format: uuid
collection_id
required
string format: uuid
type
required
string
Allowed values: user entra_user entra_group public
target
required

Email for “user” shares, Entra object ID for “entra_user”/“entra_group” shares, empty for “public”

string
targetDisplay
required

Human-readable label (e.g. resolved Entra group name); falls back to “target”

string
name

Display name of the principal, when known

string
email

Address of the principal, when known (groups usually have none)

string
role
required

“owner” shares express collection ownership; a collection always has at least one and they are only valid for “user”/“entra_user” shares.

string
Allowed values: viewer admin owner
created_at
required
string format: date-time
Example
{
"type": "user",
"role": "viewer"
}

Invalid request (bad type/role, or missing target for a non-public share)

Unauthorized

Forbidden — only collection owners may create shares

Collection not found

Share already exists for this target