Skip to main content
A collection in R2R is a logical grouping of users and documents that allows for efficient access control and organization. Collections enable you to manage permissions and access to documents at a collection level, rather than individually. R2R provides a comprehensive set of collection features, allowing you to implement efficient access control and organization of users and documents in your applications.
Collection permissioning in R2R is still under development and as a result the API will likely evolve.

Collection creation and Management

Create a Collection

Create a new collection with a name and optional description:
dict

Get Collection details

Retrieve details about a specific collection:
dict

Update a Collection

Update a collection’s name or description:
dict

List Collections

Get a list of all collections:
dict

User Management in Collections

Add User to Collection

Add a user to a collection:
dict

Remove User from Collection

Remove a user from a collection:
dict

List Users in Collection

Get a list of all users in a specific collection:
dict

Get User’s Collections

Get all collections that a user is a member of:
dict

Document Management in Collections

Assign Document to Collection

Assign a document to a collection:
dict

Remove Document from Collection

Remove a document from a collection:
dict

List Documents in Collection

Get a list of all documents in a specific collection:
dict

Get Document’s Collections

Get all collections that a document is assigned to:
dict

Advanced Collection Management

Collection Overview

Get an overview of collections, including user and document counts:
dict

Delete a Collection

Delete a collection:
dict

Pagination and Filtering

Many collection-related methods support pagination and filtering:

Security Considerations

When implementing collection permissions, consider the following security best practices:
  1. Always use HTTPS in production to encrypt data in transit.
  2. Implement the principle of least privilege by assigning the minimum necessary permissions to users and collections.
  3. Regularly audit collection memberships and document assignments.
  4. Ensure that only authorized users (e.g., admins) can perform collection management operations.
  5. Implement comprehensive logging for all collection-related actions.
  6. Consider implementing additional access controls or custom roles within your application logic for more fine-grained permissions.
For more advanced use cases or custom implementations, refer to the R2R documentation or reach out to the community for support.