# Sharing

> Sharing - Once you have created entities in DataRobot, you may want to share them with
> collaborators. DataRobot provides an API for sharing the following entities:

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-04-24T16:03:56.276436+00:00` (UTC).

## Primary page

- [Sharing](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/sharing.html): Full documentation for this topic (HTML).

## Sections on this page

- [Access levels](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/sharing.html#access-levels): In-page section heading.
- [Examples](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/sharing.html#examples): In-page section heading.

## Related documentation

- [Developer documentation](https://docs.datarobot.com/en/docs/api/index.html): Linked from this page.
- [Developer learning](https://docs.datarobot.com/en/docs/api/dev-learning/index.html): Linked from this page.
- [Python API client user guide](https://docs.datarobot.com/en/docs/api/dev-learning/python/index.html): Linked from this page.
- [Administration](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/index.html): Linked from this page.
- [Database connectivity](https://docs.datarobot.com/en/docs/api/dev-learning/python/data/database_connectivity.html#database-connectivity-overview): Linked from this page.
- [Deployment sharing](https://docs.datarobot.com/en/docs/api/dev-learning/python/mlops/deployment.html#deployment-sharing): Linked from this page.
- [Use Case sharing](https://docs.datarobot.com/en/docs/api/dev-learning/python/use_cases/use_cases.html#use-case-sharing): Linked from this page.
- [UI documentation for roles and permissions](https://docs.datarobot.com/en/docs/get-started/acct-mgmt/data-sharing/roles-permissions.html): Linked from this page.

## Documentation content

# Sharing

Once you have created entities in DataRobot, you may want to share them with collaborators.
DataRobot provides an API for sharing the following entities:

> Data sources and data stores ( seeDatabase connectivityfor more info on connecting to JDBC databases)DatasetsProjectsCalendar filesModel deployments (seeDeployment sharingfor more information on sharing deployments)Use Cases (Sharing for Use Cases is slightly different than what’s documented on this page. SeeUse Case sharingfor more information and examples.)

## Access levels

Entities can be shared at varying access levels.
For example, you can allow someone to create projects from a data source you have built without allowing them to delete it.

Each entity type uses slightly different permission names intended to specifically convey what kind of actions are available.
These roles fall into three categories.
These generic role names can be used in the sharing API for any entity.

For the complete set of actions granted by each role on a given entity, see the [UI documentation for roles and permissions](https://docs.datarobot.com/en/docs/get-started/acct-mgmt/data-sharing/roles-permissions.html).

> OWNERUsed for all entities.Allows any action including deletion.READ_WRITEKnown asEDITORon data sources and data stores.Allows modifications to the state, such as renaming and creating data sources from a data store, butnotdeleting the entity.READ_ONLYKnown asCONSUMERon data sources and data stores.For data sources, enables creating projects and predictions; for data stores, only allows you to view them.

When a user’s new role is specified as `None`, their access will be revoked.

In addition to the role, some entities (data sources and data stores) allow separate control over whether a new user should be able to share that entity further.
When granting access to a user, the `can_share` parameter determines whether that user can, in turn, share this entity with another user.
When this parameter is set as false, the user in question has all the access to the entity granted by their role and can remove themselves if desired, but are unable to change the role of any other user.

## Examples

Transfer access to the data source from [mailto:old_user@datarobot.com](mailto:old_user@datarobot.com) to [mailto:new_user@datarobot.com](mailto:new_user@datarobot.com).

```
import datarobot as dr

new_access = dr.SharingAccess(
   "new_user@datarobot.com",
   dr.enums.SHARING_ROLE.OWNER,
   can_share=True,
)
access_list = [dr.SharingAccess("old_user@datarobot.com", None), new_access]

dr.DataSource.get('my-data-source-id').share(access_list)
```

To check access to a project:

```
import datarobot as dr

project = dr.Project.create('mydata.csv', project_name='My Data')

access_list = project.get_access_list()

access_list[0].username
```

To transfer ownership of all projects owned by your account to [mailto:new_user@datarobot.com](mailto:new_user@datarobot.com) without sending notifications:

```
import datarobot as dr

# Put path to YAML credentials below
dr.Client(config_path= '.yaml')

# Get all projects for your account and store the ids in a list
projects = dr.Project.list()

project_ids = [project.id for project in projects]

# List of emails to share with
share_targets = ['new_user@datarobot.com']

# Target role
target_role = dr.enums.SHARING_ROLE.OWNER

for pid in project_ids:

   project = dr.Project.get(project_id=pid)

   shares = []

   for user in share_targets:

      shares.append(dr.SharingAccess(username=user, role=target_role))

   project.share(shares, send_notification=False)
```
