# Client setup

> Client setup - Configures the global API client for the Python SDK. The client will be configured in
> one of the following ways, in order of priority.

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.821930+00:00` (UTC).

## Primary page

- [Client setup](https://docs.datarobot.com/en/docs/api/reference/sdk/client-setup.html): Full documentation for this topic (HTML).

## Sections on this page

- [datarobot.client.Client(token=None, endpoint=None, config_path=None, connect_timeout=None, ssl_verify=None, max_retries=None, use_tcp_keepalive=None, token_type=None, default_use_case=None, enable_api_consumer_tracking=None, trace_context=None)](https://docs.datarobot.com/en/docs/api/reference/sdk/client-setup.html#datarobot.client.Client): In-page section heading.
- [datarobot.client.get_client()](https://docs.datarobot.com/en/docs/api/reference/sdk/client-setup.html#datarobot.client.get_client): In-page section heading.
- [datarobot.client.set_client(client)](https://docs.datarobot.com/en/docs/api/reference/sdk/client-setup.html#datarobot.client.set_client): In-page section heading.
- [datarobot.client.client_configuration(*args, **kwargs)](https://docs.datarobot.com/en/docs/api/reference/sdk/client-setup.html#datarobot.client.client_configuration): In-page section heading.
- [classdatarobot.rest.RESTClientObject](https://docs.datarobot.com/en/docs/api/reference/sdk/client-setup.html#datarobot.rest.RESTClientObject): In-page section heading.
- [open_in_browser()](https://docs.datarobot.com/en/docs/api/reference/sdk/client-setup.html#datarobot.rest.RESTClientObject.open_in_browser): 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.
- [Client configuration](https://docs.datarobot.com/en/docs/api/reference/sdk/tag-clientconfig.html): Linked from this page.

## Documentation content

### datarobot.client.Client(token=None, endpoint=None, config_path=None, connect_timeout=None, ssl_verify=None, max_retries=None, use_tcp_keepalive=None, token_type=None, default_use_case=None, enable_api_consumer_tracking=None, trace_context=None)

Configures the global API client for the Python SDK. The client will be configured in one of
the following ways, in order of priority.

> [!NOTE] Notes
> Token and endpoint must be specified from one source only. This is a restriction
> to prevent token leakage if environment variables or config file are used.
> 
> The DataRobotClientConfig params will be looking up to find the configuration parameters
> in one of the following ways,
> 
> From call kwargs if specified;
> From a YAML file at the path specified in the
> config_path
> kwarg;
> From a YAML file at the path specified in the environment variables
> DATAROBOT_CONFIG_FILE
> ;
> From environment variables;
> From the default values in the default YAML file
>    at the path $HOME/.config/datarobot/drconfig.yaml.
> 
> This can also have the side effect of setting a default Use Case for client API requests.

- Parameters:
- Return type: RESTClientObject
- Returns: The RESTClientObject instance created.

### datarobot.client.get_client()

Returns the global HTTP client for the Python SDK, instantiating it
if necessary.

- Return type: RESTClientObject

### datarobot.client.set_client(client)

Configure the global HTTP client for the Python SDK.
Returns previous instance.

- Return type: Optional [ RESTClientObject ]

### datarobot.client.client_configuration(*args, **kwargs)

This context manager can be used to temporarily change the global HTTP client.

In multithreaded scenarios, it is highly recommended to use a fresh manager object
per thread.

DataRobot does not recommend nesting these contexts.

- Parameters:

> [!NOTE] Examples
> ```
> from datarobot.client import client_configuration
> from datarobot.models import Project
> 
> with client_configuration(default_use_case=[]):
>     # Interact with all accessible projects, not just those associated
>     # with the current use case.
>     Project.list()
> 
> with client_configuration(token="api-key-here", endpoint="https://host-name.com"):
>     # Interact with projects on a different DataRobot instance.
>     Project.list()
> ```
> 
> ```
> from datarobot.client import Client, client_configuration
> from datarobot.models import Project
> 
> Client()  # Interact with DataRobot using the default configuration.
> Project.list()
> 
> with client_configuration(config_path="/path/to/a/drconfig.yaml"):
>     # Interact with DataRobot using a different configuration.
>     Project.list()
> ```

### class datarobot.rest.RESTClientObject

- Parameters:

#### open_in_browser()

Opens the DataRobot app in a web browser, or logs the
URL if a browser is not available.

- Return type: None
