# Use cases

> Use cases - Returns the Use Cases associated with this account.

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-05-06T18:17:09.844191+00:00` (UTC).

## Primary page

- [Use cases](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html): Full documentation for this topic (HTML).

## Sections on this page

- [classdatarobot.UseCase](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase): In-page section heading.
- [get_uri()](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.get_uri): In-page section heading.
- [classmethodget(use_case_id)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.get): In-page section heading.
- [classmethodlist(search_params=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.list): In-page section heading.
- [classmethodcreate(name=None, description=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.create): In-page section heading.
- [classmethoddelete(use_case_id)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.delete): In-page section heading.
- [update(name=None, description=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.update): In-page section heading.
- [add(entity=None, entity_type=None, entity_id=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.add): In-page section heading.
- [remove(entity=None, entity_type=None, entity_id=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.remove): In-page section heading.
- [share(roles)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.share): In-page section heading.
- [get_shared_roles(offset=None, limit=None, id=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.get_shared_roles): In-page section heading.
- [list_projects()](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.list_projects): In-page section heading.
- [list_datasets()](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.list_datasets): In-page section heading.
- [list_applications()](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.list_applications): In-page section heading.
- [classmethodfrom_data(data)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.from_data): In-page section heading.
- [classmethodfrom_server_data(data, keep_attrs=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.from_server_data): In-page section heading.
- [open_in_browser()](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.UseCase.open_in_browser): In-page section heading.
- [classdatarobot.models.use_cases.use_case.UseCaseUser](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.models.use_cases.use_case.UseCaseUser): In-page section heading.
- [classdatarobot.models.use_cases.use_case.UseCaseReferenceEntity](https://docs.datarobot.com/en/docs/api/reference/sdk/use-cases.html#datarobot.models.use_cases.use_case.UseCaseReferenceEntity): In-page section heading.

## Related documentation

- [Developer documentation](https://docs.datarobot.com/en/docs/api/index.html): Linked from this page.
- [API reference](https://docs.datarobot.com/en/docs/api/reference/index.html): Linked from this page.
- [Python API client](https://docs.datarobot.com/en/docs/api/reference/sdk/index.html): Linked from this page.
- [Collaboration](https://docs.datarobot.com/en/docs/api/reference/sdk/tag-collaboration.html): Linked from this page.
- [user guide](https://docs.datarobot.com/en/docs/api/dev-learning/python/use_cases/use_cases.html#add-project-to-a-use-case): Linked from this page.
- [Application](https://docs.datarobot.com/en/docs/api/reference/sdk/applications.html#datarobot.Application): Linked from this page.
- [SharingRole](https://docs.datarobot.com/en/docs/api/reference/sdk/data-registry.html#datarobot.models.sharing.SharingRole): Linked from this page.

## Documentation content

### class datarobot.UseCase

Representation of a Use Case.

- Variables:

> [!NOTE] Examples
> ```
> import datarobot
> with UseCase.get("2348ac"):
>     print(f"The current use case is {dr.Context.use_case}")
> ```

#### get_uri()

- Returns: url – Permanent static hyperlink to this Use Case.
- Return type: str

#### classmethod get(use_case_id)

Gets information about a Use Case.

- Parameters: use_case_id ( str ) – The identifier of the Use Case you want to load.
- Returns: use_case – The queried Use Case.
- Return type: UseCase

#### classmethod list(search_params=None)

Returns the Use Cases associated with this account.

- Parameters:search_params(dict,optional.) – If notNone, the returned projects are filtered by lookup. NotesCurrently, you can query use cases by:offset- The number of records to skip over. Default 0.limit- The number of records to return in the range from 1 to 100. Default 100.search- Only return Use Cases with names that match the given string.project_id- Only return Use Cases associated with the given project ID.application_id- Only return Use Cases associated with the given app.orderBy- The order to sort the Use Cases.orderByqueries can use the following options:idor-idnameor-namedescriptionor-descriptionprojects_countor-projects_countdatasets_countor-datasets_countfiles_countor-files_countnotebooks_countor-notebooks_countapplications_countor-applications_countcreated_ator-created_atcreated_byor-created_byupdated_ator-updated_atupdated_byor-updated_by

- Returns: use_cases – Contains a list of Use Cases associated with this user
  account.
- Return type: list of UseCase instances
- Raises: TypeError – Raised if search_params parameter is provided,
      but is not of supported type.

#### classmethod create(name=None, description=None)

Create a new Use Case.

- Parameters:
- Returns: use_case – The created Use Case.
- Return type: UseCase

#### classmethod delete(use_case_id)

Delete a Use Case.

- Parameters: use_case_id ( str ) – The ID of the Use Case to be deleted.
- Return type: None

#### update(name=None, description=None)

Update a Use Case’s name or description.

- Parameters:
- Returns: use_case – The updated Use Case.
- Return type: UseCase

#### add(entity=None, entity_type=None, entity_id=None)

Add an entity (project, dataset, etc.) to a Use Case. Can only accept either an entity or
an entity type and entity ID, but not both.

Projects and Applications can only be linked to a single Use Case. Datasets can be linked to multiple Use Cases.

There are some prerequisites for linking Projects to a Use Case which are explained in the [user guide](https://docs.datarobot.com/en/docs/api/dev-learning/python/use_cases/use_cases.html#add-project-to-a-use-case).

- Parameters:
- Returns: use_case_reference_entity – The newly created reference link between this Use Case and the entity.
- Return type: UseCaseReferenceEntity

#### remove(entity=None, entity_type=None, entity_id=None)

Remove an entity from a Use Case. Can only accept either an entity or
an entity type and entity ID, but not both.

- Parameters:
- Return type: None

#### share(roles)

Share this Use Case with or remove access from one or more user(s).

- Parameters:roles(List[SharingRole]) – A list ofSharingRoleinstances, each of which
references a user and a role to be assigned. Currently, the only supported roles for Use Cases are OWNER, EDITOR, and CONSUMER,
and the only supported SHARING_RECIPIENT_TYPE is USER. To remove access, set a user’s role todatarobot.enums.SHARING_ROLE.NO_ROLE.
*Return type:None

> [!NOTE] Examples
> The [SharingRole](https://docs.datarobot.com/en/docs/api/reference/sdk/data-registry.html#datarobot.models.sharing.SharingRole) class is needed in order to
> share a Use Case with one or more users.
> 
> For example, suppose you had a list of user IDs you wanted to share this Use Case with. You could use
> a loop to generate a list of [SharingRole](https://docs.datarobot.com/en/docs/api/reference/sdk/data-registry.html#datarobot.models.sharing.SharingRole) objects for them,
> and bulk share this Use Case.
> 
> ```
> >>> from datarobot.models.use_cases.use_case import UseCase
> >>> from datarobot.models.sharing import SharingRole
> >>> from datarobot.enums import SHARING_ROLE, SHARING_RECIPIENT_TYPE
> >>>
> >>> user_ids = ["60912e09fd1f04e832a575c1", "639ce542862e9b1b1bfa8f1b", "63e185e7cd3a5f8e190c6393"]
> >>> sharing_roles = []
> >>> for user_id in user_ids:
> ...     new_sharing_role = SharingRole(
> ...         role=SHARING_ROLE.CONSUMER,
> ...         share_recipient_type=SHARING_RECIPIENT_TYPE.USER,
> ...         id=user_id,
> ...     )
> ...     sharing_roles.append(new_sharing_role)
> >>> use_case = UseCase.get(use_case_id="5f33f1fd9071ae13568237b2")
> >>> use_case.share(roles=sharing_roles)
> ```
> 
> Similarly, a [SharingRole](https://docs.datarobot.com/en/docs/api/reference/sdk/data-registry.html#datarobot.models.sharing.SharingRole) instance can be used to
> remove a user’s access if the `role` is set to `SHARING_ROLE.NO_ROLE`, like in this example:
> 
> ```
> >>> from datarobot.models.use_cases.use_case import UseCase
> >>> from datarobot.models.sharing import SharingRole
> >>> from datarobot.enums import SHARING_ROLE, SHARING_RECIPIENT_TYPE
> >>>
> >>> user_to_remove = "foo.bar@datarobot.com"
> ... remove_sharing_role = SharingRole(
> ...     role=SHARING_ROLE.NO_ROLE,
> ...     share_recipient_type=SHARING_RECIPIENT_TYPE.USER,
> ...     username=user_to_remove,
> ... )
> >>> use_case = UseCase.get(use_case_id="5f33f1fd9071ae13568237b2")
> >>> use_case.share(roles=[remove_sharing_role])
> ```

#### get_shared_roles(offset=None, limit=None, id=None)

Retrieve access control information for this Use Case.

- Parameters:
- Return type: List [ SharingRole ]

#### list_projects()

List all projects associated with this Use Case.

- Returns: projects – All projects associated with this Use Case.
- Return type: List[Project]

#### list_datasets()

List all datasets associated with this Use Case.

- Returns: datasets – All datasets associated with this Use Case.
- Return type: List[Dataset]

#### list_applications()

List all applications associated with this Use Case.

- Returns: applications – All applications associated with this Use Case.
- Return type: List[Application]

#### classmethod from_data(data)

Instantiate an object of this class using a dict.

- Parameters: data ( dict ) – Correctly snake_cased keys and their values.
- Return type: TypeVar ( T , bound= APIObject)

#### classmethod from_server_data(data, keep_attrs=None)

Instantiate an object of this class using the data directly from the server,
meaning that the keys may have the wrong camel casing

- Parameters:
- Return type: TypeVar ( T , bound= APIObject)

#### open_in_browser()

Opens class’ relevant web browser location.
If default browser is not available the URL is logged.

Note:
If text-mode browsers are used, the calling process will block
until the user exits the browser.

- Return type: None

### class datarobot.models.use_cases.use_case.UseCaseUser

Representation of a Use Case user.

- Variables:

### class datarobot.models.use_cases.use_case.UseCaseReferenceEntity

An entity associated with a Use Case.

- Variables:
